use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class FlowConfigTest method testCreateBadTemplateUri.
@Test
public void testCreateBadTemplateUri() throws Exception {
Map<String, String> flowProperties = Maps.newHashMap();
flowProperties.put("param1", "value1");
FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME)).setTemplateUris("FILE://bad/uri").setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE).setRunImmediately(true)).setProperties(new StringMap(flowProperties));
try {
_client.createFlowConfig(flowConfig);
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.S_422_UNPROCESSABLE_ENTITY.getCode());
return;
}
Assert.fail("Get should have gotten a 422 error");
}
use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class FlowConfigTest 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 {
_client.updateFlowConfig(flowConfig);
} catch (RestLiResponseException e) {
Assert.fail("Bad update should pass without complaining that the spec does not exists.");
}
}
use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class GobblinServiceHATest method testCreateAgain.
@Test(dependsOnMethods = "testCreate")
public void testCreateAgain() throws Exception {
Map<String, String> flowProperties = Maps.newHashMap();
flowProperties.put("param1", "value1");
flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
FlowConfig flowConfig1 = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME_1).setFlowName(TEST_FLOW_NAME_1)).setTemplateUris(TEST_TEMPLATE_URI_1).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE_1).setRunImmediately(true)).setProperties(new StringMap(flowProperties));
FlowConfig flowConfig2 = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME_2).setFlowName(TEST_FLOW_NAME_2)).setTemplateUris(TEST_TEMPLATE_URI_2).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE_2).setRunImmediately(true)).setProperties(new StringMap(flowProperties));
// Try create on both nodes
try {
this.node1FlowConfigClient.createFlowConfig(flowConfig1);
} catch (RestLiResponseException e) {
Assert.fail("Create Again should pass without complaining that the spec already exists.");
}
try {
this.node2FlowConfigClient.createFlowConfig(flowConfig2);
} catch (RestLiResponseException e) {
Assert.fail("Create Again should pass without complaining that the spec already exists.");
}
}
use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class GobblinServiceHATest method testDelete.
@Test(dependsOnMethods = "testUpdate")
public void testDelete() throws Exception {
FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME_1).setFlowName(TEST_FLOW_NAME_1);
// make sure flow config exists
FlowConfig flowConfig = this.node1FlowConfigClient.getFlowConfig(flowId);
Assert.assertEquals(flowConfig.getId().getFlowGroup(), TEST_GROUP_NAME_1);
Assert.assertEquals(flowConfig.getId().getFlowName(), TEST_FLOW_NAME_1);
this.node1FlowConfigClient.deleteFlowConfig(flowId);
// Check if deletion is reflected on both nodes
try {
this.node1FlowConfigClient.getFlowConfig(flowId);
Assert.fail("Get should have gotten a 404 error");
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.NOT_FOUND_404);
}
try {
this.node2FlowConfigClient.getFlowConfig(flowId);
Assert.fail("Get should have gotten a 404 error");
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.NOT_FOUND_404);
}
}
use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class GobblinServiceManagerTest method testBadGet.
@Test
public void testBadGet() throws Exception {
FlowId flowId = new FlowId().setFlowGroup(TEST_DUMMY_GROUP_NAME).setFlowName(TEST_DUMMY_FLOW_NAME);
try {
this.flowConfigClient.getFlowConfig(flowId);
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.NOT_FOUND_404);
return;
}
Assert.fail("Get should have raised a 404 error");
}
Aggregations