Skip to content

Commit

Permalink
more tests, lots of polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Long committed Aug 27, 2011
1 parent 1d5bfe4 commit 0163a3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
Expand Up @@ -30,7 +30,6 @@
import org.springframework.obm.Marshaller;
import org.springframework.obm.messagepack.Cat;
import org.springframework.obm.messagepack.MessagePackMarshaller;
import org.springframework.obm.thrift.ThriftMarshaller;
import org.springframework.stereotype.Controller;
import org.springframework.util.IntegrationTestUtils;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -48,8 +47,8 @@
*/
public class MessagePackHttpMessageConverterTest extends BaseMarshallingHttpMessageConverterTest {

static MediaType MEDIA_TYPE = new MediaType("application", "x-msgpack") ;
private Log log = LogFactory.getLog(getClass()) ;
static MediaType MEDIA_TYPE = new MediaType("application", "x-msgpack");
private Log log = LogFactory.getLog(getClass());
private Cat cat = new Cat();

@Before
Expand All @@ -75,7 +74,7 @@ public void testHttpReading() throws Throwable {

@Test
public void testSimpleIntegration() throws Throwable {
IntegrationTestUtils.startServiceAndConnect(MyService.class , new IntegrationTestUtils.ServerExecutionCallback(){
IntegrationTestUtils.startServiceAndConnect(MyService.class, new IntegrationTestUtils.ServerExecutionCallback() {
@Override
public void doWithServer(RestTemplate clientRestTemplate, Server server) throws Throwable {

Expand All @@ -102,7 +101,7 @@ public void doWithServer(RestTemplate clientRestTemplate, Server server) throws
@EnableWebMvc
static public class MyService extends IntegrationTestUtils.AbstractRestServiceConfiguration {
@Bean
public CatController controller() {
public CatController controller() {
return new CatController();
}

Expand All @@ -123,8 +122,8 @@ public MediaType getMediaType() {
public static class CatController {
@RequestMapping(value = "/cats/{id}", method = RequestMethod.GET)
@ResponseBody
public Cat customer(@PathVariable("id") int id) {
return new Cat(Math.random() > .5 ? "Felix" :"Garfield",id);
public Cat customer(@PathVariable("id") int id) {
return new Cat(Math.random() > .5 ? "Felix" : "Garfield", id);
}
}
}
Expand Down
@@ -1,34 +1,13 @@
package org.springframework.http.converter.obm;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mortbay.jetty.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.obm.support.BaseMarshallingHttpMessageConverterTest;
import org.springframework.util.IntegrationTestUtils;
import org.springframework.obm.Marshaller;
import org.springframework.obm.protocolbuffers.ProtocolBuffersMarshaller;
import org.springframework.obm.protocolbuffers.crm.Crm;
import org.springframework.obm.thrift.ThriftCrmService;
import org.springframework.obm.thrift.ThriftMarshaller;
import org.springframework.obm.thrift.crm.Customer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;

/**
* Simple test of the Google Protocols marshaller with {@link org.springframework.http.converter.HttpMessageConverter}
Expand Down
Expand Up @@ -15,11 +15,11 @@
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.IntegrationTestUtils;
import org.springframework.obm.thrift.crm.Crm;
import org.springframework.obm.thrift.crm.Customer;
import org.springframework.util.DispatcherServletJettyConfigurationCallback;
import org.springframework.util.EndpointTestUtils;
import org.springframework.util.IntegrationTestUtils;
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;

import java.util.Arrays;
Expand All @@ -40,7 +40,7 @@ public class TestThriftServiceExporter {

private Server jettyServer;

@Before
@Before
public void before() throws Throwable {
jettyServer = EndpointTestUtils.serve(new DispatcherServletJettyConfigurationCallback(ExporterConfiguration.class));
jettyServer.start();
Expand Down Expand Up @@ -80,7 +80,6 @@ public void testCreateCustomerOnRpcClient() throws Throwable {
}



}

/**
Expand Down

0 comments on commit 0163a3b

Please sign in to comment.