Example usage for org.apache.commons.configuration BaseConfiguration BaseConfiguration

List of usage examples for org.apache.commons.configuration BaseConfiguration BaseConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration BaseConfiguration BaseConfiguration.

Prototype

BaseConfiguration

Source Link

Usage

From source file:graphene.dao.titan.BatchGraphTest.java

public static void main(String[] args) {
    Configuration conf = new BaseConfiguration();
    conf.setProperty("storage.backend", "cassandrathrift");
    conf.setProperty("storage.hostname", "127.0.0.1");
    //conf.setProperty("storage.port", 9160);
    TitanGraph g = TitanFactory.open(conf);
    BatchGraph<TitanGraph> bgraph = new BatchGraph(g, VertexIDType.STRING, 1000);
    // for (String[] quad : quads) {
    // Vertex[] vertices = new Vertex[2];
    // for (int i=0;i<2;i++) {
    // vertices[i] = bgraph.getVertex(quad[i]);
    // if (vertices[i]==null) vertices[i]=bgraph.addVertex(quad[i]);
    // }//from  w  w  w.j a va2 s.co  m
    // Edge edge = bgraph.addEdge(null,vertices[0],vertices[1],quad[2]);
    // edge.setProperty("annotation",quad[3]);
    // }

    for (int k = 0; k < MAXNODES; k++) {
        Vertex[] vertices = new Vertex[2];

        for (int i = 0; i < 2; i++) {
            String id = "Vertex-" + rand.nextInt(MAXNODES);
            vertices[i] = bgraph.getVertex(id);
            if (vertices[i] == null) {
                vertices[i] = bgraph.addVertex(id);
                vertices[i].setProperty("label", id);
            }
        }
        String edgeId = "Edge-" + vertices[0].getId() + "--" + vertices[1].getId();
        Edge e = bgraph.getEdge(edgeId);
        if (e == null) {
            e = bgraph.addEdge(null, vertices[0], vertices[1], edgeId);
            DateTime dt = new DateTime();
            e.setProperty("edgeData", dt.getMillis());
        }
    }
    bgraph.commit();
    Iterator<Vertex> iter = bgraph.getVertices().iterator();
    logger.debug("Start iterating over vertices");
    while (iter.hasNext()) {
        Vertex v = iter.next();
        Iterator<Edge> eIter = v.getEdges(Direction.BOTH).iterator();
        while (eIter.hasNext()) {
            Edge currentEdge = eIter.next();
            String data = currentEdge.getProperty("edgeData");
            logger.debug("Observing edge " + currentEdge.getLabel());
            logger.debug("has edge with data: " + data + " from "
                    + currentEdge.getVertex(Direction.IN).getProperty("label") + " to "
                    + currentEdge.getVertex(Direction.OUT).getProperty("label"));
        }
    }
    logger.debug("Done iterating over vertices");
}

From source file:com.indeed.imhotep.builder.tsv.KerberosUtils.java

/**
 * Use for testing keytab logins//  ww w  .  ja v  a 2 s .co m
 */
public static void main(String[] args) throws Exception {
    KerberosUtils.loginFromKeytab(new BaseConfiguration());
    final FileSystem fileSystem = FileSystem.get(new org.apache.hadoop.conf.Configuration());
    final Path path = new Path("/CLUSTERNAME");
    if (fileSystem.exists(path)) {
        System.out.println(CharStreams.toString(new InputStreamReader(fileSystem.open(path), Charsets.UTF_8)));
    }
}

From source file:com.insilico.titan.Loader.java

public static Configuration initConfig() {
    Configuration conf = new BaseConfiguration();
    conf.setProperty("storage.backend", "hbase");
    conf.setProperty("storage.tablename", "spidral");

    conf.setProperty("storage.index.search.backend", "elasticsearch");
    conf.setProperty("storage.index.search.directory", "/app/elasticsearch");
    conf.setProperty("storage.index.search.client-only", false);
    conf.setProperty("storage.index.search.local-mode", true);

    return conf;// w w  w .  ja v a2 s .  com
}

From source file:com.intel.cosbench.config.common.KVConfigParser.java

public static Config parse(String str) {
    BaseConfiguration config = new BaseConfiguration();
    config.setDelimiterParsingDisabled(true);
    str = StringUtils.trimToEmpty(str);//from w  w  w.j av a  2s  .c  om
    String[] entries = StringUtils.split(str, ';');
    for (String entry : entries) {
        addConfigEntry(entry, config);
    }
    return new COSBConfigApator(config);
}

From source file:io.servicecomb.loadbalance.filter.TestSimpleTransactionControlFilter.java

@BeforeClass
public static void beforeCls() {
    AbstractConfiguration configuration = new BaseConfiguration();
    configuration.addProperty("cse.loadbalance.test.flowsplitFilter.policy",
            "io.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
    configuration.addProperty("cse.loadbalance.test.flowsplitFilter.options.tag0", "value0");
}

From source file:backup.store.BackupUtil.java

public static org.apache.commons.configuration.Configuration convert(Configuration conf) {
    BaseConfiguration baseConfiguration = new BaseConfiguration();
    for (Entry<String, String> e : conf) {
        baseConfiguration.setProperty(e.getKey(), e.getValue());
    }/* w  w w  .  ja  va2 s.  c  o  m*/
    return baseConfiguration;
}

From source file:com.comcast.viper.flume2storm.connection.KryoNetParametersTest.java

@Test
public void testEmpty() throws Exception {
    KryoNetParameters params = KryoNetParameters.from(new BaseConfiguration());
    Assert.assertEquals(KryoNetParameters.CONNECTION_TIMEOUT_DEFAULT, params.getConnectionTimeout());
    Assert.assertEquals(KryoNetParameters.RETRY_SLEEP_DELAY_DEFAULT, params.getRetrySleepDelay());
    Assert.assertEquals(KryoNetParameters.RECONNECTION_DELAY_DEFAULT, params.getReconnectionDelay());
    Assert.assertEquals(KryoNetParameters.TERMINATION_TO_DEFAULT, params.getTerminationTimeout());
}

From source file:com.opentable.config.util.EmptyConfigStrategy.java

@Override
public AbstractConfiguration load(String configName, String configPath) throws ConfigurationException {
    return new BaseConfiguration();
}

From source file:cz.cas.lib.proarc.common.export.Kramerius4ExportOptionsTest.java

@Test
public void testFrom() {
    Configuration config = new BaseConfiguration();
    String[] excludes = { "ID1", "ID2", "ID3" };
    config.addProperty(Kramerius4ExportOptions.PROP_EXCLUDE_DATASTREAM_ID, excludes);

    config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID1", "NEWID1");
    config.addProperty(Kramerius4ExportOptions.PROP_RENAME_PREFIX + ".ID2", "NEWID2");

    String policy = "policy:public";
    config.addProperty(Kramerius4ExportOptions.PROP_POLICY, policy);

    Kramerius4ExportOptions result = Kramerius4ExportOptions.from(config);
    assertEquals(new HashSet<String>(Arrays.asList(excludes)), result.getExcludeDatastreams());
    assertEquals("NEWID1", result.getDsIdMap().get("ID1"));
    assertEquals("NEWID2", result.getDsIdMap().get("ID2"));
    assertEquals(policy, result.getPolicy());
}

From source file:cz.cas.lib.proarc.common.imports.ImportProfileTest.java

@Before
public void setUp() {
    conf = new BaseConfiguration();
}