当前位置: 首页>>代码示例>>Java>>正文


Java Response类代码示例

本文整理汇总了Java中com.redhat.lightblue.Response的典型用法代码示例。如果您正苦于以下问题:Java Response类的具体用法?Java Response怎么用?Java Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Response类属于com.redhat.lightblue包,在下文中一共展示了Response类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyEvent

import com.redhat.lightblue.Response; //导入依赖的package包/类
protected void verifyEvent(int expectedEvents, String query, String expectedIdentityFields, String expectedFields, String operation) throws Exception {
    FindRequest findRequest = createRequest_FromJsonString(FindRequest.class, "{\"entity\":\"esbEvents\",\"entityVersion\":\"" + ESB_EVENTS_VERSION + "\"," + "\"query\":"
            + query + "," + "\"projection\": [{\"field\":\"*\",\"include\":true,\"recursive\":true}]}");
    findRequest.setClientId(new FakeClientIdentification("FakeUser"));

    Response findResponse = getLightblueFactory().getMediator().find(findRequest);
    assertNoErrors(findResponse);
    assertNoDataErrors(findResponse);
    assertEquals(expectedEvents, findResponse.getMatchCount());
    // dates and uids had to be left out to prevent test from always
    // failing.
    if (expectedEvents > 0) {
        JSONAssert.assertEquals("[{\"identity\":" + expectedIdentityFields
                + ",\"esbRootEntityName\":\"Country\",\"esbEventEntityName\":\"State\",\"endSystem\":\"nameOfTargetSystem\",\"createdBy\":\"publishHook\",\"version\":\"0.1.0-SNAPSHOT\""
                + ",\"status\":\"UNPROCESSED\",\"lastUpdatedBy\":\"publishHook\",\"operation\":\"" + operation + "\","
                + "\"entityName\":\"country\",\"objectType\":\"esbEvents\"" + expectedFields + "}]", findResponse.getEntityData().toString(), false);
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-esb-hook,代码行数:19,代码来源:BasePublishHookTest.java

示例2: test1CustomerInsertWithProperties

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test1CustomerInsertWithProperties() throws Exception {
    Response response = getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/customer-insert-single.json"));

    assertNotNull(response);
    assertNoErrors(response);
    assertNoDataErrors(response);
    assertEquals(1, response.getModifiedCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"id\":\"uid=frodo.baggins," + BASEDB_CUSTOMERS + "\"}]",
            entityData.toString(), false);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:17,代码来源:ITCaseLdapCRUDController_WithProperties_Test.java

示例3: test2FindCustomerWithProperties

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test2FindCustomerWithProperties() throws Exception {
    Response response = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/customer-find-single.json"));

    assertNotNull(response);
    assertNoErrors(response);
    assertNoDataErrors(response);
    assertEquals(1, response.getMatchCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"id\":\"uid=frodo.baggins," + BASEDB_CUSTOMERS + "\","
                    + "\"customerId\":\"frodo.baggins\","
                    + "\"firstName\":\"Frodo\","
                    + "\"lastName\":\"Baggins\","
                    + "\"cn\":\"Frodo Baggins\","
                    + "\"interfaces#\":4,"
                    + "\"interfaces\":[\"top\",\"person\",\"organizationalPerson\",\"inetOrgPerson\"]}]",
                    entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:23,代码来源:ITCaseLdapCRUDController_WithProperties_Test.java

示例4: assertPersonEntryValues

import com.redhat.lightblue.Response; //导入依赖的package包/类
protected void assertPersonEntryValues(String uid, String cn, String optional) throws Exception {
    Response findResponse = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/person-find-single.json"));

    assertValidResponse(findResponse);
    assertEquals(1, findResponse.getMatchCount());
    JSONAssert.assertEquals(
            "[{"
            + generatePersonDnJson(uid) + ","
            + "\"uid\":\"" + uid + "\","
            + "\"cn\":\"" + cn + "\","
            + "\"objectType\":\"person\","
            + "\"objectClass#\":4,"
            + "\"optional\":" + ((optional == null) ? "null" : "\"" + optional + "\"")
            + "}]",
            findResponse.getEntityData().toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:18,代码来源:ITCaseLdapCRUDControllerTest.java

示例5: testDelete

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void testDelete() throws Exception {
    //Setup
    assertValidResponse(getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/person-insert-many.json")));

    //Test
    Response response = getLightblueFactory().getMediator().delete(
            createRequest_FromResource(DeleteRequest.class, "./crud/delete/person-delete-simple.json"));

    assertValidResponse(response);
    assertEquals(1, response.getModifiedCount());

    //Ensure entry was deleted
    Response findResponse = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/person-find-many.json"));

    assertValidResponse(findResponse);
    //There were 3, now only 2
    assertEquals(2, findResponse.getMatchCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:22,代码来源:ITCaseLdapCRUDControllerTest.java

示例6: testFindMany

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void testFindMany() throws Exception {
    //Setup
    assertValidResponse(getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/person-insert-many.json")));

    //Test
    Response response = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/person-find-many.json"));

    assertValidResponse(response);
    assertEquals(3, response.getMatchCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);

    //Search requests results in desc order, strict mode is enforced to assure this.
    JSONAssert.assertEquals(
            "["
                + "{" + generatePersonDnJson("junior.doe") + "},"
                + "{" + generatePersonDnJson("john.doe") + "},"
                + "{" + generatePersonDnJson("jane.doe") + "}"
            + "]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:26,代码来源:ITCaseLdapCRUDControllerTest.java

示例7: testFindMany_WithPagination

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void testFindMany_WithPagination() throws Exception {
    //Setup
    assertValidResponse(getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/person-insert-many.json")));

    //Test
    Response response = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/person-find-many-paginated.json"));

    assertValidResponse(response);
    assertEquals(1, response.getMatchCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);

    JSONAssert.assertEquals(
            "[{" + generatePersonDnJson("john.doe") + "}]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:21,代码来源:ITCaseLdapCRUDControllerTest.java

示例8: test1PersonWithAddress_Insert

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test1PersonWithAddress_Insert() throws Exception {
    Response response = getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/person-with-address-insert-single.json"));

    assertNotNull(response);
    assertNoErrors(response);
    assertNoDataErrors(response);
    assertEquals(1, response.getModifiedCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"dn\":\"uid=john.doe," + BASEDB_USERS + "\"}]",
            entityData.toString(), false);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:17,代码来源:ITCaseLdapCRUDController_Objects_Test.java

示例9: test2PersonWithAddress_Find

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test2PersonWithAddress_Find() throws Exception {
    Response response = getLightblueFactory().getMediator().find(
            createRequest_FromResource(FindRequest.class, "./crud/find/person-with-address-find-single.json"));

    assertNotNull(response);
    assertNoErrors(response);
    assertNoDataErrors(response);
    assertEquals(1, response.getMatchCount());

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"dn\":\"uid=john.doe," + BASEDB_USERS + "\",\"address\":{\"street\":\"123 Some St.\",\"postalCode\":12345,\"state\":\"NC\"}}]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:17,代码来源:ITCaseLdapCRUDController_Objects_Test.java

示例10: test2UpdateCreatesAudits

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test2UpdateCreatesAudits() throws Exception {
    Response updateResponse = getLightblueFactory().getMediator().update(createRequest_FromJsonString(
            UpdateRequest.class,
            "{\"entity\":\"country\",\"entityVersion\":\"" + COUNTRY_VERSION + "\","
                    + "\"projection\": [{\"field\":\"*\",\"include\":true,\"recursive\":true}],"
                    + "\"query\":{\"field\":\"name\",\"op\":\"$in\",\"values\":[\"United States\",\"Canada\"]},"
                    + "\"update\":["
                    + "{\"$set\":{\"optionalField\":\"modified\"}}"
                    + "]}"));
    assertNoErrors(updateResponse);
    assertNoDataErrors(updateResponse);
    assertEquals(2, updateResponse.getModifiedCount());

    Response findResponse = getLightblueFactory().getMediator().find(createRequest_FromJsonString(
            FindRequest.class,
            "{\"entity\":\"audit\",\"entityVersion\":\"" + AUDIT_VERSION + "\","
                    + "\"query\":{\"field\":\"CRUDOperation\",\"op\":\"$eq\",\"rvalue\":\"UPDATE\"},"
                    + "\"projection\": [{\"field\":\"*\",\"include\":true,\"recursive\":true}]}"));
    assertNoErrors(findResponse);
    assertNoDataErrors(findResponse);
    assertEquals(2, findResponse.getMatchCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-audit-hook,代码行数:24,代码来源:ITAuditHook.java

示例11: test3DeleteCreatesAudits

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void test3DeleteCreatesAudits() throws Exception {
    Response deleteResponse = getLightblueFactory().getMediator().delete(createRequest_FromJsonString(
            DeleteRequest.class,
            "{\"entity\":\"country\",\"entityVersion\":\"" + COUNTRY_VERSION + "\","
                    + "\"projection\": [{\"field\":\"*\",\"include\":true,\"recursive\":true}],"
                    + "\"query\":{\"field\":\"name\",\"op\":\"$in\",\"values\":[\"United States\",\"Canada\"]}}"));
    assertNoErrors(deleteResponse);
    assertNoDataErrors(deleteResponse);
    assertEquals(2, deleteResponse.getModifiedCount());

    Response findResponse = getLightblueFactory().getMediator().find(createRequest_FromJsonString(
            FindRequest.class,
            "{\"entity\":\"audit\",\"entityVersion\":\"" + AUDIT_VERSION + "\","
                    + "\"query\":{\"field\":\"CRUDOperation\",\"op\":\"$eq\",\"rvalue\":\"DELETE\"},"
                    + "\"projection\": [{\"field\":\"*\",\"include\":true,\"recursive\":true}]}"));
    assertNoErrors(findResponse);
    assertNoDataErrors(findResponse);
    assertEquals(2, findResponse.getMatchCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-audit-hook,代码行数:21,代码来源:ITAuditHook.java

示例12: toJson

import com.redhat.lightblue.Response; //导入依赖的package包/类
/**
 * Returns a JSON representation of this
 */
@Override
public JsonNode toJson() {
    JsonNodeFactory factory = getFactory();
    ObjectNode node = factory.objectNode();
    ArrayNode arr = factory.arrayNode();
    int seq = 0;
    for (Response x : entries) {
        ObjectNode entryNode = factory.objectNode();
        entryNode.set("seq", factory.numberNode(seq++));
        entryNode.set("response", x.toJson());
        arr.add(entryNode);
    }
    node.put("responses", arr);
    return node;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:19,代码来源:BulkResponse.java

示例13: setResultSizeThresholds

import com.redhat.lightblue.Response; //导入依赖的package包/类
/**
 * Bulk result set size threshold is expressed in bytes. This is just an approximation, see @{link {@link JsonUtils#size(JsonNode)} for details.
 *
 * @param maxResultSetSizeB error when this threshold is breached
 * @param warnResultSetSizeB log a warning when this threshold is breached
 * @param forRequest request which resulted in this response, for logging purposes
 */
public void setResultSizeThresholds(int maxResultSetSizeB, int warnResultSetSizeB, BulkRequest forRequest) {

    this.memoryMonitor = new MemoryMonitor<>((response) -> response.getResponseDataSizeB());

    memoryMonitor.registerMonitor(new ThresholdMonitor<Response>(maxResultSetSizeB, (current, threshold, response) -> {
        // remove data
        response.setEntityData(JsonNodeFactory.instance.arrayNode());
        response.getErrors().add(Error.get(Response.ERR_RESULT_SIZE_TOO_LARGE, current+"B > "+threshold+"B"));
    }));

    memoryMonitor.registerMonitor(new ThresholdMonitor<Response>(warnResultSetSizeB, (current, threshold, response) -> {
        LOGGER.warn("crud:ResultSizeIsLarge: request={}, responseDataSizeB={}", forRequest, current);
    }));

}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:23,代码来源:BulkExecutionContext.java

示例14: testDependencies

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void testDependencies() {
    String entityName = "fake";
    String version1 = "1.0.0";
    String version2 = "2.0.0";

    FakeMetadata metadata = new FakeMetadata();

    EntityInfo entityInfo = new EntityInfo(entityName);
    metadata.setEntityInfo(entityInfo);

    assertEquals(entityInfo, metadata.getEntityInfo(entityName));

    Response dependencies = new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
    metadata.setDependencies(entityName, version1, dependencies);

    assertEquals(dependencies, metadata.getDependencies(entityName, version1));
    assertNull(metadata.getDependencies(entityName, version2));
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:20,代码来源:FakeMetadataTest.java

示例15: insertRoleAccessTest

import com.redhat.lightblue.Response; //导入依赖的package包/类
@Test
public void insertRoleAccessTest() throws Exception {
    InsertionRequest req = new InsertionRequest();
    req.setEntityVersion(new EntityVersion("test", "1.0"));
    req.setEntityData(loadJsonNode("./sample1.json"));
    req.setReturnFields(null);
    req.setClientId(new RestClientIdentification(Arrays.asList("test-insert", "test-update")));
    mockCrudController.insertResponse=new CRUDInsertionResponse();
    mockCrudController.insertResponse.setNumInserted(1);
    Response response = mediator.insert(req);

    Assert.assertEquals(OperationStatus.COMPLETE, response.getStatus());
    Assert.assertEquals(1, response.getModifiedCount());
    Assert.assertEquals(0, response.getMatchCount());
    Assert.assertEquals(0, response.getDataErrors().size());
    Assert.assertEquals(0, response.getErrors().size());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:18,代码来源:MediatorTest.java


注:本文中的com.redhat.lightblue.Response类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。