Example usage for java.lang System getProperties

List of usage examples for java.lang System getProperties

Introduction

In this page you can find the example usage for java.lang System getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Determines the current system properties.

Usage

From source file:com.orange.spring.cloud.connector.s3.localconfig.LocalConfigConnectorS3ServiceTest.java

@Test
public void serviceCreation() {
    Properties properties = new Properties();
    properties.put("spring.cloud.mys3", getS3ServiceUrl());
    properties.put("spring.cloud.appId", "mysuperapp");
    when(System.getProperties()).thenReturn(properties);
    when(System.getProperty("spring.cloud.appId", null)).thenReturn("mysuperapp");
    assertTrue(this.testCloudConnector.isInMatchingCloud());
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    ServiceInfo serviceInfo = getServiceInfo(serviceInfos, "mys3");
    assertNotNull(serviceInfo);//from  ww w.j  a va 2  s.  c  o  m
    assertTrue(serviceInfo instanceof S3ServiceInfo);
    assertS3ServiceInfo((S3ServiceInfo) serviceInfo, hostname, port);
}

From source file:com.jdom.tvshowdownloader.integration.BlackBoxTest.java

@BeforeClass
public static void staticSetUp() {
    createIntegrationTestPropertiesFile();

    Properties properties = new Properties();
    FileReader fileReader = null;

    try {//from  w  ww.  j a v  a  2  s  .c o m
        fileReader = new FileReader(propertiesFile);
        properties.load(fileReader);
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        Closeables.closeQuietly(fileReader);
    }

    System.getProperties().putAll(properties);
}

From source file:it.damore.tomee.envmonitor.services.EnvMonitorService.java

@GET
@Path("monitor")
@Produces({ MediaType.APPLICATION_JSON })
public EnvironmentConfig getEnvConfig() throws IllegalAccessException, InvocationTargetException {
    logger.info("received a request...");

    int mb = 1024 * 1024;
    //Getting the runtime reference from system
    Runtime runtime = Runtime.getRuntime();

    EnvironmentConfig b = new EnvironmentConfig();
    b.setMaxMemory(runtime.maxMemory() / mb);
    b.setFreeMemory(runtime.freeMemory() / mb);
    b.setTotalMemory(runtime.totalMemory() / mb);
    b.setSystemProperties(System.getProperties());

    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    LocalRuntimeMXBean myRuntimeMXBean = new LocalRuntimeMXBean();
    BeanUtils.copyProperties(myRuntimeMXBean, runtimeMXBean);
    b.setRuntimeMXBean(myRuntimeMXBean);

    MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
    LocalMemoryMXBean myMemoryMXBean = new LocalMemoryMXBean();
    myMemoryMXBean.setHeapMemoryUsage(memoryMXBean.getHeapMemoryUsage());
    myMemoryMXBean.setNonHeapMemoryUsage(memoryMXBean.getNonHeapMemoryUsage());
    myMemoryMXBean.setObjectPendingFinalizationCount(memoryMXBean.getObjectPendingFinalizationCount());
    b.setMemoryMXBean(myMemoryMXBean);/* ww w. j a v  a 2 s . c  o  m*/

    OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
    LocalOperatingSystemMXBean myOperatingSystemMXBean = new LocalOperatingSystemMXBean();
    BeanUtils.copyProperties(myOperatingSystemMXBean, operatingSystemMXBean);
    b.setOperatingSystemMXBean(myOperatingSystemMXBean);

    return b;
}

From source file:ch.cyberduck.core.cryptomator.SFTPDirectoryFeatureTest.java

@Test
public void testMakeDirectoryEncrypted() throws Exception {
    final Host host = new Host(new SFTPProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("sftp.user"),
                    System.getProperties().getProperty("sftp.password")));
    final SFTPSession session = new SFTPSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new SFTPHomeDirectoryService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(/*from  w  w  w.  ja v a 2 s  .c  o m*/
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    new CryptoDirectoryFeature<Void>(session, new SFTPDirectoryFeature(session), new SFTPWriteFeature(session),
            cryptomator).mkdir(test, null, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new SFTPFindFeature(session), cryptomator).find(test));
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    new CryptoDeleteFeature(session, new SFTPDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:com.vmware.bdd.utils.CommonUtil.java

public static String getConfDir() {
    String homeDir = System.getProperties().getProperty("serengeti.home.dir");
    if (StringUtil.isNullOrWhitespace(homeDir)) {
        homeDir = Constants.DEFAULT_SERENGETI_ROOT_DIR;
    }/*from  w  ww  .jav  a2 s.  c  o  m*/
    StringBuilder builder = new StringBuilder();
    builder.append(homeDir).append(File.separator).append("conf");
    return builder.toString();
}

From source file:ch.cyberduck.core.cryptomator.SFTPFindFeatureTest.java

@Test
public void testFindCryptomator() throws Exception {
    final Host host = new Host(new SFTPProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("sftp.user"),
                    System.getProperties().getProperty("sftp.password")));
    final SFTPSession session = new SFTPSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new SFTPHomeDirectoryService(session).find();
    final Path vault = new Path(home, UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(//  w  w w .  j  av a 2s.c  om
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    assertFalse(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator)
            .find(new Path(vault, "a", EnumSet.of(Path.Type.directory))));
    new CryptoTouchFeature<Void>(session,
            new DefaultTouchFeature<Void>(new DefaultUploadFeature<Void>(new SFTPWriteFeature(session))),
            new SFTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    new CryptoDeleteFeature(session, new SFTPDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:ch.cyberduck.core.cryptomator.FTPTouchFeatureTest.java

@Test
public void testTouchLongFilenameEncrypted() throws Exception {
    final Host host = new Host(new FTPTLSProtocol(), "test.cyberduck.ch",
            new Credentials(System.getProperties().getProperty("ftp.user"),
                    System.getProperties().getProperty("ftp.password")));
    final FTPSession session = new FTPSession(host);
    session.open(new DisabledHostKeyCallback());
    session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
    final Path home = new DefaultHomeFinderService(session).find();
    final Path vault = new Path(home, new AlphanumericRandomStringService().random(),
            EnumSet.of(Path.Type.directory));
    final Path test = new Path(vault, new RandomStringGenerator.Builder().build().generate(130),
            EnumSet.of(Path.Type.file));
    final CryptoVault cryptomator = new CryptoVault(vault, new DisabledPasswordStore());
    cryptomator.create(session, null, new VaultCredentials("test"));
    session.withRegistry(/*from  w w w . ja v  a2  s. c  om*/
            new DefaultVaultRegistry(new DisabledPasswordStore(), new DisabledPasswordCallback(), cryptomator));
    new CryptoTouchFeature<Integer>(session,
            new DefaultTouchFeature<Integer>(new DefaultUploadFeature<Integer>(new FTPWriteFeature(session))),
            new FTPWriteFeature(session), cryptomator).touch(test, new TransferStatus());
    assertTrue(new CryptoFindFeature(session, new DefaultFindFeature(session), cryptomator).find(test));
    new CryptoDeleteFeature(session, new FTPDeleteFeature(session), cryptomator)
            .delete(Arrays.asList(test, vault), new DisabledLoginCallback(), new Delete.DisabledCallback());
    session.close();
}

From source file:com.adaptris.core.management.jetty.FromXmlConfig.java

private Map<String, String> mergeWithSystemProperties() {
    Map<String, String> result = PropertyHelper
            .asMap(PropertyHelper.getPropertySubset(System.getProperties(), JETTY_PREFIX));
    result.putAll(PropertyHelper.asMap(PropertyHelper.getPropertySubset(initialProperties, JETTY_PREFIX)));
    log.trace("Additional properties for XML Config {}", result);
    return result;
}

From source file:cytoscape.render.immed.GraphGraphicsTest.java

public GraphGraphicsTest() {
    super();/*  w ww.  ja  v  a2  s  . c om*/
    String prop = System.getProperties().getProperty("num.graph.objects", "5000");
    int numGraphObjs = 5000;
    if (prop.matches("^\\d+$"))
        numGraphObjs = Integer.parseInt(prop);

    numNodes = numGraphObjs;
    numEdges = numGraphObjs;
}

From source file:eagle.dataproc.util.TestConfigOptionParser.java

@Test
public void testValidCommandArgumentsAsSystem() throws ParseException {
    String[] arguments = new String[] { "-D", "key1=value1", "-D", "key2=value2", "-D", "key3=value3=something",
            "-D", "key4=", };

    new ConfigOptionParser().load(arguments);

    Assert.assertTrue(System.getProperties().containsKey("key1"));
    Assert.assertTrue(System.getProperties().containsKey("key2"));
    Assert.assertTrue(System.getProperties().containsKey("key3"));
    Assert.assertTrue(System.getProperties().containsKey("key4"));

    Assert.assertEquals("value1", System.getProperty("key1"));
    Assert.assertEquals("value2", System.getProperty("key2"));
    Assert.assertEquals("value3=something", System.getProperty("key3"));
    Assert.assertEquals("", System.getProperty("key4"));
}