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


Java Response.getEntityData方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: test_self_ref_array_contains

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void test_self_ref_array_contains() throws Exception {
    FindRequest fr=new FindRequest();
    fr.setQuery(query("{'field':'_id','op':'!=','rvalue':''}"));
    fr.setProjection(projection("[{'field':'*','recursive':true},{'field':'test_reference'}]"));
    fr.setEntityVersion(new EntityVersion("self_ref_array_contains","0.0.1-SNAPSHOT"));
    Response response=mediator.find(fr);
    System.out.println(response.getEntityData());
    // Every doc should have all the others in reference
    for(JsonNode doc:response.getEntityData()) {
        String id=doc.get("_id").asText();
        Assert.assertEquals(3,doc.get("test_reference").size());
        for(Iterator<JsonNode> itr=doc.get("test_reference").elements();itr.hasNext();) {
            JsonNode node=itr.next();
            Assert.assertTrue(!id.equals(node.get("_id")));
        }
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:19,代码来源:CompositeFinderTest.java

示例8: test_self_ref_array_not_contains

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void test_self_ref_array_not_contains() throws Exception {
    FindRequest fr=new FindRequest();
    fr.setQuery(query("{'field':'_id','op':'!=','rvalue':''}"));
    fr.setProjection(projection("[{'field':'*','recursive':true},{'field':'test_reference'}]"));
    fr.setEntityVersion(new EntityVersion("self_ref_array_not_contains","0.0.1-SNAPSHOT"));
    Response response=mediator.find(fr);
    System.out.println(response.getEntityData());
    for(JsonNode doc:response.getEntityData()) {
        String id=doc.get("_id").asText();
        if("Q".equals(id)) {
            Assert.assertEquals(2,doc.get("test_reference").size());
            Assert.assertTrue("ST".indexOf(doc.get("test_reference").get(0).get("_id").asText())!=-1);
            Assert.assertTrue("ST".indexOf(doc.get("test_reference").get(1).get("_id").asText())!=-1);
        } else if("R".equals(id)) {
            Assert.assertEquals(2,doc.get("test_reference").size());
            Assert.assertTrue("ST".indexOf(doc.get("test_reference").get(0).get("_id").asText())!=-1);
            Assert.assertTrue("ST".indexOf(doc.get("test_reference").get(1).get("_id").asText())!=-1);
        } else if("S".equals(id)) {
            Assert.assertEquals(1,doc.get("test_reference").size());
            Assert.assertEquals("T",doc.get("test_reference").get(0).get("_id").asText());
        } else {
            Assert.assertNull(doc.get("test_reference"));
        }
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:27,代码来源:CompositeFinderTest.java

示例9: testInsertThenFindField

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void testInsertThenFindField() throws Exception {
    String insert = AbstractJsonNodeTest.loadResource("./crud/insert/datatype-insert-template.json")
            .replaceFirst("#cn", cn)
            .replaceFirst("#field", fieldName)
            .replaceFirst("#fielddata", data);

    Response insertResponse = getLightblueFactory().getMediator().insert(
            createRequest_FromJsonString(InsertionRequest.class, insert));

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

    String find = AbstractJsonNodeTest.loadResource("./crud/find/datatype-find-template.json")
            .replaceFirst("#cn", cn)
            .replaceFirst("#field", fieldName);

    Response findResponse = getLightblueFactory().getMediator().find(
            createRequest_FromJsonString(FindRequest.class, find));

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

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

    JSONAssert.assertEquals(
            "[{\"" + fieldName + "\":\"" + data + "\"}]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:35,代码来源:ITCaseLdapCRUDController_DataType_Test.java

示例10: testInsertMany

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

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

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "["
                + "{" + generatePersonDnJson("junior.doe") + "},"
                + "{" + generatePersonDnJson("john.doe") + "},"
                + "{" + generatePersonDnJson("jane.doe") + "},"
                + "{" + generatePersonDnJson("jack.buck") + "}"
            + "]",
            entityData.toString(), false);

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

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

示例11: testSave_SetValue

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
/**
 * optional does not exist on the original record, ensure that it has been added.
 */
@Test
public void testSave_SetValue() throws Exception {
    String optionalValue = "modified value";

    //Setup
    assertValidResponse(getLightblueFactory().getMediator().insert(
            createRequest_FromResource(InsertionRequest.class, "./crud/insert/person-insert-single.json")));

    //Test
    String uid = "john.doe";
    String cn = "John Doe";
    String save = AbstractJsonNodeTest.loadResource("./crud/save/person-save-single-template.json")
            .replaceFirst("#uid", uid)
            .replaceFirst("#givenName", "John")
            .replaceFirst("#sn", "Doe")
            .replaceFirst("#cn", cn)
            .replaceFirst("#upsert", "false")
            .replaceFirst("#optional", ",\"optional\": \"" + optionalValue + "\"");
    Response response = getLightblueFactory().getMediator().save(
            createRequest_FromJsonString(SaveRequest.class, save));

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

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{" + generatePersonDnJson(uid) + "}]",
            entityData.toString(), false);

    //Ensure optional value was changed
    assertPersonEntryValues(uid, cn, optionalValue);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:38,代码来源:ITCaseLdapCRUDControllerTest.java

示例12: testSave_UpsertTrue

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
/**
 * entry is not inserted before upsert, make sure entry is created.
 */
@Test
public void testSave_UpsertTrue() throws Exception {
    String uid = "john.doe";
    String cn = "John Doe";

    //Test
    String save = AbstractJsonNodeTest.loadResource("./crud/save/person-save-single-template.json")
            .replaceFirst("#uid", uid)
            .replaceFirst("#givenName", "John")
            .replaceFirst("#sn", "Doe")
            .replaceFirst("#cn", cn)
            .replaceFirst("#upsert", "true")
            .replaceFirst("#optional", "");
    Response response = getLightblueFactory().getMediator().save(
            createRequest_FromJsonString(SaveRequest.class, save));

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

    JsonNode entityData = response.getEntityData();
    JSONAssert.assertEquals(
            "[{" + generatePersonDnJson(uid) + "}]",
            entityData.toString(), false);

    //Ensure optional value was changed
    assertPersonEntryValues(uid, cn, null);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:31,代码来源:ITCaseLdapCRUDControllerTest.java

示例13: testInsertWithRoles

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void testInsertWithRoles() throws Exception {
    //Setup
    String insert = AbstractJsonNodeTest.loadResource("./crud/insert/department-insert-template.json")
            .replaceFirst("#cn", "Marketing")
            .replaceFirst("#description", "Department devoted to Marketing")
            .replaceFirst("#members",
                    "cn=John Doe," + BASEDB_USERS + "\",\"cn=Jane Doe," + BASEDB_USERS);

    InsertionRequest insertRequest = createRequest_FromJsonString(InsertionRequest.class, insert);
    insertRequest.setClientId(new FakeClientIdentification("fakeUser", "admin"));

    //Test
    Response response = getLightblueFactory().getMediator().insert(insertRequest);

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

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"dn\":\"cn=Marketing," + BASEDB_DEPARTMENTS + "\"}]",
            entityData.toString(), true);

    //Ensure entry was inserted
    FindRequest findRequest = createRequest_FromResource(FindRequest.class, "./crud/find/department-find.json");
    findRequest.setClientId(new FakeClientIdentification("admin"));

    Response findResponse = getLightblueFactory().getMediator().find(findRequest);

    assertValidResponse(findResponse);
    assertEquals(1, findResponse.getMatchCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:34,代码来源:ITCaseLdapCRUDControllerTest.java

示例14: testFindWithRoles

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void testFindWithRoles() throws Exception {
    //Setup
    String insert = AbstractJsonNodeTest.loadResource("./crud/insert/department-insert-template.json")
            .replaceFirst("#cn", "Marketing")
            .replaceFirst("#description", "Department devoted to Marketing")
            .replaceFirst("#members",
                    "cn=John Doe," + BASEDB_USERS + "\",\"cn=Jane Doe," + BASEDB_USERS);

    InsertionRequest insertRequest = createRequest_FromJsonString(InsertionRequest.class, insert);
    insertRequest.setClientId(new FakeClientIdentification("fakeUser", "admin"));

    assertValidResponse(getLightblueFactory().getMediator().insert(insertRequest));

    //Test
    FindRequest findRequest = createRequest_FromResource(FindRequest.class, "./crud/find/department-find.json");
    findRequest.setClientId(new FakeClientIdentification("fakeUser", "admin"));

    Response response = getLightblueFactory().getMediator().find(findRequest);

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

    JsonNode entityData = response.getEntityData();
    assertNotNull(entityData);
    JSONAssert.assertEquals(
            "[{\"member#\":2,\"member\":[\"cn=John Doe," + BASEDB_USERS + "\",\"cn=Jane Doe," + BASEDB_USERS + "\"],\"cn\":\"Marketing\",\"description\":\"Department devoted to Marketing\"}]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:30,代码来源:ITCaseLdapCRUDControllerTest.java

示例15: testFindWithInsufficientRoles

import com.redhat.lightblue.Response; //导入方法依赖的package包/类
@Test
public void testFindWithInsufficientRoles() throws Exception {
    //Setup
    String insert = AbstractJsonNodeTest.loadResource("./crud/insert/department-insert-template.json")
            .replaceFirst("#cn", "Marketing")
            .replaceFirst("#description", "Department devoted to Marketing")
            .replaceFirst("#members",
                    "cn=John Doe," + BASEDB_USERS + "\",\"cn=Jane Doe," + BASEDB_USERS);

    InsertionRequest insertRequest = createRequest_FromJsonString(InsertionRequest.class, insert);
    insertRequest.setClientId(new FakeClientIdentification("fakeUser", "admin"));

    assertValidResponse(getLightblueFactory().getMediator().insert(insertRequest));

    //Test
    FindRequest findRequest = createRequest_FromResource(FindRequest.class, "./crud/find/department-find.json");
    findRequest.setClientId(new FakeClientIdentification("fakeUser"));

    Response response = getLightblueFactory().getMediator().find(findRequest);

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

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

    JSONAssert.assertEquals(
            "[{\"cn\":\"Marketing\",\"description\":\"Department devoted to Marketing\"}]",
            entityData.toString(), true);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:32,代码来源:ITCaseLdapCRUDControllerTest.java


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