org.apache.http.client.methods.CloseableHttpResponse - java examples

Here are the examples of the java api org.apache.http.client.methods.CloseableHttpResponse taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testGetInvalidDigest() throws Exception {
    CloseableHttpResponse resp = get(blobUri("invlaid"));
    replacedertThat(resp.getStatusLine().getStatusCode(), is(404));
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testClreplacedPathGetUtf8(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal()) {
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/%C2%A2.txt"))) {
            replacedert200Ok(res, "text/plain", "¢");
        }
    }
}

19 View Complete Implementation : DateRangeParamR4Test.java
Copyright Apache License 2.0
Author : jamesagnew
@Test
public void testSearchForOneQualifiedDateLt() throws Exception {
    HttpGet httpGet = new HttpGet(ourBaseUrl + "?birthdate=lt2012-01-01");
    CloseableHttpResponse status = ourClient.execute(httpGet);
    consumeResponse(status);
    replacedertEquals(200, status.getStatusLine().getStatusCode());
    replacedertEquals(null, ourLastDateRange.getLowerBound());
    replacedertEquals("2012-01-01", ourLastDateRange.getUpperBound().getValuereplacedtring());
    replacedertEquals(null, ourLastDateRange.getLowerBoundAsInstant());
    replacedertEquals(parseUpperForDatePrecision("2012-01-01 00:00:00.0000"), ourLastDateRange.getUpperBoundAsInstant());
    replacedertEquals(null, ourLastDateRange.getLowerBound());
    replacedertEquals(ParamPrefixEnum.LESSTHAN, ourLastDateRange.getUpperBound().getPrefix());
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testDeleteFile() throws IOException {
    String digest = uploadSmallBlob();
    String uri = blobUri(digest);
    CloseableHttpResponse res = delete(uri);
    replacedertThat(res.getStatusLine().getStatusCode(), is(204));
    res = get(uri);
    replacedertThat(res.getStatusLine().getStatusCode(), is(404));
}

19 View Complete Implementation : AdminUIIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testPostForbidden() throws IOException {
    CloseableHttpResponse response = post("/static/");
    // status should be 403 FORBIDDEN
    replacedertThat(response.getStatusLine().getStatusCode(), is(403));
}

19 View Complete Implementation : DeploymentResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting deployment. GET repository/deployments/{deploymentId}
 */
public void testGetUnexistingDeployment() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_DEPLOYMENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testClreplacedPatreplacedlseGet(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal();
        CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/bar.txt"))) {
        replacedert200Ok(res, "text/plain", "bar");
    }
}

19 View Complete Implementation : DeploymentResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting deployment. GET repository/deployments/{deploymentId}
 */
public void testGetUnexistingDeployment() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + EventRestUrls.createRelativeResourceUrl(EventRestUrls.URL_DEPLOYMENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FedoraAclIT.java
Copyright Apache License 2.0
Author : fcrepo4
@Test
public void testCreateAndRetrieveAcl() throws Exception {
    createObjectAndClose(id);
    final HttpPut put = new HttpPut(subjectUri + "/" + FCR_ACL);
    final String aclLocation;
    try (final CloseableHttpResponse response = execute(put)) {
        replacedertEquals(CREATED.getStatusCode(), getStatus(response));
        aclLocation = response.getFirstHeader("Location").getValue();
        // verify the acl container is translated to fcr:acl
        replacedertEquals(subjectUri + "/" + FCR_ACL, aclLocation);
    }
    final HttpGet get = new HttpGet(aclLocation);
    replacedertEquals(OK.getStatusCode(), getStatus(get));
}

19 View Complete Implementation : ProcessDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting model for an unexisting process-definition .
 */
@Test
public void testGetModelForUnexistingProcessDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_MODEL, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testEmptyFile() throws IOException {
    CloseableHttpResponse res = put(blobUri("da39a3ee5e6b4b0d3255bfef95601890afd80709"), "");
    replacedertThat(res.getStatusLine().getStatusCode(), is(201));
    replacedertThat(res.getStatusLine().getReasonPhrase(), is("Created"));
    res = put(blobUri("da39a3ee5e6b4b0d3255bfef95601890afd80709"), "");
    replacedertThat(res.getStatusLine().getStatusCode(), is(409));
    replacedertThat(res.getStatusLine().getReasonPhrase(), is("Conflict"));
}

19 View Complete Implementation : AdminUIIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testNotFound() throws Exception {
    CloseableHttpResponse response = browserGet("/static/does/not/exist.html");
    replacedertThat(response.getStatusLine().getStatusCode(), is(404));
}

19 View Complete Implementation : CaseDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting case-definition. GET repository/case-definitions/{caseDefinitionId}
 */
public void testGetUnexistingCaseDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_DEFINITION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testUploadChunkedWithConflict() throws IOException {
    String digest = uploadBigBlob();
    CloseableHttpResponse conflictRes = put(blobUri(digest), repeat("abcdefghijklmnopqrstuvwxyz", 1024 * 600));
    replacedertThat(conflictRes.getStatusLine().getStatusCode(), is(409));
}

19 View Complete Implementation : JobResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting job.
 */
@Test
public void testGetUnexistingJob() throws Exception {
    CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_JOB, "unexistingjob")), HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testErrorResponseResetsBlobHandlerStateCorrectly() throws IOException {
    String digest = uploadTinyBlob();
    CloseableHttpResponse response;
    response = get(blobUri("0000000000000000000000000000000000000000"));
    replacedertThat(response.getStatusLine().getStatusCode(), is(404));
    response = get(blobUri(digest));
    replacedertThat(response.getStatusLine().getStatusCode(), is(200));
}

19 View Complete Implementation : DeploymentResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting deployment. GET repository/deployments/{deploymentId}
 */
@Test
public void testGetUnexistingDeployment() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
private static String header(CloseableHttpResponse res, String name) {
    final String value = headerOrNull(res, name);
    replacedertThat(value).withFailMessage("The response must contains the header '%s'.", name).isNotNull();
    return value;
}

19 View Complete Implementation : ExecutionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting execution.
 */
@Test
public void testGetUnexistingExecution() throws Exception {
    CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, "unexisting")), HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FedoraNodesIT.java
Copyright Apache License 2.0
Author : fcrepo4
@Test
public void testMoveAndTombstone() throws IOException {
    final String id = getRandomUniqueId();
    final String location = getLocation(postObjMethod());
    final HttpMove request = new HttpMove(location);
    request.addHeader("Destination", serverAddress + id);
    executeAndClose(request);
    replacedertEquals(OK.getStatusCode(), getStatus(new HttpGet(serverAddress + id)));
    try (final CloseableHttpResponse originalResult = execute(new HttpGet(location))) {
        replacedertEquals(GONE.getStatusCode(), getStatus(originalResult));
        final Link tombstone = Link.valueOf(originalResult.getFirstHeader(LINK).getValue());
        replacedertEquals("hasTombstone", tombstone.getRel());
    }
}

19 View Complete Implementation : DateRangeParamR4Test.java
Copyright Apache License 2.0
Author : jamesagnew
@Test
public void testSearchForMultipleUnqualifiedDate() throws Exception {
    String baseUrl = "http://localhost:" + ourPort + "/Patient?" + Patient.SP_BIRTHDATE + "=";
    HttpGet httpGet = new HttpGet(baseUrl + "2012-01-01&" + Patient.SP_BIRTHDATE + "=2012-02-03");
    CloseableHttpResponse status = ourClient.execute(httpGet);
    consumeResponse(status);
    replacedertEquals(400, status.getStatusLine().getStatusCode());
}

19 View Complete Implementation : RestSQLActionIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testInsertWithMixedCompatibleTypes() throws IOException {
    execute("create table doc.t1 (x array(float))");
    CloseableHttpResponse resp = post("{\"stmt\": \"insert into doc.t1 (x) values (?)\", \"args\": [[0, 1.0, 1.42]]}");
    replacedertThat(resp.getStatusLine().getStatusCode(), is(200));
    execute("refresh table doc.t1");
    replacedertThat(printedTable(execute("select x from doc.t1").rows()), is("[0.0, 1.0, 1.42]\n"));
}

19 View Complete Implementation : ProcessDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting process-definition. GET repository/process-definitions/{processDefinitionId}
 */
@Test
public void testGetUnexistingProcessDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testUploadToUnknownBlobTable() throws IOException {
    String digest = "c520e6109835c876fd98636efec43dd61634b7d3";
    CloseableHttpResponse response = put(blobUri("test_no_blobs", digest), repeat("a", 1500));
    replacedertThat(response.getStatusLine().getStatusCode(), is(404));
}

19 View Complete Implementation : ContentItemResourceTest.java
Copyright Apache License 2.0
Author : flowable
public void testGetUnexistingContenreplacedem() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + ContentRestUrls.createRelativeResourceUrl(ContentRestUrls.URL_CONTENT_ITEM, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testNonExistingFile() throws IOException {
    CloseableHttpResponse response = get("test/d937ea65641c23fadc83616309e5b0e11acc5806");
    replacedertThat(response.getStatusLine().getStatusCode(), is(404));
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testClreplacedPathGetFromModule(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal()) {
        // Read a clreplaced from a JDK module (java.base).
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/clreplacedes/java/lang/Object.clreplaced"))) {
            replacedert200Ok(res, null, content -> replacedertThat(content).isNotEmpty());
        }
        // Read a clreplaced from a JDK module (java.base).
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/by-entry/clreplacedes/java/lang/Object.clreplaced"))) {
            replacedert200Ok(res, null, content -> replacedertThat(content).isNotEmpty());
        }
    }
}

19 View Complete Implementation : CaseDefinitionIdentityLinksResourceTest.java
Copyright Apache License 2.0
Author : flowable
@Test
public void testGetCandidateStarterFromUnexistingCaseDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_DEFINITION_IDENreplacedYLINK, "unexisting", "groups", "admin"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testClreplacedPathGetFromJar(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal()) {
        // Read a clreplaced from a third-party library JAR.
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/clreplacedes/io/netty/util/NetUtil.clreplaced"))) {
            replacedert200Ok(res, null, content -> replacedertThat(content).isNotEmpty());
        }
        // Read a clreplaced from a third-party library JAR.
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/by-entry/clreplacedes/io/netty/util/NetUtil.clreplaced"))) {
            replacedert200Ok(res, null, content -> replacedertThat(content).isNotEmpty());
        }
    }
}

19 View Complete Implementation : ProcessDefinitionIdentityLinksResourceTest.java
Copyright Apache License 2.0
Author : flowable
@Test
public void testGetIdenreplacedyLinksForUnexistingProcessDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_IDENreplacedYLINKS_COLLECTION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testUploadInvalidSha1() throws IOException {
    CloseableHttpResponse response = put("test/d937ea65641c23fadc83616309e5b0e11acc5806", "asdf");
    replacedertThat(response.getStatusLine().getStatusCode(), is(400));
}

19 View Complete Implementation : ChannelDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting resource content for an unexisting channel definition .
 */
public void testGetResourceContentForUnexistingChannelDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + EventRestUrls.createRelativeResourceUrl(EventRestUrls.URL_CHANNEL_DEFINITION_RESOURCE_CONTENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
private String uploadSmallBlob() throws IOException {
    String digest = "c520e6109835c876fd98636efec43dd61634b7d3";
    CloseableHttpResponse response = put(blobUri(digest), repeat("a", 1500));
    replacedertThat(response.getStatusLine().getStatusCode(), is(201));
    return digest;
}

19 View Complete Implementation : CaseDefinitionIdentityLinksResourceTest.java
Copyright Apache License 2.0
Author : flowable
@Test
public void testGetIdenreplacedyLinksForUnexistingCaseDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_DEFINITION_IDENreplacedYLINKS_COLLECTION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testUnknownMediaType(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal();
        CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + "/bar.unknown"))) {
        replacedert200Ok(res, null, "Unknown Media Type");
        final String lastModified = header(res, HttpHeaders.LAST_MODIFIED);
        final String etag = header(res, HttpHeaders.ETAG);
        replacedert304NotModified(hc, baseUri, "/bar.unknown", etag, lastModified);
    }
}

19 View Complete Implementation : DeploymentResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting deployment. GET app-repository/deployments/{deploymentId}
 */
public void testGetUnexistingDeployment() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + AppRestUrls.createRelativeResourceUrl(AppRestUrls.URL_DEPLOYMENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
private static String contentString(CloseableHttpResponse res) throws IOException {
    return new String(ByteStreams.toByteArray(res.getEnreplacedy().getContent()), StandardCharsets.UTF_8);
}

19 View Complete Implementation : CaseDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting resource content for an unexisting case definition .
 */
public void testGetResourceContentForUnexistingCaseDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_DEFINITION_RESOURCE_CONTENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
@ParameterizedTest
@ArgumentsSource(BaseUriProvider.clreplaced)
void testIndexHtml(String baseUri) throws Exception {
    try (CloseableHttpClient hc = HttpClients.createMinimal()) {
        try (CloseableHttpResponse res = hc.execute(new HttpGet(baseUri + '/'))) {
            replacedert200Ok(res, "text/html", "<html><body></body></html>");
        }
    }
}

19 View Complete Implementation : DateRangeParamR4Test.java
Copyright Apache License 2.0
Author : jamesagnew
@Test
public void testSearchForOneQualifiedDateGt() throws Exception {
    HttpGet httpGet = new HttpGet(ourBaseUrl + "?birthdate=gt2012-01-01");
    CloseableHttpResponse status = ourClient.execute(httpGet);
    consumeResponse(status);
    replacedertEquals(200, status.getStatusLine().getStatusCode());
    replacedertEquals("2012-01-01", ourLastDateRange.getLowerBound().getValuereplacedtring());
    replacedertEquals(null, ourLastDateRange.getUpperBound());
    replacedertEquals(parseLowerForDatePrecision("2012-01-02 00:00:00.0000"), ourLastDateRange.getLowerBoundAsInstant());
    replacedertEquals(null, ourLastDateRange.getUpperBoundAsInstant());
    replacedertEquals(ParamPrefixEnum.GREATERTHAN, ourLastDateRange.getLowerBound().getPrefix());
    replacedertEquals(null, ourLastDateRange.getUpperBound());
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
private static void replacedert200Ok(CloseableHttpResponse res, @Nullable String expectedContentType, String expectedContent) throws Exception {
    replacedert200Ok(res, expectedContentType, content -> replacedertThat(content).isEqualTo(expectedContent));
}

19 View Complete Implementation : ProcessDefinitionIdentityLinksResourceTest.java
Copyright Apache License 2.0
Author : flowable
@Test
public void testGetCandidateStarterFromUnexistingProcessDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_IDENreplacedYLINK, "unexisting", "groups", "admin"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : FileServiceTest.java
Copyright Apache License 2.0
Author : line
private static void replacedertStatusLine(CloseableHttpResponse res, String expectedStatusLine) {
    replacedertThat(res.getStatusLine().toString()).isEqualTo(expectedStatusLine);
}

19 View Complete Implementation : DateRangeParamR4Test.java
Copyright Apache License 2.0
Author : jamesagnew
@Test
public void testSearchForOneQualifiedDateLe() throws Exception {
    HttpGet httpGet = new HttpGet(ourBaseUrl + "?birthdate=le2012-01-01");
    CloseableHttpResponse status = ourClient.execute(httpGet);
    consumeResponse(status);
    replacedertEquals(200, status.getStatusLine().getStatusCode());
    replacedertEquals(null, ourLastDateRange.getLowerBound());
    replacedertEquals("2012-01-01", ourLastDateRange.getUpperBound().getValuereplacedtring());
    replacedertEquals(null, ourLastDateRange.getLowerBoundAsInstant());
    replacedertEquals(parseUpperForDatePrecision("2012-01-02 00:00:00.0000"), ourLastDateRange.getUpperBoundAsInstant());
    replacedertEquals(null, ourLastDateRange.getLowerBound());
    replacedertEquals(ParamPrefixEnum.LESSTHAN_OR_EQUALS, ourLastDateRange.getUpperBound().getPrefix());
}

19 View Complete Implementation : ChannelDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting channel definition. GET event-registry-repository/channel-definitions/{channelDefinitionId}
 */
public void testGetUnexistingChannelDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + EventRestUrls.createRelativeResourceUrl(EventRestUrls.URL_CHANNEL_DEFINITION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : ProcessDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting resource content for an unexisting process-definition .
 */
@Test
public void testGetResourceContentForUnexistingProcessDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_RESOURCE_CONTENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : EventDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting resource content for an unexisting event definition .
 */
public void testGetResourceContentForUnexistingEventDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + EventRestUrls.createRelativeResourceUrl(EventRestUrls.URL_EVENT_DEFINITION_RESOURCE_CONTENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : EventDefinitionResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting an unexisting event definition. GET event-registry-repository/event-definitions/{eventDefinitionId}
 */
public void testGetUnexistingEventDefinition() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + EventRestUrls.createRelativeResourceUrl(EventRestUrls.URL_EVENT_DEFINITION, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
}

19 View Complete Implementation : BlobIntegrationTest.java
Copyright Apache License 2.0
Author : crate
@Test
public void testCorsHeadersAreSet() throws Exception {
    String digest = uploadTinyBlob();
    CloseableHttpResponse response = get(blobUri(digest));
    replacedertThat(response.containsHeader("Access-Control-Allow-Origin"), is(true));
}

18 View Complete Implementation : TaskVariableResourceTest.java
Copyright Apache License 2.0
Author : flowable
/**
 * Test getting a task variable. GET cmmn-runtime/tasks/{taskId}/variables/{variableName}/data
 */
public void testGetTaskVariableData() throws Exception {
    try {
        // Test variable behaviour on standalone tasks
        Task task = taskService.newTask();
        taskService.saveTask(task);
        taskService.setVariableLocal(task.getId(), "localTaskVariable", "This is a binary piece of text".getBytes());
        // Force content-type to TEXT_PLAIN to make sure this is ignored and
        // application-octect-stream is always returned
        CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_TASK_VARIABLE_DATA, task.getId(), "localTaskVariable")), HttpStatus.SC_OK);
        String actualResponseBytesAsText = IOUtils.toString(response.getEnreplacedy().getContent(), StandardCharsets.UTF_8);
        closeResponse(response);
        replacedertEquals("This is a binary piece of text", actualResponseBytesAsText);
        replacedertEquals("application/octet-stream", response.getEnreplacedy().getContentType().getValue());
    } finally {
        // Clean adhoc-tasks even if test fails
        List<Task> tasks = taskService.createTaskQuery().list();
        for (Task task : tasks) {
            taskService.deleteTask(task.getId(), true);
        }
    }
}