use of org.apache.gobblin.configuration.WorkUnitState in project incubator-gobblin by apache.
the class InstrumentedDataWriterTest method test.
@Test
public void test() throws IOException {
WorkUnitState state = new WorkUnitState();
state.setProp(ConfigurationKeys.METRICS_ENABLED_KEY, Boolean.toString(true));
TestInstrumentedDataWriter writer = new TestInstrumentedDataWriter(state);
testBase(writer);
}
use of org.apache.gobblin.configuration.WorkUnitState in project incubator-gobblin by apache.
the class AbstractSourceTest method setUpBeforeClass.
@BeforeClass
public void setUpBeforeClass() {
this.testSource = new TestSource<>();
WorkUnitState committedWorkUnitState = new WorkUnitState();
committedWorkUnitState.setWorkingState(WorkingState.COMMITTED);
WorkUnitState successfulWorkUnitState = new WorkUnitState();
successfulWorkUnitState.setWorkingState(WorkingState.SUCCESSFUL);
WorkUnitState failedWorkUnitState = new WorkUnitState();
failedWorkUnitState.setWorkingState(WorkingState.FAILED);
this.previousWorkUnitStates = Lists.newArrayList(committedWorkUnitState, successfulWorkUnitState, failedWorkUnitState);
this.expectedPreviousWorkUnitStates = Lists.newArrayList(successfulWorkUnitState, failedWorkUnitState);
}
use of org.apache.gobblin.configuration.WorkUnitState in project incubator-gobblin by apache.
the class AbstractSourceTest method testGetPreviousWorkUnitStatesEnabledRetry.
/**
* Test the always-retry policy, with WORK_UNIT_RETRY_ENABLED_KEY enabled.
*/
@Test
public void testGetPreviousWorkUnitStatesEnabledRetry() {
SourceState sourceState = new SourceState(new State(), this.previousWorkUnitStates);
sourceState.setProp(ConfigurationKeys.WORK_UNIT_RETRY_ENABLED_KEY, Boolean.TRUE);
List<WorkUnitState> returnedWorkUnitStates = this.testSource.getPreviousWorkUnitStatesForRetry(sourceState);
Assert.assertEquals(returnedWorkUnitStates, this.expectedPreviousWorkUnitStates);
}
use of org.apache.gobblin.configuration.WorkUnitState in project incubator-gobblin by apache.
the class EncryptionConfigParserTest method testConverterWithEntityPrefix.
@Test
public void testConverterWithEntityPrefix() {
final String entityName = "MyConverter";
WorkUnitState wuState = new WorkUnitState();
wuState.getJobState().setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "." + EncryptionConfigParser.ENCRYPTION_ALGORITHM_KEY, "any");
wuState.getJobState().setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "." + entityName + "." + EncryptionConfigParser.ENCRYPTION_ALGORITHM_KEY, "aes_rotating");
wuState.getJobState().setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "." + EncryptionConfigParser.ENCRYPTION_KEYSTORE_PATH_KEY, "/tmp/foobar");
wuState.getJobState().setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "." + EncryptionConfigParser.ENCRYPTION_KEYSTORE_PASSWORD_KEY, "abracadabra");
wuState.getJobState().setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "." + EncryptionConfigParser.ENCRYPTION_KEY_NAME, "keyname");
wuState.setProp(EncryptionConfigParser.CONVERTER_ENCRYPT_PREFIX + "abc.def", "foobar");
Map<String, Object> parsedProperties = EncryptionConfigParser.getConfigForBranch(EncryptionConfigParser.EntityType.CONVERTER_ENCRYPT, entityName, wuState);
Assert.assertNotNull(parsedProperties, "Expected parser to only return one record");
Assert.assertEquals(parsedProperties.size(), 4, "Did not expect abc.def to be picked up in config");
Assert.assertEquals(EncryptionConfigParser.getEncryptionType(parsedProperties), "aes_rotating");
Map<String, Object> parsedWriterProperties = EncryptionConfigParser.getConfigForBranch(EncryptionConfigParser.EntityType.WRITER, wuState);
Assert.assertNull(parsedWriterProperties, "Did not expect to find writer properties");
}
use of org.apache.gobblin.configuration.WorkUnitState in project incubator-gobblin by apache.
the class InstrumentedExtractorTest method test.
@Test
public void test() throws DataRecordException, IOException {
WorkUnitState state = new WorkUnitState();
state.setProp(ConfigurationKeys.METRICS_ENABLED_KEY, Boolean.toString(true));
TestInstrumentedExtractor extractor = new TestInstrumentedExtractor(state);
testBase(extractor);
}
Aggregations