summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java
diff options
context:
space:
mode:
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());