Java 类org.apache.commons.configuration.MapConfiguration 实例源码

项目:jbake-rtl-jalaali    文件:CrawlerTest.java   
@Test
public void renderWithPrettyUrls() throws Exception {
    Map<String, Object> testProperties = new HashMap<String, Object>();
    testProperties.put(Keys.URI_NO_EXTENSION, true);
    testProperties.put(Keys.URI_NO_EXTENSION_PREFIX, "/blog");

    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new MapConfiguration(testProperties));
    config.addConfiguration(ConfigUtil.load(new File(this.getClass().getResource("/").getFile())));

    Crawler crawler = new Crawler(db, sourceFolder, config);
    crawler.crawl(new File(sourceFolder.getPath() + File.separator + config.getString(Keys.CONTENT_FOLDER)));

    Assert.assertEquals(4, db.getDocumentCount("post"));
    Assert.assertEquals(3, db.getDocumentCount("page"));

    DocumentList documents = db.getPublishedPosts();

    for (Map<String, Object> model : documents) {
        String noExtensionUri = "blog/\\d{4}/" + FilenameUtils.getBaseName((String) model.get("file")) + "/";

        Assert.assertThat(model.get("noExtensionUri"), RegexMatcher.matches(noExtensionUri));
        Assert.assertThat(model.get("uri"), RegexMatcher.matches(noExtensionUri + "index\\.html"));
    }
}
项目:tinkergraph-gremlin    文件:HaltedTraverserStrategyTest.java   
@Test
public void shouldReturnDetachedElements() {
    final Graph graph = TinkerFactory.createModern();
    final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(HaltedTraverserStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put(HaltedTraverserStrategy.HALTED_TRAVERSER_FACTORY, DetachedFactory.class.getCanonicalName());
    }})));
    g.V().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().properties("name").forEachRemaining(vertexProperty -> assertEquals(DetachedVertexProperty.class, vertexProperty.getClass()));
    g.V().out().values("name").forEachRemaining(value -> assertEquals(String.class, value.getClass()));
    g.V().out().outE().forEachRemaining(edge -> assertEquals(DetachedEdge.class, edge.getClass()));
    g.V().out().outE().properties("weight").forEachRemaining(property -> assertEquals(DetachedProperty.class, property.getClass()));
    g.V().out().outE().values("weight").forEachRemaining(value -> assertEquals(Double.class, value.getClass()));
    g.V().out().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().out().path().forEachRemaining(path -> assertEquals(DetachedPath.class, path.getClass()));
    g.V().out().pageRank().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().pageRank().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    // should handle nested collections
    g.V().out().fold().next().forEach(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
}
项目:jbake-maven-plugin    文件:BuildMojo.java   
protected CompositeConfiguration createConfiguration() throws ConfigurationException {
    final CompositeConfiguration config = new CompositeConfiguration();

    if (properties != null) {
        config.addConfiguration(new MapConfiguration(properties));
    }
    config.addConfiguration(new MapConfiguration(project.getProperties()));
    config.addConfiguration(ConfigUtil.load(inputDirectory));

    if (getLog().isDebugEnabled()) {
        getLog().debug("Configuration:");

        Iterator<String> iter = config.getKeys();
        while (iter.hasNext()) {
            String key = iter.next();
            getLog().debug(key + ": " + config.getString(key));
        }
    }

    return config;
}
项目:oiosaml.java    文件:AuthzFilterTest.java   
@Before
public void setUp() throws IOException, ServletException {
    req = context.mock(HttpServletRequest.class);
    res = context.mock(HttpServletResponse.class);
    chain = context.mock(FilterChain.class);
    context.checking(new Expectations() {{
        allowing(req).getServletPath(); will(returnValue("/servlet"));
    }});

    filter = new AuthzFilter();

    props.put(SAMLUtil.OIOSAML_HOME, System.getProperty("java.io.tmpdir"));
    SAMLConfiguration.setSystemConfiguration(new MapConfiguration(props));

    configFile = generateConfigFile();

    props.put(Constants.PROP_PROTECTION_CONFIG_FILE, configFile);
    filter.init(null);
}
项目:oiosaml.java    文件:AbstractTests.java   
@Before
public final void onSetUp() throws Exception {
    req = mock(HttpServletRequest.class);
    res = mock(HttpServletResponse.class);
    when(res.getOutputStream()).thenReturn(new ServletOutputStream() {
        public void write(int b) throws IOException {}
    });

    session = mock(HttpSession.class);
    when(req.getSession()).thenReturn(session);
    when(session.getId()).thenReturn(UUID.randomUUID().toString());

    EntityDescriptor desc = (EntityDescriptor) SAMLUtil.unmarshallElement(getClass().getResourceAsStream("SPMetadata.xml"));

    sh = mock(SessionHandler.class);

    CredentialRepository rep = new CredentialRepository();
    BasicX509Credential credential = rep.getCredential("test/test.pkcs12", "Test1234");

    cfg = new MapConfiguration(new HashMap<String, Object>() {{
        put("oiosaml-sp.assertion.validator", Validator.class.getName());
        put(Constants.PROP_HOME, "/home");
    }});
    IdpMetadata idp = new IdpMetadata("http://schemas.xmlsoap.org/ws/2006/12/federation", (EntityDescriptor)SAMLUtil.unmarshallElement(getClass().getResourceAsStream("IdPMetadata.xml")));
    rc = new RequestContext(req, res, idp, new SPMetadata(desc, "http://schemas.xmlsoap.org/ws/2006/12/federation"), credential, cfg, sh, null);
}
项目:Pinot    文件:MetricsHelperTest.java   
@Test
public void testMetricsHelperRegistration() {
  listenerOneOkay = false;
  listenerTwoOkay = false;

  Map<String, String> configKeys = new HashMap<String, String>();
  configKeys.put("pinot.broker.metrics.metricsRegistryRegistrationListeners",
      ListenerOne.class.getName() + "," + ListenerTwo.class.getName());
  Configuration configuration = new MapConfiguration(configKeys);

  MetricsRegistry registry = new MetricsRegistry();

  // Initialize the MetricsHelper and create a new timer
  MetricsHelper.initializeMetrics(configuration.subset("pinot.broker.metrics"));
  MetricsHelper.registerMetricsRegistry(registry);
  MetricsHelper.newTimer(registry, new MetricName(MetricsHelperTest.class, "dummy"), TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);

  // Check that the two listeners fired
  assertTrue(listenerOneOkay);
  assertTrue(listenerTwoOkay);
}
项目:tinkerpop    文件:VertexProgramStrategy.java   
@Override
public Configuration getConfiguration() {
    final Map<String, Object> map = new HashMap<>();
    map.put(GRAPH_COMPUTER, this.computer.getGraphComputerClass().getCanonicalName());
    if (-1 != this.computer.getWorkers())
        map.put(WORKERS, this.computer.getWorkers());
    if (null != this.computer.getPersist())
        map.put(PERSIST, this.computer.getPersist().name());
    if (null != this.computer.getResultGraph())
        map.put(RESULT, this.computer.getResultGraph().name());
    if (null != this.computer.getVertices())
        map.put(VERTICES, this.computer.getVertices());
    if (null != this.computer.getEdges())
        map.put(EDGES, this.computer.getEdges());
    map.putAll(this.computer.getConfiguration());
    return new MapConfiguration(map);
}
项目:tinkerpop    文件:GraphTraversalSourceTest.java   
@Test
public void shouldSupportMapBasedStrategies() throws Exception {
    GraphTraversalSource g = EmptyGraph.instance().traversal();
    assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put("vertices", __.hasLabel("person"));
        put("vertexProperties", __.limit(0));
        put("edges", __.hasLabel("knows"));
    }})));
    assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    g = g.withoutStrategies(SubgraphStrategy.class);
    assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
    //
    assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
    g = g.withStrategies(ReadOnlyStrategy.instance());
    assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
    g = g.withoutStrategies(ReadOnlyStrategy.class);
    assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
}
项目:tinkerpop    文件:HaltedTraverserStrategyTest.java   
@Test
public void shouldReturnDetachedElements() {
    final Graph graph = TinkerFactory.createModern();
    final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(HaltedTraverserStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put(HaltedTraverserStrategy.HALTED_TRAVERSER_FACTORY, DetachedFactory.class.getCanonicalName());
    }})));
    g.V().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().properties("name").forEachRemaining(vertexProperty -> assertEquals(DetachedVertexProperty.class, vertexProperty.getClass()));
    g.V().out().values("name").forEachRemaining(value -> assertEquals(String.class, value.getClass()));
    g.V().out().outE().forEachRemaining(edge -> assertEquals(DetachedEdge.class, edge.getClass()));
    g.V().out().outE().properties("weight").forEachRemaining(property -> assertEquals(DetachedProperty.class, property.getClass()));
    g.V().out().outE().values("weight").forEachRemaining(value -> assertEquals(Double.class, value.getClass()));
    g.V().out().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().out().path().forEachRemaining(path -> assertEquals(DetachedPath.class, path.getClass()));
    g.V().out().pageRank().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    g.V().out().pageRank().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
    // should handle nested collections
    g.V().out().fold().next().forEach(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
}
项目:fos-weka    文件:WekaModelConfig.java   
private void parseModelConfig() throws FOSException {
    configuration = new MapConfiguration((Map) modelConfig.getProperties());
    classIndex = this.modelConfig.getIntProperty(CLASS_INDEX, -1);
    if (classIndex < 0) {
        classIndex = this.modelConfig.getAttributes().size() - 1;
    }

    String modelFile = configuration.getString(MODEL_FILE);
    if (modelFile != null) {
        this.model = new File(modelFile);
    }

    String formatValue = configuration.getString(CLASSIFIER_FORMAT);
    if (formatValue != null) {
        ModelDescriptor.Format format = ModelDescriptor.Format.valueOf(formatValue);
        this.modelDescriptor = new ModelDescriptor(format, modelFile);
    }

    classifierThreadSafe = configuration.getBoolean(IS_CLASSIFIER_THREAD_SAFE, false /* defaults to Pool implementation*/);

    String uuid = configuration.getString(ID);
    if (uuid != null) {
        this.id = UUID.fromString(uuid);
    }
}
项目:juddi    文件:InstallTest.java   
/**
 * Test of applyReplicationTokenChanges method, of class Install.
 */
@Test
public void testApplyReplicationTokenChanges() throws Exception {
        System.out.println("applyReplicationTokenChanges");
        InputStream fis = getClass().getClassLoader().getResourceAsStream("juddi_install_data/root_replicationConfiguration.xml");

        ReplicationConfiguration replicationCfg = (ReplicationConfiguration) XmlUtils.unmarshal(fis, ReplicationConfiguration.class);
        Properties props = new Properties();
        props.put(Property.JUDDI_NODE_ID, "uddi:a_custom_node");
        props.put(Property.JUDDI_BASE_URL, "http://juddi.apache.org");
        props.put(Property.JUDDI_BASE_URL_SECURE, "https://juddi.apache.org");

        Configuration config = new MapConfiguration(props);
        String thisnode = "uddi:a_custom_node";

        ReplicationConfiguration result = Install.applyReplicationTokenChanges(replicationCfg, config, thisnode);
        StringWriter sw = new StringWriter();
        JAXB.marshal(result, sw);
        Assert.assertFalse(sw.toString().contains("${juddi.nodeId}"));
        Assert.assertFalse(sw.toString().contains("${juddi.server.baseurlsecure}"));
        Assert.assertFalse(sw.toString().contains("${juddi.server.baseurl}"));

}
项目:chassis    文件:ZookeeperConfigurationWriterTest.java   
@Test
 public void basePathExists_noOverwrite() throws Exception {
     Assert.assertNull(curatorFramework.checkExists().forPath(base));

     try (CuratorFramework zkCurator = createCuratorFramework()) {
      ZookeeperConfigurationWriter writer = new ZookeeperConfigurationWriter(applicationName, environmentName, version, zkCurator, false);
writer.write(new MapConfiguration(props), new DefaultPropertyFilter());

      Assert.assertEquals(val1, new String(curatorFramework.getData().forPath(base + "/" + key1)));
      Assert.assertEquals(val2, new String(curatorFramework.getData().forPath(base + "/" + key2)));

      try {
          writer.write(new MapConfiguration(props), new DefaultPropertyFilter());
          Assert.fail();
      } catch (BootstrapException e) {
          //expected
      }
     }
 }
项目:chassis    文件:DynamicZookeeperConfigurationSourceTest.java   
@Before
public void beforeClass() throws Exception {
    zookeeper = new TestingServer(SocketUtils.findAvailableTcpPort());
    curatorFramework = CuratorFrameworkFactory.newClient(zookeeper.getConnectString(), new RetryOneTime(1000));
    curatorFramework.start();

    curatorFramework.create().forPath(CONFIG_BASE_PATH);

    Map<String, Object> defaults = new HashMap<>();
    defaults.put(DEF_KEY1, DEF_VAL1);
    defaults.put(DEF_KEY2, DEF_VAL2);

    defaultConfiguration = new MapConfiguration(defaults);

    node = UUID.randomUUID().toString();
    config = new ConcurrentCompositeConfiguration();
}
项目:stickypunch    文件:ModuleFunctionalTest.java   
@BeforeClass
public static void setUp() throws Exception {
    org.apache.log4j.BasicConfigurator.configure();
    LogManager.getRootLogger().setLevel(Level.INFO);
    HttpConfiguration httpConfiguration = new HttpConfiguration(new MapConfiguration(ImmutableMap.<String, Object>of(
            HttpConfiguration.LISTEN_ADDRESS_PROP, HOST,
            HttpConfiguration.LISTEN_PORT_PROP, Integer.toString(PORT)
    )));
    SQLiteWebPushStore sqLiteWebPushStore = SQLiteWebPushStoreFactory.create(new WebPushStoreConfiguration(new BaseConfiguration()));
    sqLiteWebPushStore.createWebPushUserTable();
    WebPushUserIdAuth webPushUserIdAuth = new WebPushUserIdAuth(sqLiteWebPushStore,httpConfiguration);
    PackageSigner packageSigner = new PackageSigner() {
        @Override
        public byte[] sign(byte[] data) throws Exception {
            return new byte[0];
        }
    };
    HashMap<String, String> hashProps = Maps.newHashMap();
    hashProps.put(PackageZipConfiguration.PUSH_PACKAGE_FILES, "pushpackage.raw");
    PackageZipBuilder packageZipBuilder = new PackageZipBuilder(new PackageZipConfiguration(new MapConfiguration(hashProps)), packageSigner);
    PackageZipCreator packageZipCreator = new PackageZipCreator(packageZipBuilder);
    Server server = HttpServiceFactory.create(sqLiteWebPushStore, webPushUserIdAuth, packageZipCreator, mock(ApnsPushManager.class), httpConfiguration);
    server.start();
    client = HttpClients.createDefault();
}
项目:jersey2-toolkit    文件:Jersey2ToolkitConfig.java   
/**
 * Builds the configuration object for our toolkit config.
 *
 * @return A Configuration object.
 */
private Configuration buildToolkitConfig() {

    // The toolkit configuration file.
    try {
        File configFile = ResourceUtil
                .getFileForResource("jersey2-toolkit.properties");
        return new PropertiesConfiguration(configFile);
    } catch (ConfigurationException ce) {
        logger.error("jersey2-toolkit.properties not readable,"
                + " some features may be misconfigured.");

        // Return a new, empty map configuration so we don't error out.
        return new MapConfiguration(new HashMap<String, String>());
    }
}
项目:cattle    文件:NamedPropertiesConfigurationTest.java   
@Test
public void testList() {
    Properties props = new Properties();
    props.setProperty("a", "${b.1},${d}");
    props.setProperty("b.1", "4,5,6,${c}");
    props.setProperty("c", "1,2,3");
    props.setProperty("d", "7,8,9");

    MapConfiguration mapConfig = new MapConfiguration(props);
    mapConfig.setDelimiterParsingDisabled(true);

    ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
    config.addConfiguration(mapConfig);
    config.addConfiguration(new MapConfiguration(new Properties()));

    assertEquals("4,5,6,1,2,3,7,8,9", config.getString("a"));

    ConfigurationBackedDynamicPropertySupportImpl impl = new ConfigurationBackedDynamicPropertySupportImpl(config);

    assertEquals("4,5,6,1,2,3,7,8,9", impl.getString("a"));
}
项目:cloud-cattle    文件:NamedPropertiesConfigurationTest.java   
@Test
public void testList() {
    Properties props = new Properties();
    props.setProperty("a", "${b.1},${d}");
    props.setProperty("b.1", "4,5,6,${c}");
    props.setProperty("c", "1,2,3");
    props.setProperty("d", "7,8,9");

    MapConfiguration mapConfig = new MapConfiguration(props);
    mapConfig.setDelimiterParsingDisabled(true);

    ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
    config.addConfiguration(mapConfig);
    config.addConfiguration(new MapConfiguration(new Properties()));

    assertEquals("4,5,6,1,2,3,7,8,9", config.getString("a"));

    ConfigurationBackedDynamicPropertySupportImpl impl = new ConfigurationBackedDynamicPropertySupportImpl(config);

    assertEquals("4,5,6,1,2,3,7,8,9", impl.getString("a"));
}
项目:marmotta    文件:HBaseLoaderBackend.java   
/**
 * Create the RDFHandler to be used for bulk-loading, optionally using the configuration passed as argument.
 *
 * @param configuration
 * @return a newly created RDFHandler instance
 */
@Override
public LoaderHandler createLoader(Configuration configuration) {

    Configuration titanCfg = new MapConfiguration(new HashMap<String,Object>());
    titanCfg.setProperty("storage.backend", "hbase");
    //titanCfg.setProperty("storage.batch-loading", true);

    if(configuration.containsKey("backend.hbase.host")) {
        titanCfg.setProperty("storage.hostname", configuration.getString("backend.hbase.host"));
    }
    if(configuration.containsKey("backend.hbase.port")) {
        titanCfg.setProperty("storage.port", configuration.getInt("backend.hbase.port"));
    }
    if(configuration.containsKey("backend.hbase.table")) {
        titanCfg.setProperty("storage.tablename", configuration.getString("backend.hbase.table"));
    }

    titanCfg.setProperty("ids.block-size", configuration.getInt("backend.hbase.id-block-size", 500000));

    titanCfg.setProperty("storage.buffer-size", 100000);

    return new TitanLoaderHandler(titanCfg);
}
项目:marmotta    文件:BerkeleyDBLoaderBackend.java   
/**
 * Create the RDFHandler to be used for bulk-loading, optionally using the configuration passed as argument.
 *
 * @param configuration
 * @return a newly created RDFHandler instance
 */
@Override
public LoaderHandler createLoader(Configuration configuration) {

    Configuration titanCfg = new MapConfiguration(new HashMap<String,Object>());
    titanCfg.setProperty("storage.backend", "berkeleyje");
    //titanCfg.setProperty("storage.batch-loading", true);

    if(configuration.containsKey("backend.berkeley.storage-directory")) {
        titanCfg.setProperty("storage.directory", configuration.getString("backend.berkeley.storage-directory"));
    }

    titanCfg.setProperty("storage.buffer-size", 100000);

    return new TitanLoaderHandler(titanCfg);
}
项目:cm_ext    文件:AbstractCodahaleFixtureGenerator.java   
public AbstractCodahaleFixtureGenerator(String[] args,
                                        Options options) throws Exception {
  Preconditions.checkNotNull(args);
  Preconditions.checkNotNull(options);

  CommandLineParser parser = new DefaultParser();
  try {
    CommandLine cmdLine = parser.parse(options, args);
    if (!cmdLine.getArgList().isEmpty()) {
      throw new ParseException("Unexpected extra arguments: " +
                               cmdLine.getArgList());
    }
    config = new MapConfiguration(Maps.<String, Object>newHashMap());
    for (Option option : cmdLine.getOptions()) {
      config.addProperty(option.getLongOpt(), option.getValue());
    }
  } catch (ParseException ex) {
    IOUtils.write("Error: " + ex.getMessage() + "\n", System.err);
    printUsageMessage(System.err, options);
    throw ex;
  }
}
项目:pinot    文件:MetricsHelperTest.java   
@Test
public void testMetricsHelperRegistration() {
  listenerOneOkay = false;
  listenerTwoOkay = false;

  Map<String, String> configKeys = new HashMap<String, String>();
  configKeys.put("pinot.broker.metrics.metricsRegistryRegistrationListeners",
      ListenerOne.class.getName() + "," + ListenerTwo.class.getName());
  Configuration configuration = new MapConfiguration(configKeys);

  MetricsRegistry registry = new MetricsRegistry();

  // Initialize the MetricsHelper and create a new timer
  MetricsHelper.initializeMetrics(configuration.subset("pinot.broker.metrics"));
  MetricsHelper.registerMetricsRegistry(registry);
  MetricsHelper.newTimer(registry, new MetricName(MetricsHelperTest.class, "dummy"), TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);

  // Check that the two listeners fired
  assertTrue(listenerOneOkay);
  assertTrue(listenerTwoOkay);
}
项目:pinot    文件:DetectionOnboardResource.java   
public static Configuration toSystemConfiguration(ThirdEyeAnomalyConfiguration thirdeyeConfigs) {
  Preconditions.checkNotNull(thirdeyeConfigs);
  SmtpConfiguration smtpConfiguration = thirdeyeConfigs.getSmtpConfiguration();
  Preconditions.checkNotNull(smtpConfiguration);

  Map<String, String> systemConfig = new HashMap<>();
  systemConfig.put(DefaultDetectionOnboardJob.FUNCTION_FACTORY_CONFIG_PATH, thirdeyeConfigs.getFunctionConfigPath());
  systemConfig.put(DefaultDetectionOnboardJob.ALERT_FILTER_FACTORY_CONFIG_PATH, thirdeyeConfigs.getAlertFilterConfigPath());
  systemConfig.put(DefaultDetectionOnboardJob.ALERT_FILTER_AUTOTUNE_FACTORY_CONFIG_PATH, thirdeyeConfigs.getFilterAutotuneConfigPath());
  systemConfig.put(DefaultDetectionOnboardJob.SMTP_HOST, smtpConfiguration.getSmtpHost());
  systemConfig.put(DefaultDetectionOnboardJob.SMTP_PORT, Integer.toString(smtpConfiguration.getSmtpPort()));
  systemConfig.put(DefaultDetectionOnboardJob.THIRDEYE_DASHBOARD_HOST, thirdeyeConfigs.getDashboardHost());
  systemConfig.put(DefaultDetectionOnboardJob.PHANTON_JS_PATH, thirdeyeConfigs.getPhantomJsPath());
  systemConfig.put(DefaultDetectionOnboardJob.ROOT_DIR, thirdeyeConfigs.getRootDir());
  systemConfig.put(DefaultDetectionOnboardJob.DEFAULT_ALERT_SENDER_ADDRESS, thirdeyeConfigs.getFailureFromAddress());
  systemConfig.put(DefaultDetectionOnboardJob.DEFAULT_ALERT_RECEIVER_ADDRESS, thirdeyeConfigs.getFailureToAddress());

  return new MapConfiguration(systemConfig);
}
项目:overlord-commons    文件:JndiConfigurator.java   
/**
 * @see org.overlord.commons.config.configurator.Configurator#provideConfiguration(java.lang.String, java.lang.Long)
 */
@Override
public Configuration provideConfiguration(String configName, Long refreshDelay)
        throws ConfigurationException {
    if (configName.endsWith(".properties")) { //$NON-NLS-1$
        configName = configName.substring(0, configName.lastIndexOf(".properties")); //$NON-NLS-1$
    }

    try {
        Context ctx = new InitialContext();
        @SuppressWarnings("unchecked")
        Map<String, String> properties = (Map<String, String>) ctx.lookup("java:/global/overlord-config/" + configName); //$NON-NLS-1$
        return new MapConfiguration(properties);
    } catch (Exception e) {
        return null;
    }
}
项目:j1st-mqtt    文件:RedisSyncSingleStorageTest.java   
@BeforeClass
public static void init() throws ConfigurationException {
    Map<String, Object> map = new HashMap<>();
    map.put("redis.type", "single");
    map.put("redis.address", "localhost");
    map.put("mqtt.inflight.queue.size", 3);
    map.put("mqtt.qos2.queue.size", 3);
    map.put("mqtt.retain.queue.size", 3);
    MapConfiguration config = new MapConfiguration(map);

    redis = new RedisSyncSingleStorage();
    redis.init(config);
}
项目:j1st-mqtt    文件:ValidatorTest.java   
@BeforeClass
public static void init() {
    validator = new Validator(new MapConfiguration(new HashMap<>()));
    validator.clientIdPattern = Pattern.compile("^[ -~]+$");
    validator.topicNamePattern = Pattern.compile("^[\\w_ /]*$");
    validator.topicFilterPattern = Pattern.compile("^[\\w_ +#/]*$");
}
项目:tinkergraph-gremlin    文件:TinkerGraphComputerProvider.java   
@Override
public GraphTraversalSource traversal(final Graph graph) {
    return graph.traversal().withStrategies(VertexProgramStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put(VertexProgramStrategy.WORKERS, RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1);
        put(VertexProgramStrategy.GRAPH_COMPUTER, RANDOM.nextBoolean() ?
                GraphComputer.class.getCanonicalName() :
                TinkerGraphComputer.class.getCanonicalName());
    }})));
}
项目:qaf    文件:PropertyUtil.java   
public void addAll(Map<String, ?> props) {
    boolean b = props.keySet().removeAll(System.getProperties().keySet());
    if(b){
        logger.debug("Found one or more system properties which will not modified");
    }
    copy(new MapConfiguration(props));
}
项目:LiteGraph    文件:ProgramVertexProgramStep.java   
public ProgramVertexProgramStep(final Traversal.Admin traversal, final VertexProgram vertexProgram) {
    super(traversal);
    this.configuration = new HashMap<>();
    final MapConfiguration base = new MapConfiguration(this.configuration);
    base.setDelimiterParsingDisabled(true);
    vertexProgram.storeState(base);
    this.toStringOfVertexProgram = vertexProgram.toString();
}
项目:LiteGraph    文件:ProgramVertexProgramStep.java   
@Override
public VertexProgram generateProgram(final Graph graph, final Memory memory) {
    final MapConfiguration base = new MapConfiguration(this.configuration);
    base.setDelimiterParsingDisabled(true);
    PureTraversal.storeState(base, ROOT_TRAVERSAL, TraversalHelper.getRootTraversal(this.getTraversal()).clone());
    base.setProperty(STEP_ID, this.getId());
    if (memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS))
        TraversalVertexProgram.storeHaltedTraversers(base, memory.get(TraversalVertexProgram.HALTED_TRAVERSERS));
    return VertexProgram.createVertexProgram(graph, base);
}
项目:mithqtt    文件:RedisSyncSingleStorageImplTest.java   
@BeforeClass
public static void init() throws ConfigurationException {
    Map<String, Object> map = new HashMap<>();
    map.put("redis.type", "single");
    map.put("redis.address", "localhost");
    map.put("mqtt.inflight.queue.size", 3);
    map.put("mqtt.qos2.queue.size", 3);
    map.put("mqtt.retain.queue.size", 3);
    MapConfiguration config = new MapConfiguration(map);

    redis = new RedisSyncSingleStorageImpl();
    redis.init(config);
}
项目:mithqtt    文件:ValidatorTest.java   
@BeforeClass
public static void init() {
    validator = new Validator(new MapConfiguration(new HashMap<>()));
    validator.clientIdPattern = Pattern.compile("^[ -~]+$");
    validator.topicNamePattern = Pattern.compile("^[\\w_ /]*$");
    validator.topicFilterPattern = Pattern.compile("^[\\w_ +#/]*$");
}
项目:tinkerpop    文件:PartitionStrategy.java   
@Override
public Configuration getConfiguration() {
    final Map<String, Object> map = new HashMap<>();
    map.put(STRATEGY, PartitionStrategy.class.getCanonicalName());
    map.put(INCLUDE_META_PROPERTIES, this.includeMetaProperties);
    if (null != this.writePartition)
        map.put(WRITE_PARTITION, this.writePartition);
    if (null != this.readPartitions)
        map.put(READ_PARTITIONS, this.readPartitions);
    if (null != this.partitionKey)
        map.put(PARTITION_KEY, this.partitionKey);
    return new MapConfiguration(map);
}
项目:tinkerpop    文件:ElementIdStrategy.java   
@Override
public Configuration getConfiguration() {
    final Map<String, Object> map = new HashMap<>();
    map.put(STRATEGY, ElementIdStrategy.class.getCanonicalName());
    map.put(ID_PROPERTY_KEY, this.idPropertyKey);
    map.put(ID_MAKER, this.idMaker);
    return new MapConfiguration(map);
}
项目:tinkerpop    文件:HaltedTraverserStrategy.java   
@Override
public Configuration getConfiguration() {
    final Map<String, Object> map = new HashMap<>();
    map.put(STRATEGY, HaltedTraverserStrategy.class.getCanonicalName());
    map.put(HALTED_TRAVERSER_FACTORY, this.haltedTraverserFactory.getCanonicalName());
    return new MapConfiguration(map);
}
项目:tinkerpop    文件:SubgraphStrategy.java   
@Override
public Configuration getConfiguration() {
    final Map<String, Object> map = new HashMap<>();
    if (null != this.vertexCriterion)
        map.put(VERTICES, this.vertexCriterion);
    if (null != this.edgeCriterion)
        map.put(EDGES, this.edgeCriterion);
    if (null != this.vertexPropertyCriterion)
        map.put(VERTEX_PROPERTIES, this.vertexPropertyCriterion);
    return new MapConfiguration(map);
}
项目:tinkerpop    文件:ProgramVertexProgramStep.java   
public ProgramVertexProgramStep(final Traversal.Admin traversal, final VertexProgram vertexProgram) {
    super(traversal);
    this.configuration = new HashMap<>();
    final MapConfiguration base = new MapConfiguration(this.configuration);
    base.setDelimiterParsingDisabled(true);
    vertexProgram.storeState(base);
    this.toStringOfVertexProgram = vertexProgram.toString();
    this.traverserRequirements = vertexProgram.getTraverserRequirements();
}
项目:tinkerpop    文件:ProgramVertexProgramStep.java   
@Override
public VertexProgram generateProgram(final Graph graph, final Memory memory) {
    final MapConfiguration base = new MapConfiguration(this.configuration);
    base.setDelimiterParsingDisabled(true);
    PureTraversal.storeState(base, ROOT_TRAVERSAL, TraversalHelper.getRootTraversal(this.getTraversal()).clone());
    base.setProperty(STEP_ID, this.getId());
    if (memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS))
        TraversalVertexProgram.storeHaltedTraversers(base, memory.get(TraversalVertexProgram.HALTED_TRAVERSERS));
    return VertexProgram.createVertexProgram(graph, base);
}
项目:tinkerpop    文件:TinkerGraphComputerProvider.java   
@Override
public GraphTraversalSource traversal(final Graph graph) {
    return graph.traversal().withStrategies(VertexProgramStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
        put(VertexProgramStrategy.WORKERS, RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1);
        put(VertexProgramStrategy.GRAPH_COMPUTER, RANDOM.nextBoolean() ?
                GraphComputer.class.getCanonicalName() :
                TinkerGraphComputer.class.getCanonicalName());
    }})));
}
项目:flume2storm    文件:StormSinkConfiguration.java   
/**
 * Copy constructor
 * 
 * @param other
 *          the configuration to copy
 */
public StormSinkConfiguration(final StormSinkConfiguration other) {
  batchSize = other.batchSize;
  locationServiceFactoryClassName = other.locationServiceFactoryClassName;
  serviceProviderSerializationClassName = other.serviceProviderSerializationClassName;
  connectionParametersFactoryClassName = other.connectionParametersFactoryClassName;
  eventSenderFactoryClassName = other.eventSenderFactoryClassName;
  configuration = new MapConfiguration(ConfigurationConverter.getMap(other.configuration));
}
项目:flume2storm    文件:StormSinkTest.java   
@BeforeClass
public static void configure() {
  // Storm sink configuration
  stormSinkConfig = new MapConfiguration(new HashMap<String, Object>());
  stormSinkConfig.addProperty(StormSinkConfiguration.LOCATION_SERVICE_FACTORY_CLASS,
      SimpleLocationServiceFactory.class.getName());
  stormSinkConfig.addProperty(StormSinkConfiguration.SERVICE_PROVIDER_SERIALIZATION_CLASS,
      SimpleServiceProviderSerialization.class.getName());
  stormSinkConfig.addProperty(StormSinkConfiguration.EVENT_SENDER_FACTORY_CLASS,
      SimpleEventSenderFactory.class.getName());
  stormSinkConfig.addProperty(StormSinkConfiguration.CONNECTION_PARAMETERS_FACTORY_CLASS,
      SimpleConnectionParametersFactory.class.getName());
}