tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freem...@apache.org
Subject svn commit: r493643 - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/internal/ main/java/org/apache/tapestry/test/pagelevel/ test/app2/ test/java/org/apache/tapestry/integration/app2/pages/ test/java/org/apache/tapestry/i...
Date Sun, 07 Jan 2007 04:39:06 GMT
Author: freemant
Date: Sat Jan  6 20:39:05 2007
New Revision: 493643

URL: http://svn.apache.org/viewvc?view=rev&rev=493643
Log:
1) Added a PageTester test for finding a template in context root.
2) Fixed a bug in PageTesterContext: toURL() didn't check if the file really existed.
3) Moved DefaultValidationDecoratorTest from src/main/java into src/test/java. That placement
was causing compile errors in maven as it couldn't find other classes in src/test/java.

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/test/app2/
    tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt   (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html
  (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTemplateInContext.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java
  (with props)
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
      - copied unchanged from r493638, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java
  (with props)
Removed:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTesterContext.java

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTesterContext.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTesterContext.java?view=diff&rev=493643&r1=493642&r2=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTesterContext.java
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTesterContext.java
Sat Jan  6 20:39:05 2007
@@ -37,7 +37,11 @@
     public URL getResource(String path)
     {
         File f = new File(_contextRoot + path);
-
+        
+        if (!f.exists() || !f.isFile())
+        {
+            return null;
+        }
         try
         {
             return f.toURL();

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt?view=auto&rev=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt Sat Jan  6 20:39:05
2007
@@ -0,0 +1 @@
+some opaque resource. This file is needed by a unit test. Do not delete it.
\ No newline at end of file

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/test/app2/OpaqueResource.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html?view=auto&rev=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html
Sat Jan  6 20:39:05 2007
@@ -0,0 +1,5 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<p>
+${msg}
+</p>
+</html>
\ No newline at end of file

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/test/app2/TestPageForTemplateInContext.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTemplateInContext.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTemplateInContext.java?view=auto&rev=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTemplateInContext.java
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForTemplateInContext.java
Sat Jan  6 20:39:05 2007
@@ -0,0 +1,27 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed 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.tapestry.integration.app2.pages;
+
+import org.apache.tapestry.annotations.ComponentClass;
+
+@ComponentClass
+public class TestPageForTemplateInContext
+{
+    public String getMsg()
+    {
+        return "How are you?";
+    }
+
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java?view=auto&rev=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java
Sat Jan  6 20:39:05 2007
@@ -0,0 +1,45 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed 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.tapestry.integration.pagelevel;
+
+import org.apache.tapestry.dom.Document;
+import org.apache.tapestry.test.pagelevel.PageTester;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+public class TemplateInContextTest extends Assert
+{
+    private PageTester _tester;
+
+    @Test
+    public void template_in_context_root()
+    {
+        String appPackage = "org.apache.tapestry.integration.app2";
+        String appName = "";
+        _tester = new PageTester(appPackage, appName, "src/test/app2");
+        Document doc = _tester.renderPage("TestPageForTemplateInContext");
+        assertTrue(doc.toString().contains("How are you?"));
+    }
+
+    @AfterMethod
+    public void after()
+    {
+        if (_tester != null)
+        {
+            _tester.shutdown();
+        }
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/pagelevel/TemplateInContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java?view=auto&rev=493643
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java
(added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java
Sat Jan  6 20:39:05 2007
@@ -0,0 +1,50 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed 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.tapestry.test.pagelevel;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PageTesterContextTest extends Assert
+{
+    @Test
+    public void to_URL() throws IOException
+    {
+        PageTesterContext context = new PageTesterContext("src/test/app2");
+        URL resource = context.getResource("/OpaqueResource.txt");
+        InputStream stream = resource.openStream();
+        stream.close();
+    }
+
+    @Test
+    public void to_URL_no_file() throws IOException
+    {
+        PageTesterContext context = new PageTesterContext("src/test/app2");
+        URL resource = context.getResource("/NonExisting.txt");
+        assertNull(resource);
+    }
+
+    @Test
+    public void to_URL_is_dir() throws IOException
+    {
+        PageTesterContext context = new PageTesterContext("src/test");
+        URL resource = context.getResource("/app2");
+        assertNull(resource);
+    }
+}

Propchange: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/test/pagelevel/PageTesterContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message