Example usage for org.apache.commons.lang.builder ToStringBuilder reflectionToString

List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString

Introduction

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

Prototype

public static String reflectionToString(Object object) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:org.springframework.http.converter.obm.MessagePackHttpMessageConverterTest.java

@Test
public void testSimpleIntegration() throws Throwable {
    RestIntegrationTestUtils.startServiceAndConnect(MyService.class,
            new RestIntegrationTestUtils.ServerExecutionCallback() {
                @Override//  ww  w .j av  a 2 s  .com
                public void doWithServer(RestTemplate clientRestTemplate, Server server) throws Throwable {

                    Assert.assertNotNull(clientRestTemplate);

                    int id = 344;
                    Map<String, Object> mapOfVars = new HashMap<String, Object>();
                    mapOfVars.put("cat", id);

                    Cat customer = clientRestTemplate
                            .getForEntity("http://localhost:8080/ws/cats/{cat}", Cat.class, mapOfVars)
                            .getBody();
                    Assert.assertTrue(customer.getId() == id);
                    Assert.assertNotNull(customer.getName());

                    if (log.isDebugEnabled()) {
                        log.debug("response payload: " + ToStringBuilder.reflectionToString(customer));
                    }

                }
            });

}

From source file:org.springframework.http.converter.obm.ThriftHttpMessageConverterTest.java

@Test
public void testSimpleIntegration() throws Throwable {
    RestIntegrationTestUtils.startServiceAndConnect(MyService.class,
            new RestIntegrationTestUtils.ServerExecutionCallback() {
                @Override//from   w w w.  ja  va2s .c  om
                public void doWithServer(RestTemplate clientRestTemplate, Server server) throws Throwable {

                    Assert.assertNotNull(clientRestTemplate);

                    Map<String, Object> mapOfVars = new HashMap<String, Object>();
                    mapOfVars.put("customerId", 3);

                    Customer customer = clientRestTemplate
                            .getForEntity("http://localhost:8080/ws/customers/{customerId}", Customer.class,
                                    mapOfVars)
                            .getBody();
                    Assert.assertNotNull(customer.getFirstName());
                    Assert.assertNotNull(customer.getLastName());
                    Assert.assertNotNull(customer.getEmail());

                    if (log.isDebugEnabled()) {
                        log.debug("response payload: " + ToStringBuilder.reflectionToString(customer));
                    }
                }
            });
}

From source file:org.springframework.remoting.avro.TestServiceExportAndConsumption.java

@Test
public void testCreatingAServer() throws Throwable {

    MyCrm crmImpl = new MyCrm();

    avroExporter = new AvroExporter();
    avroExporter.setService(crmImpl);/* www  .ja v a  2s.c  om*/
    avroExporter.setServiceInterface(Crm.class);
    avroExporter.setServerCreationCallback(serverCreationCallback);
    avroExporter.setBeanClassLoader(ClassUtils.getDefaultClassLoader());
    avroExporter.afterPropertiesSet();
    avroExporter.start();

    AvroProxyFactoryBean<Crm> proxyFactoryBean = new AvroProxyFactoryBean<Crm>();
    proxyFactoryBean.setServiceInterface(Crm.class);
    proxyFactoryBean.setTransceiverCreationCallback(transceiverCreationCallback);
    proxyFactoryBean.afterPropertiesSet();
    Crm crmClient = proxyFactoryBean.getObject();
    Customer customer = crmClient.createCustomer("Josh", "Long", "email@email.com");
    if (log.isDebugEnabled()) {
        log.debug("received result " + ToStringBuilder.reflectionToString(customer));
    }
    Assert.assertNotNull(customer);
}

From source file:org.springframework.remoting.thrift.TestThriftServiceExporter.java

@Test
public void testCreateCustomerOnRpcClient() throws Throwable {

    String fn = "fn", ln = "ln", email = "email@email.com";

    ApplicationContext clientContext = new AnnotationConfigApplicationContext(
            ThriftProxyClientConfiguration.class);
    Crm.Iface clientCrm = clientContext.getBean(Crm.Iface.class);

    Customer customer = clientCrm.createCustomer(fn, ln, email);

    if (log.isDebugEnabled()) {
        log.debug("the response from the server is " + ToStringBuilder.reflectionToString(customer));
    }//from   w w  w.j av a  2 s .c  o m

    Assert.assertNotNull(customer);
    Assert.assertEquals(customer.getFirstName(), fn);
    Assert.assertEquals(customer.getLastName(), ln);
    Assert.assertEquals(customer.getEmail(), email);
    Assert.assertTrue(customer.getId() > 0);
}

From source file:org.springsource.greenbeans.examples.edawithspring.shipping.ShippingRequestServiceEndpoint.java

@ServiceActivator
public PurchaseProcessingResponse handleRequest(PurchaseProcessingRequest processingRequest) throws Exception {
    log.info("Received request for " + ToStringBuilder.reflectionToString(processingRequest));
    return new PurchaseProcessingResponse(processingRequest.getCustomerId(), processingRequest.getPurchaseId(),
            new Date());
}

From source file:org.sventon.model.FileRevision.java

@Override
public String toString() {
    return super.toString() + " " + ToStringBuilder.reflectionToString(this);
}

From source file:org.up4j.APITest.java

/**
 * Test of getFriends method, of class API.
 *//*ww  w  .  j  a v a2s.c o  m*/
@Test
public void testGetFriends_0args() throws Exception {
    System.out.println("getFriends");
    List<User> friends = api.getFriends();
    assertNotNull(friends);
    for (User user : friends) {
        System.out.println(ToStringBuilder.reflectionToString(user));
    }
}

From source file:org.up4j.APITest.java

/**
 * Test of getFriends method, of class API.
 *///  w w  w.  j av a  2  s .  c om
@Test
public void testGetFriends_String() throws Exception {
    System.out.println("getFriends");
    List<User> friends = api.getFriends(authenticationResponse.getUserSettings().getXid());
    assertNotNull(friends);
    for (User user : friends) {
        System.out.println(ToStringBuilder.reflectionToString(user));
    }
}

From source file:org.up4j.APITest.java

/**
 * Test of getScore method, of class API.
 *//* www  .j  a  v a2 s .c  o m*/
@Test
public void testGetScore_0args() throws Exception {
    System.out.println("getScore");
    Score score = api.getScore();
    assertNotNull(score);
    System.out.println(ToStringBuilder.reflectionToString(score));
}

From source file:org.up4j.APITest.java

/**
 * Test of getScore method, of class API.
 *///from   www .j a  va 2 s . c o m
@Test
public void testGetScore_String() throws Exception {
    System.out.println("getScore");
    Score score = api.getScore(authenticationResponse.getUserSettings().getXid());
    assertNotNull(score);
    System.out.println(ToStringBuilder.reflectionToString(score));

}