@Test
public void testPost() throws URISyntaxException {
DbConnectionProperties sourceDB = new DbConnectionProperties("SourceDBName", "SourceDBDriver", "SourceDBUrl", "SourceDBUserName", "SourceDBPassword");
DbConnectionProperties destinationDB = new DbConnectionProperties("DestinationDBName", "DestinationDBDriver", "DestinationDBUrl", "DestinationDBUserName", "DestinationDBPassword");
Streams streamsAvailablity = new Streams(1, 1, 1, 1);
AgencyRequest agencyRequest = new AgencyRequest();
agencyRequest.setConnectorId(1);
agencyRequest.setJobConfig("/usr/local/workspace/test.config.xml");
agencyRequest.setConnectorName("/usr/local/workspace/test.kjb");
agencyRequest.setRequestId(1);
agencyRequest.setTenantId(1);
agencyRequest.setTenantName("Test Tenant");
agencyRequest.setTimeZone("UTC");
agencyRequest.setSourceDB(sourceDB);
agencyRequest.setDestinationDB(destinationDB);
agencyRequest.setIntervalBatchUnit("d");
agencyRequest.setIntervalBatch(0);
agencyRequest.setIntervalReloadUnit("d");
agencyRequest.setIntervalReload(0);
agencyRequest.setMustUseBatch(1);
agencyRequest.setStreamsAvailablity(streamsAvailablity);
String json = new Gson().toJson(agencyRequest);
System.out.println(json);
System.out.println(uri + "/" + ResourceConstants.JOB_CONFIG);
given().
accept(ContentType.JSON).
contentType(ContentType.JSON).
body(json).
post(new URI(uri + "/" + ResourceConstants.JOB_CONFIG)).
then().
assertThat().
statusCode(HttpStatus.OK_200);
}
When i pass the json body with nested objects, it throws me an internal error "Status code 500" It succeed if I pass a json string without a nested object