You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2009/11/15 15:02:47 UTC
svn commit: r836363 - in /tiles/sandbox/trunk/tiles3: ./
tiles-extras/src/main/java/org/apache/tiles/extras/complete/
tiles-extras/src/test/java/org/apache/tiles/extras/complete/
tiles-test-pom/tiles-test/ tiles-test-pom/tiles-test/src/main/webapp/WEB-...
Author: apetrelli
Date: Sun Nov 15 14:02:46 2009
New Revision: 836363
URL: http://svn.apache.org/viewvc?rev=836363&view=rev
Log:
TILES-484
Merge from trunk to tiles3 sandbox.
Applied patch by Alvin Singh.
Added regression test case.
Modified:
tiles/sandbox/trunk/tiles3/ (props changed)
tiles/sandbox/trunk/tiles3/tiles-extras/src/main/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.java
tiles/sandbox/trunk/tiles3/tiles-extras/src/test/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactoryTest.java
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/ (props changed)
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tools.xml (props changed)
Propchange: tiles/sandbox/trunk/tiles3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Nov 15 14:02:46 2009
@@ -1 +1 @@
-/tiles/framework/trunk:829356
+/tiles/framework/trunk:829356,836356
Modified: tiles/sandbox/trunk/tiles3/tiles-extras/src/main/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-extras/src/main/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.java?rev=836363&r1=836362&r2=836363&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-extras/src/main/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-extras/src/main/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.java Sun Nov 15 14:02:46 2009
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.URL;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -227,11 +228,18 @@
protected List<URL> getSourceURLs(ApplicationContext applicationContext,
TilesRequestContextFactory contextFactory) {
try {
- Set<URL> urlSet = applicationContext
- .getResources("/WEB-INF/**/tiles*.xml");
- urlSet.addAll(applicationContext
- .getResources("classpath*:META-INF/**/tiles*.xml"));
- return URLUtil.getBaseTilesDefinitionURLs(urlSet);
+ Set<URL> finalSet = new HashSet<URL>();
+ Set<URL> webINFSet = applicationContext.getResources("/WEB-INF/**/tiles*.xml");
+ Set<URL> metaINFSet = applicationContext.getResources("classpath*:META-INF/**/tiles*.xml");
+
+ if (webINFSet != null) {
+ finalSet.addAll(webINFSet);
+ }
+ if (metaINFSet != null) {
+ finalSet.addAll(metaINFSet);
+ }
+
+ return URLUtil.getBaseTilesDefinitionURLs(finalSet);
} catch (IOException e) {
throw new DefinitionsFactoryException(
"Cannot load definition URLs", e);
Modified: tiles/sandbox/trunk/tiles3/tiles-extras/src/test/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-extras/src/test/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactoryTest.java?rev=836363&r1=836362&r2=836363&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-extras/src/test/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactoryTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-extras/src/test/java/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactoryTest.java Sun Nov 15 14:02:46 2009
@@ -320,6 +320,58 @@
}
/**
+ * Regression test for TILES-484 issue.
+ *
+ * @throws IOException If something goes wrong.
+ */
+ @Test
+ public void testTILES484first() throws IOException {
+ ApplicationContext applicationContext = createMock(ApplicationContext.class);
+ TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);
+
+ URL url3 = new URL("file:///nonexistent2/tiles.xml");
+
+ Set<URL> urls2 = new HashSet<URL>();
+ urls2.add(url3);
+
+ expect(applicationContext.getResources("/WEB-INF/**/tiles*.xml")).andReturn(null);
+ expect(applicationContext.getResources("classpath*:META-INF/**/tiles*.xml")).andReturn(urls2);
+
+ replay(applicationContext, contextFactory);
+ List<URL> urls = factory.getSourceURLs(applicationContext, contextFactory);
+ assertEquals(1, urls.size());
+ assertTrue(urls.contains(url3));
+ verify(applicationContext, contextFactory);
+ }
+
+ /**
+ * Regression test for TILES-484 issue.
+ *
+ * @throws IOException If something goes wrong.
+ */
+ @Test
+ public void testTILES484second() throws IOException {
+ ApplicationContext applicationContext = createMock(ApplicationContext.class);
+ TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);
+
+ URL url1 = new URL("file:///nonexistent/tiles.xml");
+ URL url2 = new URL("file:///nonexistent/tiles_it.xml");
+
+ Set<URL> urls1 = new HashSet<URL>();
+ urls1.add(url1);
+ urls1.add(url2);
+
+ expect(applicationContext.getResources("/WEB-INF/**/tiles*.xml")).andReturn(urls1);
+ expect(applicationContext.getResources("classpath*:META-INF/**/tiles*.xml")).andReturn(null);
+
+ replay(applicationContext, contextFactory);
+ List<URL> urls = factory.getSourceURLs(applicationContext, contextFactory);
+ assertEquals(1, urls.size());
+ assertTrue(urls.contains(url1));
+ verify(applicationContext, contextFactory);
+ }
+
+ /**
* Test method for
* {@link CompleteAutoloadTilesContainerFactory
* #createDefinitionsReader(ApplicationContext, TilesRequestContextFactory)}
Propchange: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Nov 15 14:02:46 2009
@@ -1,3 +1,3 @@
-/tiles/framework/trunk/tiles-test-pom/tiles-test:829356
+/tiles/framework/trunk/tiles-test-pom/tiles-test:829356,836356
/tiles/sandbox/trunk/tiles-test:740289
/tiles/sandbox/trunk/tiles-test-sandbox:740290-745038,747727-751891
Propchange: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tools.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Nov 15 14:02:46 2009
@@ -1 +1 @@
-/tiles/framework/trunk/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tools.xml:829356
+/tiles/framework/trunk/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tools.xml:829356,836356