List of usage examples for java.lang System getProperties
public static Properties getProperties()
From source file:org.focusns.service.env.impl.EnvironmentServiceImpl.java
protected Environment lookupOS() { if (envOS == null) { Properties props = System.getProperties(); Map<String, String> env = System.getenv(); ////w w w . ja va 2 s . co m envOS = new EnvironmentOS(); envOS.setOsName(props.getProperty("os.name")); envOS.setOsVersion(props.getProperty("os.version")); envOS.setOsArch(props.getProperty("os.arch")); envOS.setOsPatch(props.getProperty("sun.os.patch.level")); envOS.setOsPath(env.get("Path")); } // return envOS; }
From source file:com.azaptree.services.spring.application.SpringApplicationService.java
private static void logDebugSystemProperties(final Logger log) { Assert.notNull(log);/*from w w w .j a v a 2 s . c o m*/ if (log.isDebugEnabled()) { final TreeMap<String, String> sysProps = new TreeMap<>(); for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { sysProps.put(entry.getKey().toString(), entry.getValue().toString()); } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final PrintStream ps = new PrintStream(bos); for (final Map.Entry<String, String> entry : sysProps.entrySet()) { ps.print(entry.getKey()); ps.print('='); ps.println(entry.getValue()); } log.debug("System Properties:\n{}", bos); } }
From source file:ch.cyberduck.core.b2.B2SearchFeatureTest.java
@Test public void testSearchInBucket() throws Exception { final B2Session session = new B2Session(new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(), new Credentials(System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")))); final LoginConnectionService service = new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener()); service.connect(session, PathCache.empty(), new DisabledCancelCallback()); final String name = new AlphanumericRandomStringService().random(); final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path file = new B2TouchFeature(session).touch(new Path(bucket, name, EnumSet.of(Path.Type.file)), new TransferStatus()); final B2SearchFeature feature = new B2SearchFeature(session); assertNotNull(feature.search(bucket, new SearchFilter(name), new DisabledListProgressListener()) .find(new SimplePathPredicate(file))); // Supports prefix matching only assertNull(feature.search(bucket, new SearchFilter(StringUtils.substring(name, 2)), new DisabledListProgressListener()).find(new SimplePathPredicate(file))); assertNotNull(feature.search(bucket, new SearchFilter(StringUtils.substring(name, 0, name.length() - 2)), new DisabledListProgressListener()).find(new SimplePathPredicate(file))); final Path subdir = new Path(bucket, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); assertNull(feature.search(subdir, new SearchFilter(name), new DisabledListProgressListener()) .find(new SimplePathPredicate(file))); new B2DeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close();/*from ww w . j a va 2s . com*/ }
From source file:ch.cyberduck.core.s3.S3SearchFeatureTest.java
@Test public void testSearchInBucket() throws Exception { final S3Session session = new S3Session(new Host(new S3Protocol(), new S3Protocol().getDefaultHostname(), new Credentials(System.getProperties().getProperty("s3.key"), System.getProperties().getProperty("s3.secret")))); final LoginConnectionService service = new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener()); service.connect(session, PathCache.empty(), new DisabledCancelCallback()); final String name = new AlphanumericRandomStringService().random(); final Path bucket = new Path("test-us-east-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path file = new S3TouchFeature(session).touch(new Path(bucket, name, EnumSet.of(Path.Type.file)), new TransferStatus()); final S3SearchFeature feature = new S3SearchFeature(session); assertNotNull(feature.search(bucket, new SearchFilter(name), new DisabledListProgressListener()) .find(new SimplePathPredicate(file))); assertNotNull(feature.search(bucket, new SearchFilter(StringUtils.substring(name, 2)), new DisabledListProgressListener()).find(new SimplePathPredicate(file))); assertNotNull(feature.search(bucket, new SearchFilter(StringUtils.substring(name, 0, name.length() - 2)), new DisabledListProgressListener()).find(new SimplePathPredicate(file))); final Path subdir = new Path(bucket, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); assertNull(feature.search(subdir, new SearchFilter(name), new DisabledListProgressListener()) .find(new SimplePathPredicate(file))); new S3DefaultDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close();//from www . j a va2 s. c o m }
From source file:ch.cyberduck.core.shared.DefaultFindFeatureTest.java
@Test public void testFind() throws Exception { final B2Session session = new B2Session(new Host(new B2Protocol(), new B2Protocol().getDefaultHostname(), new Credentials(System.getProperties().getProperty("b2.user"), System.getProperties().getProperty("b2.key")))); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path bucket = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path file = new Path(bucket, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new B2TouchFeature(session).touch(file, new TransferStatus()); // Find without version id set in attributes new DefaultFindFeature(session).find(file); new B2DeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close();//from w ww . j a va 2s . co m }
From source file:com.nridge.core.base.std.Platform.java
/** * Determines if the current platform that the JVM is executing within is * a Linux-based operating system.//from w w w. ja va 2 s . co m * @return <i>true</i> if it is or <i>false</i> otherwise. */ public static boolean isLinux() { String osName; Properties osProperties; osProperties = System.getProperties(); osName = (String) osProperties.get("os.name"); return StringUtils.isNotEmpty(osName) && osName.startsWith(PLATFORM_LINUX); }
From source file:ch.cyberduck.core.sds.SDSWriteFeatureTest.java
@Test public void testReadWrite() throws Exception { final Host host = new Host(new SDSProtocol(), "duck.ssp-europe.eu", new Credentials( System.getProperties().getProperty("sds.user"), System.getProperties().getProperty("sds.key"))); final SDSSession session = new SDSSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final Path room = new SDSDirectoryFeature(session) .mkdir(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), null, new TransferStatus()); final byte[] content = RandomUtils.nextBytes(32769); final TransferStatus status = new TransferStatus(); status.setLength(content.length);/*w ww .ja va 2s . c o m*/ final Path test = new Path(room, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final SDSWriteFeature writer = new SDSWriteFeature(session); final HttpResponseOutputStream<VersionId> out = writer.write(test, status, new DisabledConnectionCallback()); assertNotNull(out); new StreamCopier(status, status).transfer(new ByteArrayInputStream(content), out); final VersionId version = out.getStatus(); assertNotNull(version); assertTrue(new DefaultFindFeature(session).find(test)); final byte[] compare = new byte[content.length]; final InputStream stream = new SDSReadFeature(session).read(test, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(stream, compare); stream.close(); assertArrayEquals(content, compare); new SDSDeleteFeature(session).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
From source file:com.mindquarry.webapp.servlet.ConfigLoaderListener.java
/** * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) */// w ww . ja v a 2 s. c o m public void contextInitialized(ServletContextEvent ctxEvent) { try { // load props file File propFile = new File(System.getProperty(P_CONFIG_FILE, "mindquarry-webapplication.properties")); //$NON-NLS-1$ FileInputStream is = new FileInputStream(propFile); // load props Properties props = new Properties(); props.load(is); // add props to system props Properties sysProps = System.getProperties(); sysProps.putAll(props); System.setProperties(sysProps); } catch (Exception e) { log.error("An error occured while loading system properties.", e); System.exit(-1); } }
From source file:eu.fusepool.tests.BaseTest.java
@BeforeClass public static synchronized void startRunnableJar() throws Exception { if (serverBaseUrl != null) { // concurrent initialization by loading subclasses return;//from ww w. j a v a 2 s.c o m } final String configuredUrl = System.getProperty(TEST_SERVER_URL_PROP); if (configuredUrl != null) { serverBaseUrl = configuredUrl; log.info(TEST_SERVER_URL_PROP + " is set: not starting server jar (" + serverBaseUrl + ")"); } else { final File workingDir = new File(System.getProperty(JarExecutor.PROP_WORKING_DIRECTORY)); if (workingDir.exists()) { delete(workingDir); } final JarExecutor j = JarExecutor.getInstance(System.getProperties()); j.start(); serverBaseUrl = "http://localhost:" + j.getServerPort(); log.info("Forked subprocess server listening to: " + serverBaseUrl); } RestAssured.baseURI = serverBaseUrl; }
From source file:ch.cyberduck.core.openstack.SwiftLargeUploadWriteFeatureTest.java
@Test public void testWriteUploadLargeBuffer() throws Exception { final Host host = new Host(new SwiftProtocol(), "identity.api.rackspacecloud.com", new Credentials(System.getProperties().getProperty("rackspace.key"), System.getProperties().getProperty("rackspace.secret"))); final SwiftSession session = new SwiftSession(host); session.open(new DisabledHostKeyCallback()); session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback()); final SwiftRegionService regionService = new SwiftRegionService(session); final SwiftLargeUploadWriteFeature feature = new SwiftLargeUploadWriteFeature(session, regionService, new SwiftSegmentService(session, ".segments-test/")); final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); container.attributes().setRegion("DFW"); final TransferStatus status = new TransferStatus(); status.setLength(-1L);// ww w .j a v a 2 s . c o m final Path file = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final OutputStream out = feature.write(file, status, new DisabledConnectionCallback()); final byte[] content = RandomUtils.nextBytes(6 * 1024 * 1024); final ByteArrayInputStream in = new ByteArrayInputStream(content); final TransferStatus progress = new TransferStatus(); new StreamCopier(new TransferStatus(), progress).transfer(in, out); assertEquals(content.length, progress.getOffset()); in.close(); out.close(); assertTrue(new SwiftFindFeature(session).find(file)); final byte[] compare = new byte[content.length]; final InputStream stream = new SwiftReadFeature(session, regionService).read(file, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(stream, compare); stream.close(); assertArrayEquals(content, compare); new SwiftDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }