Package com.linkedin.databus2.relay.config

Examples of com.linkedin.databus2.relay.config.PhysicalSourceConfig


  "}";

  public PhysicalSourceConfig convertToPhysicalSourceConfig(String str) {
    _mapper = new ObjectMapper();
    InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(str));
    PhysicalSourceConfig pConfig = null;
    try
    {
      pConfig = _mapper.readValue(isr, PhysicalSourceConfig.class);
    }
    catch (JsonParseException e) {
View Full Code Here


    TestSetup() throws JsonParseException, JsonMappingException, IOException, InvalidConfigException
    {
      ObjectMapper mapper = new ObjectMapper();
      InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(_configSource1));

      PhysicalSourceConfig pConfig1 = mapper.readValue(isr, PhysicalSourceConfig.class);

      isr.close();
      isr = new InputStreamReader(IOUtils.toInputStream(_configSource2));
      PhysicalSourceConfig pConfig2 = mapper.readValue(isr, PhysicalSourceConfig.class);

      PhysicalSourceStaticConfig pStatConf1 = pConfig1.build();
      PhysicalSourceStaticConfig pStatConf2 = pConfig2.build();

      _physConfigs =  new PhysicalSourceStaticConfig [] {pStatConf1, pStatConf2};

      DbusEventBuffer.Config conf = new DbusEventBuffer.Config();
      conf.setAllocationPolicy("MMAPPED_MEMORY");
View Full Code Here

    loConfig.setPartition((short) 0);
    loConfig.setUri("testuri");
    loConfig.setPartitionFunction("constant:1");

    //Physical sources config without event buffer
    PhysicalSourceConfig config = new PhysicalSourceConfig();
    config.setName("testname");
    config.setUri("testuri");
    config.setSource(0,loConfig);
    PhysicalSourcesStaticConfigWithoutEbuffer = config.build();
    PhysicalSourcesConfigWithoutEBuffer = config;

    //Physical sources config with event buffer
    PhysicalSourceConfig config2 = new PhysicalSourceConfig();
    config2.setName("testname");
    config2.setUri("testuri");
    config2.setSource(0,loConfig);
    config2.setName("testname");
    config2.setUri("testuri");
    config2.getDbusEventBuffer().setMaxSize(eventBufferMaxSize);
    config2.getDbusEventBuffer().setScnIndexSize(scnIndexSize);
    config2.getDbusEventBuffer().setAverageEventSize(eventBufferReadBufferSize);
    PhysicalSourcesStaticConfigWithEBuffer = config2.build();
    PhysicalSourcesConfigWithEBuffer = config2;

    //Global event buffer config
    DbusEventBuffer.Config ebufConfig = new DbusEventBuffer.Config();
    ebufConfig.setMaxSize(globaleventBufferMaxSize);
View Full Code Here

  public void deserializePhysicalSourceConfigWithEbuffer() throws JSONException, JsonParseException, JsonMappingException, IOException
  {
    JSONObject jsonObject = new JSONObject(PhysicalSourcesConfigWithEBuffer.toString());
    Assert.assertNotEquals(jsonObject.get("dbusEventBuffer"), JSONObject.NULL);
    ObjectMapper mapper = new ObjectMapper();
    PhysicalSourceConfig config = mapper.readValue(jsonObject.toString(), PhysicalSourceConfig.class);
    //System.out.println(config.toString());
    Assert.assertEquals(config.isDbusEventBufferSet(), true);
  }
View Full Code Here

      StringBuilder logListIds =
          new StringBuilder("Creating default physical source config. Sources are: ");

      // default ph config
      PhysicalSourceConfig pConfig =
          PhysicalSourceConfig.createFromLogicalSources(_sourcesIdNameRegistry.getAllSources());

      //
      for(LogicalSourceConfig ls : pConfig.getSources())
        logListIds.append(ls.getId() + ":" + ls.getName() + ",");
      LOG.info(logListIds);
      // set the memeber
      _pConfigs = new ArrayList<PhysicalSourceStaticConfig>(1);
      _pConfigs.add(pConfig.build());
    }
View Full Code Here

  public void deserializePhysicalSourceConfigWithoutEbuffer() throws JSONException, JsonParseException, JsonMappingException, IOException
  {
    JSONObject jsonObject = new JSONObject(PhysicalSourcesConfigWithoutEBuffer.toString());
    Assert.assertEquals(jsonObject.get("dbusEventBuffer"), JSONObject.NULL);
    ObjectMapper mapper = new ObjectMapper();
    PhysicalSourceConfig config = mapper.readValue(jsonObject.toString(), PhysicalSourceConfig.class);
    Assert.assertEquals(config.isDbusEventBufferSet(), false);
  }
View Full Code Here

        int i = 0;
        for (String file : _physicalSrcConfigFiles) {
            LOG.info("processing file: " + file);
            File sourcesJson = new File(file);
            PhysicalSourceConfig pConfig = mapper.readValue(sourcesJson, PhysicalSourceConfig.class);
            pConfig.checkForNulls();
            _pStaticConfigs[i] = pConfig.build();

            // Register all sources with the static config
            //TODO why do we need this?
            for (LogicalSourceConfig lsc : pConfig.getSources()) {
                _relayConfigBuilder.setSourceName(Short.toString(lsc.getId()), lsc.getName());
            }
            i++;
        }
      }
View Full Code Here

        return _dataSources;
      }

      public PhysicalSourceConfig getPhysicalSourcesConfigs(int index)
      {
        while (_physicalSourcesConfigs.size() <= index) _physicalSourcesConfigs.add(new PhysicalSourceConfig());
        return _physicalSourcesConfigs.get(index);
      }
View Full Code Here

        return _physicalSourcesConfigs.get(index);
      }

      public void setPhysicalSourcesConfigs(int index, PhysicalSourceConfig conf)
      {
        while (_physicalSourcesConfigs.size() <= index) _physicalSourcesConfigs.add(new PhysicalSourceConfig());
        _physicalSourcesConfigs.set(index, conf);
      }
View Full Code Here

  private DbusEventBufferMult createBufferMult(DbusEventBuffer.StaticConfig config) throws IOException, InvalidConfigException {
    ObjectMapper mapper = new ObjectMapper();
    InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(TestDbusEventBufferMult._configSource1));

    PhysicalSourceConfig pConfig1 = mapper.readValue(isr, PhysicalSourceConfig.class);

    isr.close();
    isr = new InputStreamReader(IOUtils.toInputStream(TestDbusEventBufferMult._configSource2));
    PhysicalSourceConfig pConfig2 = mapper.readValue(isr, PhysicalSourceConfig.class);

    PhysicalSourceStaticConfig pStatConf1 = pConfig1.build();
    PhysicalSourceStaticConfig pStatConf2 = pConfig2.build();

    PhysicalSourceStaticConfig[] _physConfigs =  new PhysicalSourceStaticConfig [] {pStatConf1, pStatConf2};

    return new DbusEventBufferMult(_physConfigs, config, new DbusEventV2Factory());
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.relay.config.PhysicalSourceConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.