incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r787553 [6/34] - in /incubator/wink/contrib/ibm-jaxrs/tests: ./ fvt/ fvt/demo/ fvt/demo/jaxrs/ fvt/demo/jaxrs/cache/ fvt/demo/jaxrs/cache/server/ fvt/demo/jaxrs/cache/test/ fvt/demo/jaxrs/datasource/ fvt/demo/jaxrs/datasource/server/ fvt/de...
Date Tue, 23 Jun 2009 05:38:19 GMT
Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBook.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBook.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBook.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBook.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.string.server;
+
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+@Path(value = "/unittests/addresses")
+public class AddressBook {
+
+    private static AddressBookDatabase db = AddressBookDatabase.getInstance();
+
+    private @Context
+    HttpServletRequest request;
+
+    public static Address defaultAddress = new Address("defaultAddress",
+            "12345", "1 Mopac Loop", "Austin", "TX", "US");
+
+    public AddressBook() {
+        db.storeAddress(defaultAddress.getEntryName(), defaultAddress);
+    }
+
+    @Path("/{entryName}")
+    public Address getAddress(@PathParam(value = "entryName") String entryName) {
+        Address addr = db.getAddress(entryName);
+        return addr;
+    }
+
+    @GET
+    @Produces(value = { "text/xml" })
+    public Response getAddresses() {
+        Response resp = null;
+        if (request.getMethod().equalsIgnoreCase("HEAD")) {
+            ResponseBuilder builder = Response.ok();
+            resp = builder.build();
+            resp.getMetadata().putSingle("head-matched", "true");
+        } else {
+            StringBuffer sb = new StringBuffer();
+            Iterator<Address> addressIter = db.getAddresses();
+            while (addressIter.hasNext()) {
+                sb.append(addressIter.next().toString());
+                sb.append("\n");
+            }
+            ResponseBuilder builder = Response.ok(sb.toString());
+            resp = builder.build();
+        }
+        return resp;
+    }
+
+    @POST
+    public void createAddress(@QueryParam(value = "entryName") String entryName, @QueryParam(value = "zipCode") String zipCode, @QueryParam(value = "streetAddress") String streetAddress, @QueryParam(value = "city") String city, @QueryParam(value = "state") String state, @QueryParam(value = "country") String country) {
+        Address address = new Address(entryName, zipCode, streetAddress, city,
+                state, country);
+        db.storeAddress(entryName, address);
+    }
+
+    @POST
+    @Consumes(value = { "text/xml" })
+    @Path(value = "/fromBody")
+    public void createAddressFromBody(String input) {
+        String[] inputs = input.split("&");
+        String entryName = inputs[0];
+        String zipCode = inputs[1];
+        String streetAddress = inputs[2];
+        String city = inputs[3];
+        String state = inputs[4];
+        String country = inputs[5];
+        Address address = new Address(entryName, zipCode, streetAddress, city,
+                state, country);
+        db.storeAddress(entryName, address);
+    }
+
+    @DELETE
+    @Path(("/{entryName}"))
+    public void removeAddress(@PathParam(value = "entryName") String entryName) {
+        db.removeAddress(entryName);
+    }
+
+    @PUT
+    public void updateAddress(@QueryParam(value = "entryName") String entryName, @QueryParam(value = "zipCode") String zipCode, @QueryParam(value = "streetAddress") String streetAddress, @QueryParam(value = "city") String city, @QueryParam(value = "state") String state, @QueryParam(value = "country") String country) {
+        Address address = db.getAddress(entryName);
+        if (address == null) {
+            address = new Address(entryName, zipCode, streetAddress, city,
+                    state, country);
+            db.storeAddress(entryName, address);
+        } else {
+            address.setCity(city);
+            address.setCountry(country);
+            address.setState(state);
+            address.setStreetAddress(streetAddress);
+            address.setZipCode(zipCode);
+        }
+    }
+
+    @POST
+    @PUT
+    @Path(value = "/invalidMultipleHttpMethodAnnots")
+    public void invalidMultipleHttpMethodAnnots() {
+
+    }
+
+    @GET
+    @Path(value = "/invalidNonPublic")
+    void invalidNonPublic() {
+
+    }
+
+    @POST
+    @Path("/clear")
+    public void clearEntries() {
+        AddressBookDatabase.clearEntries();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBookDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBookDatabase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBookDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/AddressBookDatabase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.string.server;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Sample that will mock a database for the AddressBook resource
+ * @author Dustin
+ *
+ */
+public class AddressBookDatabase {
+
+    private static Map<String, Address> addressMap;
+
+    private static AddressBookDatabase instance;
+
+    private AddressBookDatabase() {
+        addressMap = new HashMap<String, Address>();
+    }
+
+    public static AddressBookDatabase getInstance() {
+        if (instance == null) {
+            instance = new AddressBookDatabase();
+        }
+        return instance;
+    }
+
+    public Address getAddress(String entryName) {
+        return addressMap.get(entryName);
+    }
+
+    public void storeAddress(String entryName, Address address) {
+        addressMap.put(entryName, address);
+    }
+
+    public Iterator<Address> getAddresses() {
+        return addressMap.values().iterator();
+    }
+
+    public void removeAddress(String entryName) {
+        addressMap.remove(entryName);
+    }
+
+    public static void clearEntries() {
+        if (addressMap != null) {
+            addressMap.clear();
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>AddressBook</servlet-name>
+		<servlet-class>demo.jaxrs.string.server.AddressApplication</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>AddressBook</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>AddressApplication</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>demo.jaxrs.string.server.AddressApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>AddressApplication</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/test/StringTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/test/StringTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/test/StringTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/string/test/StringTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.string.test;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import demo.jaxrs.string.server.Address;
+import demo.jaxrs.string.server.AddressApplication;
+import demo.jaxrs.string.server.AddressBook;
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * These tests drive calls to a REST resource that is deployed on our test
+ * framework server. The resources being tested by this class exchange data via
+ * String objects.
+ *
+ */
+public class StringTests extends FVTTestCase {
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(StringTests.class)
+            + "/unittests/addresses";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(StringTests.class,
+                AddressApplication.class.getName());
+    }
+
+    @Override
+    public void setUp() {
+        /*
+         * clear the database entries
+         */
+        HttpClient client = new HttpClient();
+        HttpMethod method = null;
+        try {
+            method = new PostMethod(BASE_URI + "/clear");
+            client.executeMethod(method);
+            assertEquals(204, method.getStatusCode());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will drive a GET request with no input parameters
+     *
+     */
+    public void testGetNoParams() {
+
+        HttpMethod method = null;
+        try {
+            HttpClient client = new HttpClient();
+            method = new GetMethod(BASE_URI);
+            client.executeMethod(method);
+            String responseBody = method.getResponseBodyAsString();
+            Address addr = AddressBook.defaultAddress;
+            assertTrue(responseBody.contains(addr.getEntryName()));
+            assertTrue(responseBody.contains(addr.getStreetAddress()));
+            assertTrue(responseBody.contains(addr.getZipCode()));
+            assertTrue(responseBody.contains(addr.getCity()));
+            assertTrue(responseBody.contains(addr.getCountry()));
+            assertTrue(responseBody.contains(addr.getState()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will drive a POST request with parameters from the query string
+     *
+     */
+    public void testPostWithQueryParams() {
+        HttpMethod method = null;
+        HttpMethod getMethod = null;
+        try {
+
+            // make sure everything is clear before testing
+            HttpClient client = new HttpClient();
+            method = new PostMethod(BASE_URI);
+            method
+                    .setQueryString("entryName=newAddress&streetAddress=1234+Any+Street&city="
+                            + "AnyTown&zipCode=90210&state=TX&country=US");
+            client.executeMethod(method);
+
+            // now let's see if the address we just created is available
+            getMethod = new GetMethod(BASE_URI + "/newAddress");
+            client.executeMethod(getMethod);
+            String responseBody = getMethod.getResponseBodyAsString();
+            assertNotNull(responseBody);
+            assertTrue(responseBody.contains("newAddress"));
+            assertTrue(responseBody.contains("1234 Any Street"));
+            assertTrue(responseBody.contains("AnyTown"));
+            assertTrue(responseBody.contains("90210"));
+            assertTrue(responseBody.contains("TX"));
+            assertTrue(responseBody.contains("US"));
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+            if (getMethod != null) {
+                getMethod.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will drive a POST, GET, UPDATE, and DELETE on the
+     * AddressBookResource
+     *
+     */
+    public void testAddressBookResource() {
+        PostMethod method = null;
+        GetMethod getMethod = null;
+        PutMethod put = null;
+        DeleteMethod deleteMethod = null;
+        try {
+
+            // make sure everything is clear before testing
+            HttpClient client = new HttpClient();
+            method = new PostMethod(BASE_URI + "/fromBody");
+            String input = "tempAddress&1234 Any Street&AnyTown&90210&TX&US";
+            RequestEntity entity = new ByteArrayRequestEntity(input.getBytes(),
+                    "text/xml");
+            method.setRequestEntity(entity);
+            client.executeMethod(method);
+
+            // now let's see if the address we just created is available
+            getMethod = new GetMethod(BASE_URI + "/tempAddress");
+            client.executeMethod(getMethod);
+            String responseBody = getMethod.getResponseBodyAsString();
+            getMethod.releaseConnection();
+            assertNotNull(responseBody);
+            assertTrue(responseBody.contains("tempAddress"));
+            assertTrue(responseBody.contains("1234 Any Street"));
+            assertTrue(responseBody.contains("AnyTown"));
+            assertTrue(responseBody.contains("90210"));
+            assertTrue(responseBody.contains("TX"));
+            assertTrue(responseBody.contains("US"));
+
+            // let's update the state
+            String query = "entryName=tempAddress&streetAddress=1234+Any+Street&city="
+                    + "AnyTown&zipCode=90210&state=AL&country=US";
+            client = new HttpClient();
+            put = new PutMethod(BASE_URI);
+            put.setQueryString(query);
+            client.executeMethod(put);
+
+            // make sure the state has been updated
+            client = new HttpClient();
+            client.executeMethod(getMethod);
+            responseBody = getMethod.getResponseBodyAsString();
+            assertNotNull(responseBody);
+            assertTrue(responseBody.contains("tempAddress"));
+            assertFalse(responseBody.contains("TX"));
+            assertTrue(responseBody.contains("AL"));
+
+            // now let's delete the address
+            client = new HttpClient();
+            deleteMethod = new DeleteMethod(BASE_URI + "/tempAddress");
+            client.executeMethod(deleteMethod);
+
+            // now try to get the address
+            client = new HttpClient();
+            client.executeMethod(getMethod);
+            responseBody = getMethod.getResponseBodyAsString();
+            assertNull(responseBody);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+            if (getMethod != null) {
+                getMethod.releaseConnection();
+            }
+            if (put != null) {
+                put.releaseConnection();
+            }
+            if (deleteMethod != null) {
+                deleteMethod.releaseConnection();
+            }
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="demo.jaxrs.versioning" default="all">
+	<import file="../../../buildCommon.xml" />
+
+	<target name="dist" depends="init">
+		<available file="${fvt.build.classes.dir}/${fvt.package.path}/server" type="dir" property="package.server.dir.exists" />
+		<antcall target="internal.makeear" />
+	</target>
+
+	<target name="internal.makeear" if="package.server.dir.exists">
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="true" failonerror="false">
+			<fileset dir="${fvt.base.dir}/${fvt.package.path}/server/">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="false" failonerror="false">
+			<fileset dir="${fvt.base.dir}/framework/defaults/server/">
+				<include name="**" />
+				<exclude name="WEB-INF/ibm-component.properties" />
+			</fileset>
+		</copy>
+
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/META-INF/application.xml">
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_WAR_FILE_NAME@" value="${fvt.package.app.name}.war" />
+			<replacefilter token="@REPLACE_CONTEXT_ROOT@" value="${fvt.package.path}" />
+		</replace>
+
+		<antcall target="internal.makewar.without.runtime">
+		</antcall>
+		<antcall target="internal.makewar.with.runtime">
+		</antcall>
+
+		<ear destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.ear" appxml="${fvt.build.work.dir}/${fvt.package.path}/server/META-INF/application.xml">
+			<fileset dir="${fvt.build.apps.dir}">
+				<include name="${fvt.package.app.name}.war" />
+			</fileset>
+		</ear>
+	</target>
+
+	<target name="internal.makewar.without.runtime" unless="fvt.dist.package.runtime">
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web-no-runtime.xml">
+			<replacefilter token="@REPLACE_SERVLET_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}.server.Application" />
+			<replacefilter token="@REPLACE_PATH@" value="/*" />
+		</replace>
+		<move file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" tofile="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml" />
+
+		<war destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.war" webxml="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<classes dir="${fvt.build.classes.dir}">
+				<include name="${fvt.package.path}/server/**" />
+				<exclude name="${fvt.package.path}/server/META-INF/application.xml" />
+			</classes>
+			<classes dir="${ibmjaxrs.base.dir}">
+				<include name="tests/test-resources/**" />
+			</classes>
+			<fileset dir="${fvt.build.work.dir}">
+				<include name="${fvt.package.path}/server/**/*.java" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web.xml" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" />
+			</fileset>
+		</war>
+	</target>
+
+	<target name="internal.makewar.with.runtime" if="fvt.dist.package.runtime">
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="false" failonerror="false">
+			<fileset dir="${fvt.base.dir}/build/defaults/server/">
+				<include name="WEB-INF/ibm-component.properties" />
+			</fileset>
+		</copy>
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<replacefilter token="@REPLACE_SERVLET_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}.server.Application" />
+			<replacefilter token="@REPLACE_PATH@" value="/*" />
+		</replace>
+
+		<war destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.war" webxml="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<classes dir="${fvt.build.classes.dir}">
+				<include name="${fvt.package.path}/server/**" />
+				<exclude name="${fvt.package.path}/server/META-INF/application.xml" />
+			</classes>
+			<classes dir="${ibmjaxrs.base.dir}">
+				<include name="tests/test-resources/**" />
+			</classes>
+			<fileset dir="${fvt.build.work.dir}">
+				<include name="${fvt.package.path}/server/**/*.java" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web.xml" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" />
+			</fileset>
+			<lib dir="${ibmjaxrs.base.dir}/dist">
+				<include name="ibmjaxrs-SNAPSHOT.jar" />
+			</lib>
+			<lib dir="${ibmjaxrs.base.dir}/lib">
+				<include name="abdera-core-0.4.0-incubating.jar" />
+				<include name="commons-codec-1.3.jar" />
+				<include name="commons-logging-1.1.1.jar" />
+				<include name="jsr311-api-0.11.jar" />
+				<include name="xmlbeans-2.3.0.jar" />
+				<include name="asm-all-3.1.jar" />
+			</lib>
+			<webinf dir="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF">
+				<include name="ibm-component.properties" />
+			</webinf>
+		</war>
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.versioning.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(TaxForm.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/TaxForm.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/TaxForm.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/TaxForm.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/server/TaxForm.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.versioning.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+@Path(value = "/taxform")
+public class TaxForm {
+
+    @Context
+    private HttpHeaders httpHeaders;
+
+    @Context
+    private ServletContext context;
+
+    @GET
+    public InputStream getWithAcceptHeader(@QueryParam(value = "form") String form)
+            throws FileNotFoundException {
+        List<MediaType> mediaTypes = httpHeaders.getAcceptableMediaTypes();
+        if (mediaTypes == null || mediaTypes.isEmpty()) {
+            throw new IllegalArgumentException("Accept values not found");
+        }
+        MediaType mediaType = mediaTypes.get(0);
+        String subtype = mediaType.getSubtype();
+        String version = subtype.substring(subtype.indexOf("+") + 1);
+        String formPath = form + "_" + version;
+        String path = "tests" + java.io.File.separator + "test-resources"
+                + java.io.File.separator + formPath + ".xml";
+        InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+                + path);
+        if (stream != null) {
+            return stream;
+        }
+        return new FileInputStream(new File(path));
+    }
+
+    @GET
+    @Path(value = "/{form}")
+    public InputStream getWithQueryString(@PathParam(value = "form") String form, @QueryParam(value = "version") String version)
+            throws FileNotFoundException {
+        String formPath = form + "_" + version;
+        String path = "tests" + java.io.File.separator + "test-resources"
+                + java.io.File.separator + formPath + ".xml";
+        InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+                + path);
+        if (stream != null) {
+            return stream;
+        }
+        return new FileInputStream(new File(path));
+    }
+
+    @GET
+    @Path(value = "/{form}/{version}")
+    public InputStream getWithPathInfo(@PathParam(value = "form") String form, @PathParam(value = "version") String version)
+            throws FileNotFoundException {
+        String formPath = form + "_" + version;
+        String path = "tests" + java.io.File.separator + "test-resources"
+                + java.io.File.separator + formPath + ".xml";
+        InputStream stream = context.getResourceAsStream("/WEB-INF/classes/"
+                + path);
+        if (stream != null) {
+            return stream;
+        }
+        return new FileInputStream(new File(path));
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/test/VersioningTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/test/VersioningTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/test/VersioningTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/versioning/test/VersioningTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.versioning.test;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Demonstrates different versioning techniques
+ *
+ */
+public class VersioningTests extends FVTTestCase {
+
+    protected HttpClient httpclient = new HttpClient();
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(VersioningTests.class)
+            + "/taxform";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(VersioningTests.class,
+                demo.jaxrs.versioning.server.Application.class.getName());
+    }
+
+    public void testVersionByAccept() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpMethod.setQueryString("form=1040");
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                httpMethod.setRequestHeader("Accept",
+                        "application/taxform+2007");
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertTrue(
+                        "Response does not contain expected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+
+                httpMethod.setRequestHeader("Accept",
+                        "application/taxform+2008");
+                result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertFalse(
+                        "Response contains unexpected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testVersionByQueryString() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/1040", false));
+            httpMethod.setQueryString("version=2007");
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertTrue(
+                        "Response does not contain expected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+
+                httpMethod.setURI(new URI(BASE_URI + "/1040", false));
+                httpMethod.setQueryString("version=2008");
+                result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertFalse(
+                        "Response contains unexpected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testVersionByPath() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/1040/2007", false));
+            System.out.println(Arrays.asList(httpMethod.getRequestHeaders()));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertTrue(
+                        "Response does not contain expected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+
+                httpMethod.setURI(new URI(BASE_URI + "/1040/2008", false));
+                result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertFalse(
+                        "Response contains unexpected 'deductions' element",
+                        responseBody.contains("<deductions>"));
+                assertEquals(200, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="demo.jaxrs.xmldd" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/TestResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/TestResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/TestResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/TestResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.xmldd.server;
+
+public class TestResource {
+
+    public String getName() {
+        return "hello";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/WEB-INF/ibm-jaxrs.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/WEB-INF/ibm-jaxrs.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/WEB-INF/ibm-jaxrs.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/server/WEB-INF/ibm-jaxrs.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,30 @@
+<jaxrs:resources xmlns:jaxrs="http://www.ibm.com/xml/ns/jaxrs">
+	<!--
+		~ Licensed to the Apache Software Foundation (ASF) under one ~ or more
+		contributor license agreements. See the NOTICE file ~ distributed with
+		this work for additional information ~ regarding copyright ownership.
+		The ASF licenses this file ~ to you under the Apache License, Version
+		2.0 (the ~ "License"); you may not use this file except in compliance
+		~ with the License. You may obtain a copy of the License at ~ ~
+		http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by
+		applicable law or agreed to in writing, ~ software distributed under
+		the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES
+		OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
+		License for the ~ specific language governing permissions and
+		limitations ~ under the License.
+	-->
+	<jaxrs:resource>
+		<jaxrs:class-name>demo.jaxrs.xmldd.server.TestResource
+		</jaxrs:class-name>
+		<jaxrs:path>/</jaxrs:path>
+		<jaxrs:methods>
+			<jaxrs:method>
+				<jaxrs:method-name>getName</jaxrs:method-name>
+				<jaxrs:method-type>GET</jaxrs:method-type>
+				<jaxrs:produces>
+					<jaxrs:mimeType>text/xml</jaxrs:mimeType>
+				</jaxrs:produces>
+			</jaxrs:method>
+		</jaxrs:methods>
+	</jaxrs:resource>
+</jaxrs:resources>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/test/DeploymentTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/test/DeploymentTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/test/DeploymentTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/xmldd/test/DeploymentTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.xmldd.test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTTestCase;
+
+public class DeploymentTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        Map<String, Map<String, String>> servletToInitParams = new HashMap<String, Map<String, String>>();
+        Map<String, String> initParamsToValues = new HashMap<String, String>();
+        initParamsToValues.put("com.ibm.ws.jaxrs.ConfigFile",
+                "WEB-INF/ibm-jaxrs.xml");
+        String servletName = "xmlddapp";
+        servletToInitParams.put(servletName, initParamsToValues);
+
+        Map<String, Set<String>> servletToURLPatterns = new HashMap<String, Set<String>>();
+        Set<String> patterns = new HashSet<String>();
+        patterns.add("/*");
+        servletToURLPatterns.put(servletName, patterns);
+        return FVTTestCase.getTestSuite(DeploymentTest.class, "/",
+                servletToInitParams, servletToURLPatterns);
+    }
+
+    public void testSomething() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod method = new GetMethod(getBaseURI());
+        try {
+            client.executeMethod(method);
+            assertEquals(200, method.getStatusCode());
+            assertEquals("hello", method.getResponseBodyAsString());
+        } finally {
+            method.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildOptions.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildOptions.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildOptions.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildOptions.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="buildOptions" default="setStandalone">
+	<target name="setStandalone" description="Makes tests run in Standalone">
+		<property name="fvt.framework.environment" value="standalone" />
+	</target>
+	<target name="setWAS" description="Makes tests run in WebSphere">
+		<property name="fvt.framework.environment" value="was" />
+	</target>
+	<target name="setWASCE" description="Makes tests run in WebSphere Community Edition">
+		<property name="fvt.framework.environment" value="wasce" />
+	</target>
+
+	<target name="setCodeCoverage" description="Turns on code coverage">
+		<property name="fvt.code.coverage.enabled" value="true" />
+	</target>
+	<target name="setPackageRuntime" description="Includes the runtime in the application">
+		<property name="fvt.dist.package.runtime" value="true" />
+	</target>
+	<target name="setTrace" description="Turns on trace">
+		<property name="fvt.option.trace.enabled" value="true" />
+	</target>
+</project>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildProperties.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildProperties.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildProperties.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildProperties.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="buildProperties" default="all">
+	<dirname file="${ant.file.buildProperties}" property="fvt.properties.dir" />
+	<property name="fvt.base.dir" location="${fvt.properties.dir}/../" />
+
+	<property name="ibmjaxrs.base.dir" location="${fvt.base.dir}/../../" />
+	<property name="ibmjaxrs.build.base.dir" location="${ibmjaxrs.base.dir}/build/" />
+	<property name="ibmjaxrs.build.classes.dir" location="${ibmjaxrs.base.dir}/build/classes/" />
+	<property name="ibmjaxrs.db.dir" location="${ibmjaxrs.base.dir}/db/" />
+	<property name="ibmjaxrs.lib.dir" location="${ibmjaxrs.base.dir}/lib/" />
+
+	<property name="fvt.build.dir" location="${ibmjaxrs.build.base.dir}/fvt/" />
+	<property name="fvt.build.classes.dir" location="${ibmjaxrs.build.base.dir}/fvt/classes/" />
+	<property name="fvt.build.apps.dir" location="${ibmjaxrs.build.base.dir}/fvt/apps/" />
+	<property name="fvt.build.work.dir" location="${ibmjaxrs.build.base.dir}/fvt/work/" />
+	<property name="fvt.build.reports.dir" location="${ibmjaxrs.build.base.dir}/fvt/reports/" />
+
+	<path id="fvt.classpath">
+		<pathelement location="${ibmjaxrs.build.base.dir}/ibmjaxrs-SNAPSHOT.jar" />
+		<pathelement path="${ibmjaxrs.build.base.dir}/test-classes" />
+		<pathelement path="${ibmjaxrs.base.dir}/resources" />
+		<fileset dir="${ibmjaxrs.base.dir}/lib">
+			<!-- Included for sample code -->
+			<include name="commons-httpclient-3.1.jar" />
+
+			<!-- Included for Abdera Provider -->
+			<include name="abdera-0.4.0-incubating.jar" />
+
+			<!-- Included for XML Beans Provider -->
+			<include name="xmlbeans-2.3.0.jar" />
+
+			<include name="jsr311-api-0.11.jar" />
+			<include name="geronimo-servlet_3.0_spec-1.0-EA-20080711.180136-1.jar" />
+		</fileset>
+	</path>
+
+	<target name="all">
+		<!-- do nothing -->
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildSpecialTasks.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildSpecialTasks.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildSpecialTasks.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/buildSpecialTasks.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="buildSpecialTasks" default="createNewTest">
+
+	<import file="buildProperties.xml"/>
+	
+	<!-- Creates a new test package from the template -->
+	<target name="createNewTest">
+		<fail unless="package.name" />
+		<pathconvert property="package.dir">
+			<path path="${package.name}">
+			</path>
+			<mapper type="unpackage" from="*" to="*" />
+		</pathconvert>
+		<pathconvert property="package.name.importcommondir">
+			<path path="${package.name}">
+			</path>
+			<chainedmapper>
+				<mapper type="unpackage" from="*" to="*" />
+				<mapper type="glob" from="${fvt.base.dir}*" to="*" />
+				<filtermapper>
+					<tokenfilter>
+						<stringtokenizer delims="/\\" includedelims="true" />
+						<replaceregex pattern=".*" replace="../" />
+					</tokenfilter>
+					<concatfilter />
+				</filtermapper>
+				<globmapper from="*../" to="*" />
+			</chainedmapper>
+		</pathconvert>
+		<echo message="${package.name.importcommondir}" />
+		<echo message="${package.dir}" />
+		<mkdir dir="${package.dir}" />
+		<copy todir="${package.dir}">
+			<fileset dir="${fvt.base.dir}/template">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<replace file="${package.dir}/server/Application.java">
+			<replacefilter token="template.server" value="${package.name}.server" />
+		</replace>
+		<replace file="${package.dir}/test/SampleTest.java">
+			<replacefilter token="template.test" value="${package.name}.test" />
+			<replacefilter token="template.server" value="${package.name}.server" />
+		</replace>
+		<replace file="${package.dir}/buildTest.xml">
+			<replacefilter token="template" value="${package.name}" />
+			<replacefilter token="../buildCommon.xml"
+				value="${package.name.importcommondir}buildCommon.xml" />
+		</replace>
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/META-INF/application.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/META-INF/application.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/META-INF/application.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/META-INF/application.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+	version="5">
+	<display-name>@REPLACE_APPLICATION_NAME@</display-name>
+	<module>
+		<web>
+			<web-uri>@REPLACE_WAR_FILE_NAME@</web-uri>
+			<context-root>@REPLACE_CONTEXT_ROOT@</context-root>
+		</web>
+	</module>
+</application>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/ibm-component.properties
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/ibm-component.properties?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/ibm-component.properties (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/ibm-component.properties Tue Jun 23 05:37:57 2009
@@ -0,0 +1,2 @@
+WAS_JAXRS=disabled
+

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>@REPLACE_SERVLET_NAME@</servlet-name>
+		<servlet-class>@REPLACE_APPLICATION_NAME@</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>@REPLACE_SERVLET_NAME@</servlet-name>
+		<url-pattern>@REPLACE_PATH@</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>@REPLACE_SERVLET_NAME@</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>@REPLACE_APPLICATION_NAME@</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>@REPLACE_SERVLET_NAME@</servlet-name>
+		<url-pattern>@REPLACE_PATH@</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/DefaultURIInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/DefaultURIInfo.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/DefaultURIInfo.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/DefaultURIInfo.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test;
+
+public class DefaultURIInfo {
+
+    final private static String hostname = "localhost";
+
+    final private static int port = 7070;
+
+    /**
+     * Returns the default hostname for the machine where the server artifacts
+     * are installed.
+     *
+     * @return the hostname
+     */
+    public static String getServerHostname() {
+        return System.getProperty("jaxrs.default.server.hostname", hostname);
+    }
+
+    /**
+     * Returns the default port for the server where the server artifacts are
+     * installed.
+     *
+     * @return
+     */
+    public static int getServerPort() {
+        return Integer.valueOf(
+                System.getProperty("jaxrs.default.server.port", Integer
+                        .toString(port))).intValue();
+    }
+
+    /**
+     * Returns the assumed context root for a test case class file.
+     *
+     * @param clazz
+     * @return the assumed context root
+     */
+    public static String getClassDefaultContextRoot(Class<?> clazz) {
+        if (Environment.STANDALONE.equals(Environment.getCurrentEnvironment())) {
+            return "";
+        }
+        String packageName = clazz.getPackage().getName();
+        packageName = packageName.replace(".", "/");
+        if (packageName.endsWith("/test")) {
+            packageName = packageName.substring(0, packageName.length() - 5);
+        } else if (packageName.endsWith("/server")) {
+            packageName = packageName.substring(0, packageName.length() - 7);
+        }
+        return packageName;
+    }
+
+    /**
+     * Returns a class's default base URI. There is no &quot;/&quot; appended to
+     * the URI.
+     *
+     * @param clazz the class
+     * @return a base URI
+     */
+    public static String getClassDefaultBaseURI(Class<?> clazz) {
+        String contextRoot = getClassDefaultContextRoot(clazz);
+        if (!"".equals(contextRoot)) {
+            contextRoot = "/" + contextRoot;
+        }
+        return "http://" + getServerHostname() + ":" + getServerPort()
+                + contextRoot;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/Environment.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/Environment.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/Environment.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/Environment.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test;
+
+import framework.defaults.test.monitor.Monitor;
+import framework.defaults.test.monitor.StandaloneMonitor;
+
+/**
+ * The type of test environment that is running.
+ */
+public enum Environment {
+    GENERIC_WAS, WASCE, STANDALONE;
+
+    public static Environment getCurrentEnvironment() {
+        if ("was".equals(System.getProperty("fvt.framework.environment"))) {
+            return GENERIC_WAS;
+        } else if ("wasce".equals(System
+                .getProperty("fvt.framework.environment"))) {
+            return WASCE;
+        }
+        return STANDALONE;
+    }
+
+    private static Monitor m;
+
+    public Monitor getMonitor() {
+        if (m != null) {
+            return m;
+        }
+
+        switch (getCurrentEnvironment()) {
+            case GENERIC_WAS:
+                try {
+                    m = (Monitor) Class
+                            .forName(
+                                    "framework.environments.was.defaults.test.monitor.WASMonitor")
+                            .newInstance();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                } catch (InstantiationException e) {
+                    e.printStackTrace();
+                } catch (ClassNotFoundException e) {
+                    e.printStackTrace();
+                }
+                break;
+
+            case WASCE:
+                try {
+                    m = (Monitor) Class
+                            .forName(
+                                    "framework.environments.wasce.defaults.test.monitor.WASCEMonitor")
+                            .newInstance();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                } catch (InstantiationException e) {
+                    e.printStackTrace();
+                } catch (ClassNotFoundException e) {
+                    e.printStackTrace();
+                }
+                break;
+            case STANDALONE:
+                m = new StandaloneMonitor();
+                break;
+        }
+        return m;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTAssert.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTAssert.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTAssert.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTAssert.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test;
+
+import framework.defaults.test.monitor.Monitor;
+
+public class FVTAssert {
+
+    /**
+     * Asserts that an exception is in the appropriate logs.
+     */
+    public static void assertLogContainsException(String msg, String s0) {
+        String logs = "";
+        Monitor m = Environment.getCurrentEnvironment().getMonitor();
+        switch (Environment.getCurrentEnvironment()) {
+            case GENERIC_WAS:
+                logs = m.getServerOutput();
+                break;
+            case STANDALONE:
+                logs = m.getServerOutput();
+                break;
+            case WASCE:
+                logs = m.getServerOutput();
+                break;
+        }
+        if (logs.contains(s0)) {
+            return;
+        }
+        throw new AssertionError(msg + ": Logs do not contain:" + s0 + " logs:"
+                + logs);
+    }
+
+    /**
+     * Asserts that an exception is in the appropriate logs.
+     */
+    public static void assertLogContainsException(String s0) {
+        assertLogContainsException(null, s0);
+    }
+
+    /**
+     * Asserts that an exception is in the appropriate logs.
+     */
+    public static void assertInstallLogContainsException(String msg, String s0) {
+        String logs = "";
+        Monitor m = Environment.getCurrentEnvironment().getMonitor();
+        if (!m.isStringInServerOutput(s0)) {
+            throw new AssertionError(msg + ": Install logs do not contain:"
+                    + s0 + " logs:" + logs);
+        }
+    }
+
+    /**
+     * Asserts that an exception is in the appropriate logs.
+     */
+    public static void assertInstallLogContainsException(String s0) {
+        assertInstallLogContainsException(null, s0);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTTestCase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTTestCase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTTestCase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/FVTTestCase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class FVTTestCase extends TestCase {
+
+    public String getBaseURI() {
+        return DefaultURIInfo.getClassDefaultBaseURI(this.getClass());
+    }
+
+    public static class NoTest extends TestCase {
+        /*
+         * do nothing
+         */
+        public void testNothing() {
+            /* do nothing */
+        }
+    }
+
+    public static Test getTestSuite(final Class<?> testclazz, final String applicationClassName) {
+        return getTestSuite(DefaultURIInfo.getServerPort(), testclazz,
+                applicationClassName);
+    }
+
+    static Test getTestSuite(final int serverPort, final Class<?> testclazz, final String applicationClassName) {
+        Map<String, Map<String, String>> servletToInitParams = new HashMap<String, Map<String, String>>();
+        Map<String, String> initParamsToValues = new HashMap<String, String>();
+        String servletName = applicationClassName.replaceAll("\\.", "");
+        initParamsToValues.put("javax.ws.rs.Application", applicationClassName);
+        servletToInitParams.put(servletName, initParamsToValues);
+
+        Map<String, Set<String>> servletToURLPatterns = new HashMap<String, Set<String>>();
+        Set<String> patterns = new HashSet<String>();
+        patterns.add("/*");
+        servletToURLPatterns.put(servletName, patterns);
+        return getTestSuite(serverPort, testclazz, "/", servletToInitParams,
+                servletToURLPatterns);
+    }
+
+    public static Test getTestSuite(final Class<?> testclazz, final Map<String, Set<String>> applicationToURLPatternMap) {
+        return getTestSuite(DefaultURIInfo.getServerPort(), testclazz,
+                applicationToURLPatternMap);
+    }
+
+    static Test getTestSuite(final int serverPort, final Class<?> testclazz, final Map<String, Set<String>> applicationToURLPatternMap) {
+        Map<String, Map<String, String>> servletToInitParams = new HashMap<String, Map<String, String>>();
+        Map<String, Set<String>> servletToURLPatterns = new HashMap<String, Set<String>>();
+
+        for (String applicationClassName : applicationToURLPatternMap.keySet()) {
+            Map<String, String> initParamsToValues = new HashMap<String, String>();
+            String servletName = applicationClassName.replaceAll("\\.", "");
+            initParamsToValues.put("javax.ws.rs.Application",
+                    applicationClassName);
+            servletToInitParams.put(servletName, initParamsToValues);
+
+            Set<String> patterns = applicationToURLPatternMap
+                    .get(applicationClassName);
+            servletToURLPatterns.put(servletName, patterns);
+        }
+        return getTestSuite(serverPort, testclazz, "/", servletToInitParams,
+                servletToURLPatterns);
+    }
+
+    public static Test getTestSuite(final Class<?> testclazz, String contextRoot, final Map<String, Map<String, String>> servletToInitParams, final Map<String, Set<String>> servletToURLPattern) {
+        return getTestSuite(DefaultURIInfo.getServerPort(), testclazz,
+                contextRoot, servletToInitParams, servletToURLPattern);
+    }
+
+    static Test getTestSuite(final int serverPort, final Class<?> testclazz, final String contextRoot, final Map<String, Map<String, String>> servletToInitParams, final Map<String, Set<String>> servletToURLPattern) {
+        TestSuite testSuite = new TestSuite(testclazz);
+        testSuite.setName(testclazz.getName());
+
+        /*
+         * used to init the monitor
+         */
+        Environment.getCurrentEnvironment().getMonitor().resetMonitor();
+
+        if (Environment.STANDALONE.equals(Environment.getCurrentEnvironment())) {
+
+            return new TestSetup(testSuite) {
+                ServletHost host;
+
+                @Override
+                protected void setUp() throws Exception {
+
+                    String packageName = testclazz.getPackage().getName();
+                    packageName = packageName.replace(".", "/");
+                    if (packageName.endsWith("/test")) {
+                        packageName = packageName.substring(0, packageName
+                                .length() - 5);
+                    }
+                    packageName = packageName + "/server";
+
+                    Environment.getCurrentEnvironment().getMonitor()
+                            .resetMonitor();
+                    host = new ServletHost(serverPort, System
+                            .getProperty("user.dir")
+                            + "/tests/fvt/" + packageName, contextRoot,
+                            servletToInitParams, servletToURLPattern);
+                    host.init();
+                }
+
+                @Override
+                public void tearDown() throws Exception {
+                    host.shutdown();
+                }
+            };
+        }
+
+        return new TestSetup(testSuite);
+    }
+
+    public void assertLogContainsException(String msg, String s0) {
+        FVTAssert.assertLogContainsException(msg, s0);
+    }
+
+    public void assertLogContainsException(String s0) {
+        FVTAssert.assertLogContainsException(s0);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/ServletHost.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/ServletHost.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/ServletHost.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/ServletHost.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+import com.ibm.ws.jaxrs.web.RESTServlet;
+
+/**
+ * Integration with Jetty
+ *
+ */
+public class ServletHost {
+
+    final private int port;
+
+    final private Server server;
+
+    final private Map<String, Map<String, String>> servletToInitParams;
+
+    final private Map<String, Set<String>> servletToURLPattern;
+
+    final private String contextRoot;
+
+    final private String webAppDir;
+
+    public ServletHost(int port, String webAppDir, String contextRoot, Map<String, Map<String, String>> servletToInitParams, Map<String, Set<String>> servletToURLPattern) {
+        this.port = port;
+        this.servletToInitParams = servletToInitParams;
+        this.servletToURLPattern = servletToURLPattern;
+        this.contextRoot = contextRoot;
+        this.webAppDir = webAppDir;
+        this.server = new Server();
+    }
+
+    public void init() throws Exception {
+        SelectChannelConnector connector = new SelectChannelConnector();
+        connector.setPort(port);
+        server.setConnectors(new Connector[] { connector });
+
+        WebAppContext root = new WebAppContext(webAppDir, contextRoot);
+
+        for (String servletName : servletToInitParams.keySet()) {
+            ServletHolder holder = new ServletHolder(new RESTServlet());
+            holder.setName(servletName.replaceAll("\\.", ""));
+            for (String initParamName : servletToInitParams.get(servletName)
+                    .keySet()) {
+                holder.setInitParameter(initParamName, servletToInitParams.get(
+                        servletName).get(initParamName));
+            }
+            for (String urlPattern : servletToURLPattern.get(servletName)) {
+                root.addServlet(holder, urlPattern);
+            }
+        }
+
+        server.addHandler(root);
+        server.start();
+    }
+
+    public void shutdown() throws Exception {
+        server.stop();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/Monitor.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/Monitor.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/Monitor.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package framework.defaults.test.monitor;
+
+/**
+ * Monitors are intended to abstract away the need for different output checking
+ * code per container.
+ */
+public interface Monitor {
+
+    public void resetMonitor();
+
+    /**
+     * Returns the different client input and output.
+     *
+     * @return the client input/output
+     */
+    public String getClientOutput();
+
+    /**
+     * Returns the server side output.
+     *
+     * @return the server side output
+     */
+    public String getServerOutput();
+
+    /**
+     * Returns the server side output.
+     *
+     * @return the server side output
+     */
+    public boolean isStringInServerOutput(String str);
+
+    /**
+     * Returns the server side error.
+     *
+     * @return the server side error
+     */
+    public String getServerError();
+}



Mime
View raw message