Source:
public void test() throws Exception { final String dictionaryJson = "{ \"name\" :\"DictionaryTest\", \"entries\" : [\"1\", \"5\"]," + " \"caseSensitive\": \"false\"}"; final String header = given().contentType("application/json").body(dictionaryJson).when().put(REFERENCEDATA_PATH + "DictionaryTest").then().statusCode(HttpStatus.SC_CREATED).extract().header("Location").toString(); assertEquals( "<LINK_0>", header); final String jobName = "ReferenceData"; final File file = new File("src/test/resources/" + jobName + ".analysis.xml"); assertTrue(file.exists()); final String command = "docker exec " + HotFolderHelper.getContainerId() + " /bin/sh /tmp/generate-hot-folder-input.sh"; HotFolderHelper.getCommandOutput(command); final String hotFolder = "/tmp/hot_folder"; given().multiPart(file).param("hotfolder", hotFolder).when().post(JOBS_PATH).then().statusCode( HttpStatus.SC_OK); final boolean scheduleCheck = given().contentType("application/json").when().get("/schedules/" + jobName).then() .statusCode(HttpStatus.SC_OK).extract().body().asString().contains(hotFolder); assertTrue(scheduleCheck); try { Thread.sleep(20 * 1000); } catch (final InterruptedException e) { fail("Waiting for the job execution was interrupted. " + e.getMessage()); } final boolean resultCheck = given().contentType("application/json").when().get("/results/").then().statusCode( HttpStatus.SC_OK).extract().body().jsonPath().getString("filename").contains(jobName); assertTrue(resultCheck); }

Target:
public void test() throws Exception { final String dictionaryJson = "{ \"name\" :\"DictionaryTest\", \"entries\" : [\"1\", \"5\"]," + " \"caseSensitive\": \"false\"}"; final String referenceDataLocation = given().contentType("application/json").body(dictionaryJson).when().put( REFERENCEDATA_PATH + "DictionaryTest").then().statusCode(HttpStatus.SC_CREATED).extract().header( "Location").toString(); assertEquals(RestAssured.baseURI + RestAssured.basePath + "/referencedata/dictionary/DictionaryTest", referenceDataLocation); final String jobName = "ReferenceData"; final File file = new File("src/test/resources/" + jobName + ".analysis.xml"); assertTrue(file.exists()); final String command = "docker exec " + HotFolderHelper.getContainerId() + " /bin/sh /tmp/generate-hot-folder-input.sh"; HotFolderHelper.getCommandOutput(command); final String hotFolder = "/tmp/hot_folder"; given().multiPart(file).param("hotfolder", hotFolder).when().post(JOBS_PATH).then().statusCode( HttpStatus.SC_OK); final boolean scheduleCheck = given().contentType("application/json").when().get("/schedules/" + jobName).then() .statusCode(HttpStatus.SC_OK).extract().body().asString().contains(hotFolder); assertTrue(scheduleCheck); try { Thread.sleep(20 * 1000); } catch (final InterruptedException e) { fail("Waiting for the job execution was interrupted. " + e.getMessage()); } final boolean resultCheck = given().contentType("application/json").when().get("/results/").then().statusCode( HttpStatus.SC_OK).extract().body().jsonPath().getString("filename").contains(jobName); assertTrue(resultCheck); final String removeHotFolderCommand = "docker exec " + HotFolderHelper.getContainerId() + " /bin/sh /tmp/remove-hot-folder.sh"; HotFolderHelper.getCommandOutput(removeHotFolderCommand); }