Example usage for java.util Properties getProperty

List of usage examples for java.util Properties getProperty

Introduction

In this page you can find the example usage for java.util Properties getProperty.

Prototype

public String getProperty(String key) 

Source Link

Document

Searches for the property with the specified key in this property list.

Usage

From source file:org.eclipse.lyo.testsuite.oslcv2.ServiceProviderRdfXmlTests.java

@Parameters
public static Collection<Object[]> getAllDescriptionUrls() throws IOException {
    //Checks the ServiceProviderCatalog at the specified baseUrl of the REST service in order to grab all urls
    //to other ServiceProvidersCatalogs contained within it, recursively, in order to find the URLs of all
    //service description documents of the REST service.
    Properties setupProps = SetupProperties.setup(null);
    Collection<Object[]> coll = getReferencedUrls(setupProps.getProperty("baseUri"));
    return coll;/*from   w w  w.  j  a  v a  2 s .  c  om*/
}

From source file:com.anyi.gp.license.RegisterTools.java

public static List getSystemProperties() {
    List result = new ArrayList();
    Properties props = System.getProperties();
    result.add(props.getProperty("os.name"));
    result.add(props.getProperty("os.arch"));
    result.add(props.getProperty("os.version"));
    return result;
}

From source file:com.redhat.poc.jdg.bankofchina.function.TestCase411RemoteMultiThreads.java

public static String jdgProperty(String name) {
    Properties props = new Properties();
    try {/*  w  w w  .  j a v a 2  s  . c om*/
        props.load(TestCase411RemoteMultiThreads.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE));
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
    return props.getProperty(name);
}

From source file:dpfmanager.shell.core.DPFManagerProperties.java

public static String getVersion() {
    String filename = "version.properties";
    InputStream input = MainGuiApp.class.getClassLoader().getResourceAsStream(filename);

    try {//from   w  w w  .jav  a 2  s. co m
        // load a properties file
        Properties prop = new Properties();
        prop.load(input);
        return prop.getProperty("version");
    } catch (Exception e) {
        return "";
    }
}

From source file:com.magnet.mmx.server.plugin.mmxmgmt.interceptor.MessageDistributorImplTest.java

@BeforeClass
public static void setup() throws Exception {
    InputStream inputStream = DeviceDAOImplTest.class.getResourceAsStream("/test.properties");

    Properties testProperties = new Properties();
    testProperties.load(inputStream);/*from w  w w.  j  av a  2  s .c  o m*/

    String host = testProperties.getProperty("db.host");
    String port = testProperties.getProperty("db.port");
    String user = testProperties.getProperty("db.user");
    String password = testProperties.getProperty("db.password");
    String driver = testProperties.getProperty("db.driver");
    String schema = testProperties.getProperty("db.schema");

    String url = "jdbc:mysql://" + host + ":" + port + "/" + schema;

    ds = new BasicDataSource();
    ds.setDriverClassName(driver);
    ds.setUsername(user);
    ds.setPassword(password);
    ds.setUrl(url);
    //clean any existing records and load some records into the database.
    FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
    builder.setColumnSensing(true);
    Connection setup = ds.getConnection();
    IDatabaseConnection con = new DatabaseConnection(setup);
    {
        InputStream xmlInput = DeviceDAOImplTest.class.getResourceAsStream("/data/app-data-1.xml");
        IDataSet dataSet = builder.build(xmlInput);
        DatabaseOperation.CLEAN_INSERT.execute(con, dataSet);
    }
    {
        InputStream xmlInput = DeviceDAOImplTest.class.getResourceAsStream("/data/device-data-1.xml");
        IDataSet dataSet = builder.build(xmlInput);
        DatabaseOperation.CLEAN_INSERT.execute(con, dataSet);
    }
}

From source file:io.seldon.clustering.recommender.jdo.JdoMemoryUserClusterFactory.java

public static JdoMemoryUserClusterFactory initialise(Properties properties) {
    JdoMemoryUserClusterFactory fact = new JdoMemoryUserClusterFactory();
    fact.clients = properties.getProperty("io.seldon.memoryuserclusters.clients");
    fact.initialise();/*from   ww w .j  a  v a 2  s. co m*/
    return fact;
}

From source file:org.lambdamatic.elasticsearch.BaseIntegrationTest.java

protected static Client client() {
    final InputStream portsStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream("ports.properties");
    if (portsStream != null) {
        final Properties properties = new Properties();
        try {/*from   w  w w  .  java2  s . c  o  m*/
            properties.load(portsStream);
        } catch (IOException e) {
            fail("Failed to load port properties from file", e);
        }
        return Client.connectTo(new HttpHost("localhost", Integer.parseInt(properties.getProperty("es.9200"))));
    }
    return Client.connectTo(new HttpHost("localhost", 9200));
}

From source file:com.redhat.poc.jdg.bankofchina.performance.TestCase52RemoteMultiThreads.java

public static String jdgProperty(String name) {
    Properties props = new Properties();
    try {//from w  w  w  . j  ava2  s  . c om
        props.load(TestCase52RemoteMultiThreads.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE));
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
    return props.getProperty(name);
}

From source file:io.cloudslang.lang.tools.build.ArgumentProcessorUtils.java

/**
 * @param propertyKey  the key inside the properties entries.
 * @param defaultValue the default value of the enum.
 * @param properties   the properties entries.
 * @param <T>          generic type T of the enum.
 * @return get the property or default//from   w w  w . jav  a2s .  c o m
 */
public static <T extends Enum<T>> T getEnumInstanceFromPropertiesWithDefault(String propertyKey, T defaultValue,
        Properties properties) {
    validateArguments(propertyKey, properties);
    try {
        String propertyValue = properties.getProperty(propertyKey);
        if (isNotEmpty(propertyValue)) {
            @SuppressWarnings("unchecked")
            Class<T> defaultValueClass = (Class<T>) defaultValue.getClass();
            return T.valueOf(defaultValueClass, propertyValue.toUpperCase(ENGLISH));
        }
    } catch (IllegalArgumentException ignore) {
    }
    return defaultValue;
}

From source file:com.redhat.poc.jdg.bankofchina.performance.TestCase51RemoteMultiThreads.java

public static String jdgProperty(String name) {
    Properties props = new Properties();
    try {//  w  w w. j  av  a2  s . com
        props.load(TestCase51RemoteMultiThreads.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE));
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
    return props.getProperty(name);
}