PhysicalSourceConfig implements ConfigBuilder<PhysicalSourceStaticConfig> { public PhysicalSourceConfig() { _id = 0; _resourceKey = ""; _role = PhysicalSource.PHYSICAL_SOURCE_MASTER; _sources = new ArrayList<LogicalSourceConfig>(); _restartScnOffset = 0; _slowSourceQueryThreshold = 3000; _retries = new BackoffTimerStaticConfigBuilder(); _retries.setInitSleep(DEFAULT_DBPOLL_INTERVAL_MILLIS); _retries.setMaxRetryNum(-1); _retries.setMaxSleep(MAX_DBPOLL_INTERVAL_MILLIS); _retries.setSleepIncFactor(2.0); _retries.setSleepIncDelta(0); _chunkingType = DEFAULT_CHUNKING_TYPE; _txnsPerChunk = DEFAULT_TXN_CHUNK_SIZE; _scnChunkSize = DEFAULT_SCN_CHUNK_SIZE; _chunkedScnThreshold = DEFAULT_SCN_CHUNKED_THRESHOLD; _maxScnDelayMs = DEFAULT_MAX_SCN_DELAY_MS; _largestEventSizeInBytes = DEFAULT_LARGEST_EVENT_SIZE; _largestWindowSizeInBytes = DEFAULT_LARGEST_WINDOW_SIZE; _eventRatePerSec=10; _maxThrottleDurationInSecs = 0; _errorOnMissingFields = true; _dbusEventBuffer = null; _xmlEncoding = "ISO-8859-1"; _replBitSetter = new ReplicationBitSetterConfig(); _xmlVersion = "1.0"; } PhysicalSourceConfig();  PhysicalSourceConfig(String pSourceName, String pUri, int pPartionId);  PhysicalSourceConfig(Collection<IdNamePair> srcIds); static PhysicalSourceConfig createFromLogicalSources(Collection<LogicalSource> srcIds); void checkForNulls(); String getUri(); void setUri(String uri); int getId(); void setId(int id); void setRole(String role); String getRole(); void setResourceKey(String rk); String getResourceKey(); LogicalSourceConfig getSource(int index); void setSource(int index, LogicalSourceConfig source); void addSource(LogicalSourceConfig source); List<LogicalSourceConfig> getSources(); void setSources(List<LogicalSourceConfig> newSources); String getName(); void setName(String name); long getSlowSourceQueryThreshold(); void setSlowSourceQueryThreshold(long slowSourceQueryThreshold); long getRestartScnOffset(); void setRestartScnOffset(long r); int getLargestEventSizeInBytes(); void setLargestEventSizeInBytes(int largestEventSizeInBytes); long getLargestWindowSizeInBytes(); void setLargestWindowSizeInBytes(long largestWindowSizeInBytes); boolean getErrorOnMissingFields(); void setErrorOnMissingFields(boolean errorOnMissingFields); @Override String toString(); static PhysicalSourceConfig fromString(String str); static PhysicalSourceConfig fromFile(File f); Map<String,Object> toMap(); static PhysicalSourceConfig fromMap(Map<String,Object> map); @Override PhysicalSourceStaticConfig build(); BackoffTimerStaticConfigBuilder getRetries(); void setRetries(BackoffTimerStaticConfigBuilder retries); String getChunkingType(); void setChunkingType(String chunkingType); long getTxnsPerChunk(); void setTxnsPerChunk(long txnsPerChunk); long getScnChunkSize(); void setScnChunkSize(long scnChunkSize); long getChunkedScnThreshold(); void setChunkedScnThreshold(long chunkedScnThreshold); long getMaxScnDelayMs(); void setMaxScnDelayMs(long maxScnDelayMs); long getEventRatePerSec(); void setEventRatePerSec(long eventRatePerSec); long getMaxThrottleDurationInSecs(); void setMaxThrottleDurationInSecs(long maxThrottleDurationInSecs); @JsonIgnore DbusEventBuffer.Config getDbusEventBuffer(); void setDbusEventBuffer(DbusEventBuffer.Config _dbusEventBuffer); @JsonIgnore boolean isDbusEventBufferSet(); String getXmlVersion(); void setXmlVersion(String xmlVersion); String getXmlEncoding(); void setXmlEncoding(String xmlEncoding); ReplicationBitSetterConfig getReplBitSetter(); void setReplBitSetter(ReplicationBitSetterConfig replBitSetter); static final long DEFAULT_DBPOLL_INTERVAL_MILLIS; static final long MAX_DBPOLL_INTERVAL_MILLIS; static final String DEFAULT_PHYSICAL_SOURCE_URI; static final Integer DEFAULT_PHYSICAL_PARTITION; static final String DEFAULT_PHYSICAL_PARTITION_NAME; static final String DEFAULT_PHYSICAL_SOURCE_NAME; static final String PHYSICAL_SOURCE_BASE_DIR; static final String PHYSICAL_SOURCE_BASE_DIR_DEFAULT; static final String DEFAULT_CHUNKING_TYPE; static final long DEFAULT_SCN_CHUNK_SIZE; static final long DEFAULT_TXN_CHUNK_SIZE; static final long DEFAULT_SCN_CHUNKED_THRESHOLD; static final long DEFAULT_MAX_SCN_DELAY_MS; static final int DEFAULT_LARGEST_EVENT_SIZE; static final long DEFAULT_LARGEST_WINDOW_SIZE; }
@Test public void testPhysicalSourceConfig() throws IOException { ObjectMapper mapper = new ObjectMapper(); InputStreamReader isr = new InputStreamReader(IOUtils.toInputStream(_configSource)); PhysicalSourceConfig physicalSourceConfig = mapper.readValue(isr, PhysicalSourceConfig.class); PhysicalSourceStaticConfig pStatic=null; try { physicalSourceConfig.checkForNulls(); pStatic = physicalSourceConfig.build(); } catch (InvalidConfigException e) { fail("PhysicalSourceConfig.checkForNulls failed.", e); } assertNotNull("Uri is null.", pStatic.getUri()); assertNotNull("Name is null.", pStatic.getName()); assertEquals(100, pStatic.getId(),"physical source id mismatch:"); List<LogicalSourceConfig>lSources = physicalSourceConfig.getSources(); assertEquals(4, lSources.size(), "number of logical sources"); LogicalSourceStaticConfig lSource=null; try { lSource = lSources.get(0).build(); } catch (InvalidConfigException e) { fail("get LogicalSourceStaticConfig failed", e); } assertEquals(2, lSource.getId(), "logical source id"); }