Author: heiko.braun(a)jboss.com
Date: 2007-11-06 08:26:34 -0500 (Tue, 06 Nov 2007)
New Revision: 4994
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/DeploymentDescriptorParser.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
stack/native/branches/rest/src/main/resources/schema/jbossrs.xsd
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java
Log:
Deployment descriptor model and parser, first cut
Modified:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java
===================================================================
---
stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java 2007-11-06
10:53:12 UTC (rev 4993)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/media/EntityProviderRegistry.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -25,28 +25,37 @@
import javax.activation.MimeType;
import java.util.List;
import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
/**
+ * Register {@link javax.ws.rs.ext.EntityProvider} for MimeTypes
+ *
* @author Heiko.Braun(a)jboss.com
* @version $Revision$
*/
public class EntityProviderRegistry
{
- private List<EntityProvider> providers = new ArrayList<EntityProvider>();
+
+ private Map<MimeType, List<EntityProvider>> providers = new
HashMap<MimeType, List<EntityProvider>>();
- public void addProvider(EntityProvider provider)
+ public void addProvider(EntityProvider provider, MimeType... mimeTypes)
{
- providers.add(provider);
+ for(MimeType m : mimeTypes)
+ {
+ if(null == providers.get(m))
+ providers.put(m, new ArrayList<EntityProvider>());
+
+ providers.get(m).add(provider);
+ }
}
- public EntityProvider getProviderByMime(MimeType mime)
+ public List<EntityProvider> getProviders(MimeType mime)
{
- EntityProvider match = null;
+ List<EntityProvider> match = new ArrayList<EntityProvider>();
- for(EntityProvider p : providers)
- {
- //
- }
+ if(providers.get(mime)!=null)
+ match = providers.get(mime);
return match;
}
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.rs.media;
+
+import javax.ws.rs.ext.EntityProvider;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * TODO: Cache JAXBContext for better performance
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class JAXBEntityProvider implements EntityProvider
+{
+
+ /**
+ * Supports classes annotated with @XmlRootElement or JAXBElement's that wrap this
infomration.
+ * @param aClass
+ * @return
+ */
+ public boolean supports(Class aClass)
+ {
+ return aClass.isAnnotationPresent(XmlRootElement.class) || (JAXBElement.class ==
aClass);
+ }
+
+ public Object readFrom(Class aClass, MediaType mediaType, MultivaluedMap
multivaluedMap, InputStream inputStream) throws IOException
+ {
+ Object result = null;
+ try
+ {
+ JAXBContext context = JAXBContext.newInstance(aClass);
+ result = context.createUnmarshaller().unmarshal(inputStream);
+ }
+ catch (JAXBException e)
+ {
+ throw new IOException("Unmarshalling failed: " + e.getMessage());
+ }
+
+ return result;
+
+ }
+
+ public void writeTo(Object o, MediaType mediaType, MultivaluedMap multivaluedMap,
OutputStream outputStream) throws IOException
+ {
+ try
+ {
+ JAXBContext context = JAXBContext.newInstance(o.getClass());
+ context.createMarshaller().marshal(o, outputStream);
+ }
+ catch (JAXBException e)
+ {
+ throw new IOException("Marshalling failed: " + e.getMessage());
+ }
+ }
+}
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/media/JAXBEntityProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/DeploymentDescriptorParser.java
===================================================================
---
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/DeploymentDescriptorParser.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/DeploymentDescriptorParser.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.rs.model.dd;
+
+import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Ddeployment descriptor parser
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class DeploymentDescriptorParser
+{
+ public static JbossrsType read(InputStream inputStream)
+ throws IOException
+ {
+ try
+ {
+ JAXBContextImpl jc = (JAXBContextImpl) JAXBContext.newInstance(
"org.jboss.rs.model.dd" );
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+ JAXBElement element = ( JAXBElement ) unmarshaller.unmarshal( inputStream );
+ return ( JbossrsType) element.getValue();
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException("Failed to unmarshall deployment
descriptor", e);
+ }
+ }
+
+ public static void write(JbossrsType dd, OutputStream outputStream)
+ throws IOException
+ {
+ try
+ {
+ JAXBContext jaxb = JAXBContext.newInstance(JbossrsType.class);
+ JAXBElement wrapper = new JAXBElement(new
QName("http://org.jboss.rs/", "jbossrs"), JbossrsType.class, dd);
+ Marshaller marshaller = jaxb.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ marshaller.marshal(wrapper, outputStream);
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException("Failed to marshall deployment
descriptor", e);
+ }
+ }
+}
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/DeploymentDescriptorParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, v2.0.5-b02-fcs
+// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.11.06 at 02:11:05 PM CET
+//
+
+
+package org.jboss.rs.model.dd;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for jbossrs-type complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="jbossrs-type">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="resource"
type="{http://org.jboss.rs/}resource-type" maxOccurs="unbounded"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "jbossrs-type", propOrder = {
+ "resource"
+})
+public class JbossrsType {
+
+ @XmlElement(required = true)
+ protected List<ResourceType> resource;
+
+ /**
+ * Gets the value of the resource property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the resource
property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getResource().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link ResourceType }
+ *
+ *
+ */
+ public List<ResourceType> getResource() {
+ if (resource == null) {
+ resource = new ArrayList<ResourceType>();
+ }
+ return this.resource;
+ }
+
+}
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/JbossrsType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,68 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, v2.0.5-b02-fcs
+// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.11.06 at 02:11:05 PM CET
+//
+
+
+package org.jboss.rs.model.dd;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.rs.model.dd package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _Jbossrs_QNAME = new
QName("http://org.jboss.rs/", "jbossrs");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema
derived classes for package: org.jboss.rs.model.dd
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link ResourceType }
+ *
+ */
+ public ResourceType createResourceType() {
+ return new ResourceType();
+ }
+
+ /**
+ * Create an instance of {@link JbossrsType }
+ *
+ */
+ public JbossrsType createJbossrsType() {
+ return new JbossrsType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link JbossrsType }{@code
>}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.jboss.rs/", name =
"jbossrs")
+ public JAXBElement<JbossrsType> createJbossrs(JbossrsType value) {
+ return new JAXBElement<JbossrsType>(_Jbossrs_QNAME, JbossrsType.class,
null, value);
+ }
+
+}
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,94 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, v2.0.5-b02-fcs
+// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.11.06 at 02:11:05 PM CET
+//
+
+
+package org.jboss.rs.model.dd;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for resource-type complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="resource-type">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="implementation"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "resource-type", propOrder = {
+ "name",
+ "implementation"
+})
+public class ResourceType {
+
+ protected String name;
+ protected String implementation;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the implementation property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getImplementation() {
+ return implementation;
+ }
+
+ /**
+ * Sets the value of the implementation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setImplementation(String value) {
+ this.implementation = value;
+ }
+
+}
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/ResourceType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
===================================================================
--- stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
(rev 0)
+++
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, v2.0.5-b02-fcs
+// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2007.11.06 at 02:11:05 PM CET
+//
+
+(a)javax.xml.bind.annotation.XmlSchema(namespace = "http://org.jboss.rs/",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.jboss.rs.model.dd;
Property changes on:
stack/native/branches/rest/src/main/java/org/jboss/rs/model/dd/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/branches/rest/src/main/resources/schema/jbossrs.xsd
===================================================================
--- stack/native/branches/rest/src/main/resources/schema/jbossrs.xsd
(rev 0)
+++ stack/native/branches/rest/src/main/resources/schema/jbossrs.xsd 2007-11-06 13:26:34
UTC (rev 4994)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://org.jboss.rs/"
+ xmlns:tns="http://org.jboss.rs/"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1.1">
+
+ <xsd:element name="jbossrs" type="tns:jbossrs-type"/>
+
+ <xsd:complexType name="jbossrs-type">
+ <xsd:sequence>
+ <xsd:element name="resource" type="tns:resource-type"
minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="resource-type">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"
minOccurs="0"/>
+ <xsd:element name="implementation" type="xsd:string"
minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
Property changes on: stack/native/branches/rest/src/main/resources/schema/jbossrs.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
===================================================================
---
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
(rev 0)
+++
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java 2007-11-06
13:26:34 UTC (rev 4994)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.rs.deployment;
+
+import junit.framework.TestCase;
+import org.jboss.rs.model.dd.DeploymentDescriptorParser;
+import org.jboss.rs.model.dd.JbossrsType;
+import org.jboss.rs.model.dd.ResourceType;
+
+import java.io.ByteArrayInputStream;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class DescriptorParserTestCase extends TestCase
+{
+ private final static String DD = "<?xml version='1.0'
encoding='UTF-8'?>\n"+
+ "<jbossrs xmlns='http://org.jboss.rs/'>"+
+ " <resource>"+
+ " <name>SampleEndpoint</name>"+
+ "
<implementation>org.jboss.test.rs.WidgetList</implementation>"+
+ " </resource>"+
+ "</jbossrs>";
+
+ public void testReadDescriptor() throws Exception
+ {
+ JbossrsType dd = DeploymentDescriptorParser.read( new
ByteArrayInputStream(DD.getBytes()));
+ assertNotNull(dd);
+ assertTrue(dd.getResource().size()==1);
+
+ ResourceType resource = dd.getResource().get(0);
+ assertTrue(resource.getName().equals("SampleEndpoint"));
+
assertTrue(resource.getImplementation().equals("org.jboss.test.rs.WidgetList"));
+ }
+
+ public void testWriteDescriptor() throws Exception
+ {
+ JbossrsType dd = DeploymentDescriptorParser.read( new
ByteArrayInputStream(DD.getBytes()));
+ ResourceType resource = new ResourceType();
+ resource.setImplementation("a.b.c.class");
+ resource.setName("FooBarResource");
+
+ dd.getResource().add(resource);
+
+ DeploymentDescriptorParser.write(dd, System.out);
+ }
+}
Property changes on:
stack/native/branches/rest/src/test/java/org/jboss/test/rs/deployment/DescriptorParserTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF