[issue 461] Fixed compilation failures in tests. Same cause as e788f76411

This commit is contained in:
Andrew Phillips 2011-12-21 21:14:03 -05:00
parent e788f76411
commit 7cc67a675e
2 changed files with 10 additions and 5 deletions

View File

@ -54,7 +54,8 @@ public class BindMapToStringPayloadTest {
@Test @Test
public void testCorrect() throws SecurityException, NoSuchMethodException { public void testCorrect() throws SecurityException, NoSuchMethodException {
Method testPayload = TestPayload.class.getMethod("testPayload", String.class); Method testPayload = TestPayload.class.getMethod("testPayload", String.class);
GeneratedHttpRequest<TestPayload> request = GeneratedHttpRequest.<TestPayload> builder() // can't use GHR.builder() - see http://code.google.com/p/jclouds/issues/detail?id=461
GeneratedHttpRequest<TestPayload> request = new GeneratedHttpRequest.Builder<TestPayload>()
.declaring(TestPayload.class).javaMethod(testPayload).args(ImmutableList.<Object> of("robot")) .declaring(TestPayload.class).javaMethod(testPayload).args(ImmutableList.<Object> of("robot"))
.method(HttpMethod.POST).endpoint(URI.create("http://localhost")).build(); .method(HttpMethod.POST).endpoint(URI.create("http://localhost")).build();
@ -68,7 +69,8 @@ public class BindMapToStringPayloadTest {
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testMustHavePayloadAnnotation() throws SecurityException, NoSuchMethodException { public void testMustHavePayloadAnnotation() throws SecurityException, NoSuchMethodException {
Method noPayload = TestPayload.class.getMethod("noPayload", String.class); Method noPayload = TestPayload.class.getMethod("noPayload", String.class);
GeneratedHttpRequest<TestPayload> request = GeneratedHttpRequest.<TestPayload> builder() // can't use GHR.builder() - see http://code.google.com/p/jclouds/issues/detail?id=461
GeneratedHttpRequest<TestPayload> request = new GeneratedHttpRequest.Builder<TestPayload>()
.declaring(TestPayload.class).javaMethod(noPayload).args(ImmutableList.<Object> of("robot")) .declaring(TestPayload.class).javaMethod(noPayload).args(ImmutableList.<Object> of("robot"))
.method(HttpMethod.POST).endpoint(URI.create("http://localhost")).build(); .method(HttpMethod.POST).endpoint(URI.create("http://localhost")).build();
binder().bindToRequest(request, ImmutableMap.of("fooble", "robot")); binder().bindToRequest(request, ImmutableMap.of("fooble", "robot"));

View File

@ -1816,7 +1816,8 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
public void oneTransformerWithContext() throws SecurityException, NoSuchMethodException { public void oneTransformerWithContext() throws SecurityException, NoSuchMethodException {
RestAnnotationProcessor<TestTransformers> processor = factory(TestTransformers.class); RestAnnotationProcessor<TestTransformers> processor = factory(TestTransformers.class);
Method method = TestTransformers.class.getMethod("oneTransformerWithContext"); Method method = TestTransformers.class.getMethod("oneTransformerWithContext");
GeneratedHttpRequest<TestTransformers> request = GeneratedHttpRequest.<TestTransformers> builder().method("GET") // can't use GHR.builder() - see http://code.google.com/p/jclouds/issues/detail?id=461
GeneratedHttpRequest<TestTransformers> request = new GeneratedHttpRequest.Builder<TestTransformers>().method("GET")
.endpoint(URI.create("http://localhost")).declaring(TestTransformers.class).javaMethod(method) .endpoint(URI.create("http://localhost")).declaring(TestTransformers.class).javaMethod(method)
.args(new Object[] {}).build(); .args(new Object[] {}).build();
Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request); Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request);
@ -2348,7 +2349,8 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
public void testCreateJAXBResponseParserWithAnnotation() throws SecurityException, NoSuchMethodException { public void testCreateJAXBResponseParserWithAnnotation() throws SecurityException, NoSuchMethodException {
RestAnnotationProcessor<TestJAXBResponseParser> processor = factory(TestJAXBResponseParser.class); RestAnnotationProcessor<TestJAXBResponseParser> processor = factory(TestJAXBResponseParser.class);
Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAnnotation"); Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAnnotation");
GeneratedHttpRequest<TestJAXBResponseParser> request = GeneratedHttpRequest.<TestJAXBResponseParser> builder() // can't use GHR.builder() - see http://code.google.com/p/jclouds/issues/detail?id=461
GeneratedHttpRequest<TestJAXBResponseParser> request = new GeneratedHttpRequest.Builder<TestJAXBResponseParser>()
.method("GET").endpoint(URI.create("http://localhost")).declaring(TestJAXBResponseParser.class) .method("GET").endpoint(URI.create("http://localhost")).declaring(TestJAXBResponseParser.class)
.javaMethod(method).args(new Object[] {}).build(); .javaMethod(method).args(new Object[] {}).build();
Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request); Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request);
@ -2359,7 +2361,8 @@ public class RestAnnotationProcessorTest extends BaseRestClientTest {
public void testCreateJAXBResponseParserWithAcceptHeader() throws SecurityException, NoSuchMethodException { public void testCreateJAXBResponseParserWithAcceptHeader() throws SecurityException, NoSuchMethodException {
RestAnnotationProcessor<TestJAXBResponseParser> processor = factory(TestJAXBResponseParser.class); RestAnnotationProcessor<TestJAXBResponseParser> processor = factory(TestJAXBResponseParser.class);
Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAcceptHeader"); Method method = TestJAXBResponseParser.class.getMethod("jaxbGetWithAcceptHeader");
GeneratedHttpRequest<TestJAXBResponseParser> request = GeneratedHttpRequest.<TestJAXBResponseParser> builder() // can't use GHR.builder() - see http://code.google.com/p/jclouds/issues/detail?id=461
GeneratedHttpRequest<TestJAXBResponseParser> request = new GeneratedHttpRequest.Builder<TestJAXBResponseParser>()
.method("GET").endpoint(URI.create("http://localhost")).declaring(TestJAXBResponseParser.class) .method("GET").endpoint(URI.create("http://localhost")).declaring(TestJAXBResponseParser.class)
.javaMethod(method).args(new Object[] {}).build(); .javaMethod(method).args(new Object[] {}).build();
Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request); Function<HttpResponse, ?> transformer = processor.createResponseParser(method, request);