summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-05-19 00:53:52 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-05-19 00:53:52 +0000
commitd683dc4b30c79348b5e73f0f11b1cfd8ce4b9812 (patch)
tree3b64741b708c3e13a6a301f7df21bec070547bfc /sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java
parenta0bfd24b7af22df3174e1c1e4e6d2eb913f41d2f (diff)
Merge branch 'jaxrs' into trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@945980 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java')
-rw-r--r--sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java4
-rw-r--r--sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java11
2 files changed, 14 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java
index 625a91c45a..23b674778e 100644
--- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java
+++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java
@@ -19,10 +19,14 @@
package org.apache.tuscany.sca.interfacedef.java.jaxrs;
+import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
@Path("myURI")
+@Produces({"application/xml", "application/json"})
+@Consumes({"application/xml", "application/json"})
public class ResourceWrapper implements Resource {
public static Resource delegate;
diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java
index cef9fcf90e..aa6abcd5f6 100644
--- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java
+++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java
@@ -22,7 +22,9 @@ package org.apache.tuscany.sca.interfacedef.java.jaxrs;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
import org.junit.Assert;
import org.junit.Test;
@@ -33,10 +35,17 @@ import org.junit.Test;
public class RootResourceClassGeneratorTestCase {
@Test
public void testGenerator() throws Exception {
- Class<?> cls = RootResourceClassGenerator.generateRootResourceClass(Resource.class, "myURI");
+ Class<?> cls = RootResourceClassGenerator.generateRootResourceClass(Resource.class, "myURI", "application/xml,application/json", "application/xml,application/json");
Assert.assertTrue(cls.isAnnotationPresent(Path.class));
Path path = cls.getAnnotation(Path.class);
Assert.assertEquals("myURI", path.value());
+
+ Produces produces = cls.getAnnotation(Produces.class);
+ Assert.assertEquals("application/xml", produces.value()[0]);
+
+ Consumes consumes = cls.getAnnotation(Consumes.class);
+ Assert.assertEquals("application/json", consumes.value()[1]);
+
Field field = cls.getField("delegate");
Assert.assertSame(Resource.class, field.getType());