Example usage for org.apache.commons.lang.builder ReflectionToStringBuilder toString

List of usage examples for org.apache.commons.lang.builder ReflectionToStringBuilder toString

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder ReflectionToStringBuilder toString.

Prototype

public static String toString(Object object) 

Source Link

Document

Builds a toString value using the default ToStringStyle through reflection.

Usage

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from w w  w.jav a2 s. c  o m*/
public void testGetAvailableModules() {
    GetAvailableModulesRequestType request = new GetAvailableModulesRequestType();
    request.setSession(getSession());

    ModuleList response = client.getAvailableModules(request).getReturn();
    for (Object element : response.getModules().getAny()) {
        logger.trace("response-getAvailableModules: {}", ReflectionToStringBuilder.toString(element));
    }
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from  w  ww  . j  av a  2  s.c o m*/
public void testSearchByModule() {
    SearchByModuleRequestType request = new SearchByModuleRequestType();
    request.setSession(getSession());
    request.setMaxResults(5);
    request.setAssignedUserId("");
    request.setSearchString("%Doe%");

    ListToSendByCxf<String> modules = new ListToSendByCxf<String>();
    modules.getElements().addAll(Arrays.asList(MODULE, "OTHER"));
    request.setSelectFields(new ListToSendByCxf<String>());
    request.setModules(modules);
    ReturnSearchResult response = client.searchByModule(request).getReturn();

    SearchLinkNameValue searchLinkNameValueList = (SearchLinkNameValue) response.getEntryList().getAny().get(0);
    Assert.assertEquals(5, searchLinkNameValueList.getRecords().getAny().size());
    Array array = (Array) searchLinkNameValueList.getRecords().getAny().get(0);
    Assert.assertNotNull(array.getAny().get(0));
    logger.trace("response-testSearchByModule: {}", ReflectionToStringBuilder.toString(array));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore// w  w  w  . j av  a  2s .c  o m
public void testCreateANewEntry() {
    SetEntryRequestType request = new SetEntryRequestType();
    request.setModuleName(MODULE);
    request.setSession(getSession());

    ListToSendByCxf<NameValue> myList = createDataPerson("Other John");
    request.setNameValueList(myList);
    NewSetEntryResult response = client.setEntry(request).getReturn();

    logger.trace("Response-setEntry: {}", ReflectionToStringBuilder.toString(response));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from w  w  w. j av a2 s .c om*/
public void testCreateMultipleEntries() {
    SetEntriesRequestType request = new SetEntriesRequestType();
    request.setModuleName(MODULE);
    request.setSession(getSession());
    ListToSendByCxf<ListToSendByCxf<NameValue>> nameValuesList = new ListToSendByCxf<ListToSendByCxf<NameValue>>();
    nameValuesList.addElement(createDataPerson("First Joe")).addElement(createDataPerson("Second Joe"))
            .addElement(createDataPerson("Third Joe"));
    request.setNameValueLists(nameValuesList);

    NewSetEntriesResult response = client.setEntries(request).getReturn();
    Assert.assertEquals(3, response.getIds().getAny().size());
    logger.trace("Response-setEntries: {}", ReflectionToStringBuilder.toString(response.getIds()));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from  w  ww  .ja v a2 s.co  m*/
public void testSetRelationShip() {

    SetRelationshipRequestType request = new SetRelationshipRequestType();
    request.setDelete(0);
    request.setLinkFieldName(RELATION_CONTACT_OPPORTUNITY);
    request.setSession(getSession());
    request.setModuleId(CONTACT_ID);
    request.setModuleName(MODULE);
    request.setRelatedIds(OPORTUNITY_ID);

    NewSetRelationshipListResult response = client.setRelationship(request).getReturn();
    Assert.assertEquals(1, response.getCreated());
    logger.trace("Response-setRelationShip: {}", ReflectionToStringBuilder.toString(response));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from  w ww .j  av a2  s  .c om*/
public void testSetRelationShips() {
    SetRelationshipsRequestType request = new SetRelationshipsRequestType();
    request.setModuleIds(new ListToSendByCxf<String>().addElement(CONTACT_ID).addElement(CONTACT_ID));

    request.setRelatedIds(
            new ListToSendByCxf<String>().addElement(OPORTUNITY_ID).addElement(OTHER_OPPORTUNITY_ID));

    request.setLinkFieldNames(new ListToSendByCxf<String>().addElement(RELATION_CONTACT_OPPORTUNITY)
            .addElement(RELATION_CONTACT_OPPORTUNITY));

    request.setModuleNames(new ListToSendByCxf<String>().addElement(MODULE).addElement(MODULE));

    request.setSession(getSession());

    NewSetRelationshipListResult response = client.setRelationships(request).getReturn();

    Assert.assertEquals(2, response.getCreated());
    logger.trace("Response-setRelationShip: {}", ReflectionToStringBuilder.toString(response));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from w w w .j a  v a 2 s . c o m*/
public void testGetEntry() {
    GetEntryRequestType req = new GetEntryRequestType();
    req.setSession(getSession());
    req.setId(CONTACT_ID);
    req.setModuleName(MODULE);
    req.setSelectFields(new ListToSendByCxf<String>().addElement("id").addElement("name"));

    GetEntryResultVersion2 response = client.getEntry(req).getReturn();
    EntryValue entry = (EntryValue) response.getEntryList().getAny().get(0);

    List<Object> nameValues = entry.getNameValueList().getAny();
    NameValue idValue = (NameValue) nameValues.get(0);
    assertEquals(CONTACT_ID, idValue.getValue());

    logger.trace("Response-setRelationShip: {}", ReflectionToStringBuilder.toString(nameValues));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientDriverTestCases.java

@Test
@Ignore/*from  w w  w  . jav a2  s . c  o  m*/
public void testGetRelationShip() {
    GetRelationshipsRequestType request = new GetRelationshipsRequestType();
    request.setSession(getSession());
    request.setRelatedModuleQuery("");
    request.setModuleName(MODULE);
    request.setModuleId(CONTACT_ID);
    request.setLinkFieldName(RELATION_CONTACT_OPPORTUNITY);
    request.setDeleted(0);
    SelectFields fields = new SelectFields();
    fields.setArrayType("");
    fields.getAny().add(newField(""));

    request.setRelatedFields(fields);
    GetEntryResultVersion2 response = client.getRelationships(request).getReturn();
    logger.trace("Response-setRelationShip: {}", ReflectionToStringBuilder.toString(response));
}

From source file:org.mule.modules.sugarcrm.automation.system.SugarCrmClientLoginTestCases.java

@Test
@Ignore/*  w w w . ja  va2  s .c  om*/
public void shouldLoggedCorrectly() {
    LoginRequestType request = createRequestLogin(username, password);
    EntryValue response = client.login(request).getReturn();
    Assert.assertNotNull(response);
    Assert.assertNotNull(response.getId());
    Assert.assertFalse("".equals(response.getId()));

    logger.trace("response-login: {}", ReflectionToStringBuilder.toString(response));
}

From source file:org.onehippo.forge.content.pojo.mapper.jcr.DefaultJcrContentNodeMapperTest.java

private void assertDocumentVariantContentNode(ContentNode varContentNode, String state)
        throws RepositoryException {
    log.debug("===== varContentNode: {}", ReflectionToStringBuilder.toString(varContentNode));

    for (ContentProperty contentProp : varContentNode.getProperties()) {
        log.debug("----- contentProp: {}", ReflectionToStringBuilder.toString(contentProp));
    }// w  w w  .ja  va 2  s  .c  o m

    if (HippoStdNodeType.PUBLISHED.equals(state)) {
        assertEquals(HippoStdNodeType.PUBLISHED,
                varContentNode.getProperty(HippoStdNodeType.HIPPOSTD_STATE).getValue());
        assertTrue(varContentNode.getProperty(HippoNodeType.HIPPO_AVAILABILITY).getValues().contains("live"));
        assertTrue(
                varContentNode.getProperty(HippoNodeType.HIPPO_AVAILABILITY).getValues().contains("preview"));
        assertEquals("live", varContentNode.getProperty(HippoStdNodeType.HIPPOSTD_STATESUMMARY).getValue());
    } else if (HippoStdNodeType.UNPUBLISHED.equals(state)) {
        assertEquals(HippoStdNodeType.UNPUBLISHED,
                varContentNode.getProperty(HippoStdNodeType.HIPPOSTD_STATE).getValue());
        assertFalse(varContentNode.getProperty(HippoNodeType.HIPPO_AVAILABILITY).getValues().contains("live"));
        assertTrue(
                varContentNode.getProperty(HippoNodeType.HIPPO_AVAILABILITY).getValues().contains("preview"));
        assertEquals("changed", varContentNode.getProperty(HippoStdNodeType.HIPPOSTD_STATESUMMARY).getValue());
    }

    assertEquals(NEWS_NODE_TYPE, varContentNode.getPrimaryType());
    assertEquals(DOC_VARIANT_NODE_MIXIN_TYPES, varContentNode.getMixinTypes());

    assertEquals(NEWS_TITLE_PROP_VALUE, varContentNode.getProperty(NEWS_TITLE_PROP_NAME).getValue());
    assertEquals(NEWS_DATE_PROP_STRING_VALUE, varContentNode.getProperty(NEWS_DATE_PROP_NAME).getValue());
    assertEquals(NEWS_SUMMARY_PROP_VALUE, varContentNode.getProperty(NEWS_SUMMARY_PROP_NAME).getValue());

    ContentNode bodyContentNode = varContentNode.getNode(NEWS_BODY_NODE_NAME);
    assertNotNull(bodyContentNode);
    log.debug("bodyContentNode: {}", ReflectionToStringBuilder.toString(bodyContentNode));

    assertEquals("hippostd:html", bodyContentNode.getPrimaryType());
    assertEquals(NEWS_BODY_CONTENT_VALUE,
            bodyContentNode.getProperty(HippoStdNodeType.HIPPOSTD_CONTENT).getValue());

    ContentNode imageLinkContentNode = varContentNode.getNode(NEWS_IMAGE_LINK_NODE_NAME);
    assertNotNull(imageLinkContentNode);
    log.debug("imageLinkContentNode: {}", ReflectionToStringBuilder.toString(imageLinkContentNode));

    assertEquals("hippogallerypicker:imagelink", imageLinkContentNode.getPrimaryType());
    Node newsImageSetHandleNode = getRootNode()
            .getNode(StringUtils.removeStart(NEWS1_IMAGE_SET_HANDLE_PATH, "/"));
    assertEquals(newsImageSetHandleNode.getIdentifier(),
            imageLinkContentNode.getProperty(HippoNodeType.HIPPO_DOCBASE).getValue());
}