use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class GobblinServiceManagerTest 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 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));
try {
this.flowConfigClient.createFlowConfig(flowConfig);
} 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 GobblinServiceManagerTest method testDelete.
@Test(dependsOnMethods = "testUpdate")
public void testDelete() throws Exception {
FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME);
// make sure flow config exists
FlowConfig flowConfig = this.flowConfigClient.getFlowConfig(flowId);
Assert.assertEquals(flowConfig.getId().getFlowGroup(), TEST_GROUP_NAME);
Assert.assertEquals(flowConfig.getId().getFlowName(), TEST_FLOW_NAME);
this.flowConfigClient.deleteFlowConfig(flowId);
try {
this.flowConfigClient.getFlowConfig(flowId);
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.NOT_FOUND_404);
return;
}
Assert.fail("Get should have gotten a 404 error");
}
use of com.linkedin.restli.client.RestLiResponseException in project incubator-gobblin by apache.
the class GobblinServiceManagerTest method testBadDelete.
@Test
public void testBadDelete() 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");
}
use of com.linkedin.restli.client.RestLiResponseException in project rest.li by linkedin.
the class TestAsyncExceptions method testCallback.
@Test(dataProvider = "exceptionProvider")
public void testCallback(String key, int expectedStatus) throws RemoteInvocationException {
AsyncErrorsBuilders builder = new AsyncErrorsBuilders();
Request<Greeting> request = builder.actionCallback().paramId(key).build();
try {
getClient().sendRequest(request).getResponse();
Assert.fail("This request should have failed.");
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), expectedStatus);
}
}
use of com.linkedin.restli.client.RestLiResponseException in project rest.li by linkedin.
the class TestAsyncExceptions method testTask.
@Test(dataProvider = "exceptionProvider")
public void testTask(String key, int expectedStatus) throws RemoteInvocationException {
AsyncErrorsBuilders builder = new AsyncErrorsBuilders();
Request<Greeting> request = builder.actionTask().paramId(key).build();
try {
getClient().sendRequest(request).getResponse();
Assert.fail("This request should have failed.");
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), expectedStatus);
}
}
Aggregations