use of org.apache.gobblin.service.Schedule in project incubator-gobblin by apache.
the class FlowConfigUtilsTest method testEqual.
/**
* Due to default value setting, flow config after deserialization might contain default value.
* Only check f1.equals(f2) is not enough
*/
private boolean testEqual(FlowConfig f1, FlowConfig f2) {
if (f1.equals(f2)) {
return true;
}
// Check Id
Assert.assertTrue(f1.hasId() == f2.hasId());
Assert.assertTrue(f1.getId().equals(f2.getId()));
// Check Schedule
Assert.assertTrue(f1.hasSchedule() == f2.hasSchedule());
if (f1.hasSchedule()) {
Schedule s1 = f1.getSchedule();
Schedule s2 = f2.getSchedule();
Assert.assertTrue(s1.getCronSchedule().equals(s2.getCronSchedule()));
Assert.assertTrue(s1.isRunImmediately().equals(s2.isRunImmediately()));
}
// Check Template URI
Assert.assertTrue(f1.hasTemplateUris() == f2.hasTemplateUris());
if (f1.hasTemplateUris()) {
Assert.assertTrue(f1.getTemplateUris().equals(f2.getTemplateUris()));
}
// Check Properties
Assert.assertTrue(f1.hasProperties() == f2.hasProperties());
if (f1.hasProperties()) {
Assert.assertTrue(f1.getProperties().equals(f2.getProperties()));
}
return true;
}
use of org.apache.gobblin.service.Schedule in project incubator-gobblin by apache.
the class FlowConfigUtilsTest method testFullFlowConfig.
public void testFullFlowConfig() {
FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowName("SN_CRMSYNC").setFlowGroup("DYNAMICS-USER-123456789"));
flowConfig.setSchedule(new Schedule().setCronSchedule("0 58 2/12 ? * * *").setRunImmediately(Boolean.valueOf("true")));
flowConfig.setTemplateUris("FS:///my.template");
Properties properties = new Properties();
properties.put("gobblin.flow.sourceIdentifier", "dynamicsCrm");
properties.put("gobblin.flow.destinationIdentifier", "espresso");
flowConfig.setProperties(new StringMap(Maps.fromProperties(properties)));
testFlowSpec(flowConfig);
testSerDer(flowConfig);
}
use of org.apache.gobblin.service.Schedule in project incubator-gobblin by apache.
the class FlowConfigUtilsTest method testFlowConfigWithDefaultRunImmediately.
public void testFlowConfigWithDefaultRunImmediately() {
FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowName("SN_CRMSYNC").setFlowGroup("DYNAMICS-USER-123456789"));
flowConfig.setSchedule(new Schedule().setCronSchedule("0 58 2/12 ? * * *"));
flowConfig.setTemplateUris("FS:///my.template");
Properties properties = new Properties();
properties.put("gobblin.flow.sourceIdentifier", "dynamicsCrm");
properties.put("gobblin.flow.destinationIdentifier", "espresso");
flowConfig.setProperties(new StringMap(Maps.fromProperties(properties)));
testFlowSpec(flowConfig);
testSerDer(flowConfig);
}
use of org.apache.gobblin.service.Schedule in project incubator-gobblin by apache.
the class GobblinServiceManagerTest method testBadUpdate.
@Test
public void testBadUpdate() throws Exception {
Map<String, String> flowProperties = Maps.newHashMap();
flowProperties.put("param1", "value1b");
flowProperties.put("param2", "value2b");
FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_DUMMY_GROUP_NAME).setFlowName(TEST_DUMMY_FLOW_NAME)).setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE)).setProperties(new StringMap(flowProperties));
try {
this.flowConfigClient.updateFlowConfig(flowConfig);
} catch (RestLiResponseException e) {
Assert.fail("Bad update should pass without complaining that the spec does not exists.");
}
cleanUpDir(FLOW_SPEC_STORE_DIR);
}
use of org.apache.gobblin.service.Schedule in project incubator-gobblin by apache.
the class GobblinServiceManagerTest method testUpdate.
@Test(dependsOnMethods = "testGet")
public void testUpdate() throws Exception {
FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME);
Map<String, String> flowProperties = Maps.newHashMap();
flowProperties.put("param1", "value1b");
flowProperties.put("param2", "value2b");
flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME)).setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE)).setProperties(new StringMap(flowProperties));
this.flowConfigClient.updateFlowConfig(flowConfig);
FlowConfig retrievedFlowConfig = this.flowConfigClient.getFlowConfig(flowId);
Assert.assertEquals(retrievedFlowConfig.getId().getFlowGroup(), TEST_GROUP_NAME);
Assert.assertEquals(retrievedFlowConfig.getId().getFlowName(), TEST_FLOW_NAME);
Assert.assertEquals(retrievedFlowConfig.getSchedule().getCronSchedule(), TEST_SCHEDULE);
Assert.assertEquals(retrievedFlowConfig.getTemplateUris(), TEST_TEMPLATE_URI);
// Add this asssert when getFlowSpec() is changed to return the raw flow spec
// Assert.assertEquals(flowConfig.getProperties().size(), 2);
Assert.assertEquals(retrievedFlowConfig.getProperties().get("param1"), "value1b");
Assert.assertEquals(retrievedFlowConfig.getProperties().get("param2"), "value2b");
}
Aggregations