You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2009/02/17 14:19:54 UTC
svn commit: r745042 - in
/camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources:
StaticContentTest.java TestSupport.java
Author: jstrachan
Date: Tue Feb 17 13:19:52 2009
New Revision: 745042
URL: http://svn.apache.org/viewvc?rev=745042&view=rev
Log:
added a static content test case to check that Jersey's static content regex is working properly
Added:
camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java (with props)
Modified:
camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/TestSupport.java
Added: camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java?rev=745042&view=auto
==============================================================================
--- camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java (added)
+++ camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java Tue Feb 17 13:19:52 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 org.apache.camel.rest.resources;
+
+import com.sun.jersey.api.client.WebResource;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class StaticContentTest extends TestSupport {
+
+ public void testCssFile() throws Exception {
+ String response = resource("/css/site.css").get(String.class);
+ assertNotNull("Should have returned a response", response);
+ assertResponseContains(response, "Rounded Box Styles");
+ }
+
+
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/StaticContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/TestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/TestSupport.java?rev=745042&r1=745041&r2=745042&view=diff
==============================================================================
--- camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/TestSupport.java (original)
+++ camel/trunk/components/camel-web/src/test/java/org/apache/camel/rest/resources/TestSupport.java Tue Feb 17 13:19:52 2009
@@ -16,13 +16,11 @@
*/
package org.apache.camel.rest.resources;
-import junit.framework.TestCase;
-
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
-
+import junit.framework.TestCase;
import org.apache.camel.rest.Main;
/**
@@ -56,4 +54,15 @@
super.tearDown();
Main.stop();
}
+
+ protected void assertHtmlResponse(String response) {
+ assertNotNull("No text returned!", response);
+
+ assertResponseContains(response, "<html>");
+ assertResponseContains(response, "</html>");
+ }
+
+ protected void assertResponseContains(String response, String text) {
+ assertTrue("Response should contain " + text + " but was: " + response, response.contains(text));
+ }
}