deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [2/2] git commit: DELTASPIKE-423 filter inherited @Folder meta-data
Date Sat, 05 Oct 2013 12:56:13 GMT
DELTASPIKE-423 filter inherited @Folder meta-data

 (DefaultViewPathConfigDescriptor provides the final value via @View#basePath)


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/bdc9cdce
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/bdc9cdce
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/bdc9cdce

Branch: refs/heads/master
Commit: bdc9cdce6acae2df460897ff1df63e3265df67a3
Parents: c24b682
Author: gpetracek <gpetracek@apache.org>
Authored: Sat Oct 5 14:38:18 2013 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Sat Oct 5 14:48:22 2013 +0200

----------------------------------------------------------------------
 .../config/view/DefaultConfigNodeConverter.java | 17 +++++++++++++++-
 .../navigation/syntax/uc003/ViewConfigTest.java | 11 ++++++++++
 .../navigation/syntax/uc004/ViewConfigTest.java | 20 +++++++++++++++++++
 .../navigation/syntax/uc005/ViewConfigTest.java | 17 ++++++++++++++++
 .../navigation/syntax/uc006/ViewConfigTest.java |  1 +
 .../navigation/syntax/uc007/ViewConfigTest.java | 21 ++++++++++++++++++++
 .../navigation/syntax/uc008/ViewConfigTest.java |  2 ++
 7 files changed, 88 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
index c949dee..d7e6b97 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
@@ -63,7 +63,7 @@ public class DefaultConfigNodeConverter implements ConfigNodeConverter
             View viewAnnotation = findMetaDataByType(mergedMetaData, View.class);
             String viewId = viewAnnotation.basePath() + viewAnnotation.name() + "." + viewAnnotation.extension();
             return new DefaultViewPathConfigDescriptor(viewId, node.getSource(),
-                    mergedMetaData, node.getCallbackDescriptors());
+                    filterInheritedFolderMetaData(mergedMetaData), node.getCallbackDescriptors());
         }
         else
         {
@@ -249,4 +249,19 @@ public class DefaultConfigNodeConverter implements ConfigNodeConverter
         }
         return null;
     }
+
+    private List<Annotation> filterInheritedFolderMetaData(List<Annotation> mergedMetaData)
+    {
+        List<Annotation> result = new ArrayList<Annotation>();
+
+        for (Annotation metaData : mergedMetaData)
+        {
+            if (!Folder.class.equals(metaData.annotationType()))
+            {
+                result.add(metaData);
+            }
+        }
+
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java
index e8aa818..93ca3ef 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc003/ViewConfigTest.java
@@ -207,6 +207,17 @@ public class ViewConfigTest
         Assert.assertEquals(View.Extension.XHTML, (viewConfigDescriptor.getMetaData(View.class).iterator().next()).extension());
 
 
+        ConfigDescriptor folderDescriptor = viewConfigResolver.getConfigDescriptor(Pages.Admin.class);
+
+        Assert.assertNotNull(folderDescriptor);
+        Assert.assertEquals("/pages/admin/", folderDescriptor.getPath());
+        Assert.assertEquals(Pages.Admin.class, folderDescriptor.getConfigClass());
+
+        Assert.assertNotNull(folderDescriptor.getMetaData());
+        Assert.assertEquals(1, folderDescriptor.getMetaData().size());
+        Assert.assertEquals("/pages/admin/", ((Folder)folderDescriptor.getMetaData().iterator().next()).name());
+
+
         viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Admin.Index.class);
 
         Assert.assertNotNull(viewConfigDescriptor);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java
index e67ac4e..fde43e4 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc004/ViewConfigTest.java
@@ -100,6 +100,26 @@ public class ViewConfigTest
         Assert.assertEquals(0, node.getInheritedMetaData().size());
 
 
+        node = this.viewConfigExtension.findNode(Pages.Admin.class);
+
+        Assert.assertNotNull(node);
+        Assert.assertNotNull(node.getParent()); //Pages
+        Assert.assertNotNull(node.getParent().getParent()); //Root
+        Assert.assertNull(node.getParent().getParent().getParent());
+
+        Assert.assertNotNull(node.getChildren());
+        Assert.assertEquals(3, node.getChildren().size());
+
+        Assert.assertNotNull(node.getMetaData());
+        Assert.assertEquals(1, node.getMetaData().size());
+        Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());
+        Assert.assertEquals(View.NavigationMode.REDIRECT, ((View) node.getMetaData().iterator().next()).navigation());
+        Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View) node.getMetaData().iterator().next()).viewParams());
+
+        Assert.assertNotNull(node.getInheritedMetaData());
+        Assert.assertEquals(0, node.getInheritedMetaData().size());
+
+
         node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.class);
 
         Assert.assertNotNull(node);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java
index 6681faa..878e564 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc005/ViewConfigTest.java
@@ -162,6 +162,23 @@ public class ViewConfigTest
         Assert.assertEquals(0, node.getInheritedMetaData().size());
 
 
+        node = this.viewConfigExtension.findNode(Pages.Admin.class);
+
+        Assert.assertNotNull(node);
+        Assert.assertNotNull(node.getParent()); //Pages
+        Assert.assertNotNull(node.getParent().getParent()); //Root
+        Assert.assertNull(node.getParent().getParent().getParent());
+
+        Assert.assertNotNull(node.getChildren());
+        Assert.assertEquals(3, node.getChildren().size());
+
+        Assert.assertNotNull(node.getMetaData());
+        Assert.assertEquals(0, node.getMetaData().size());
+
+        Assert.assertNotNull(node.getInheritedMetaData());
+        Assert.assertEquals(0, node.getInheritedMetaData().size());
+
+
         node = this.viewConfigExtension.findNode(Pages.Admin.Statistics.Home.class);
 
         Assert.assertNotNull(node);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java
index 4fe7945..3c48992 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc006/ViewConfigTest.java
@@ -230,6 +230,7 @@ public class ViewConfigTest
     public void testMetaDataInheritanceInViewConfig()
     {
         this.viewConfigExtension.addPageDefinition(Pages.Index.class);
+        this.viewConfigExtension.addPageDefinition(Pages.Admin.class);
         this.viewConfigExtension.addPageDefinition(Pages.Admin.Index.class);
         this.viewConfigExtension.addPageDefinition(Pages.Admin.Home.class);
         this.viewConfigExtension.addPageDefinition(Pages.Admin.Statistics.Index.class);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java
index 971006d..98db178 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc007/ViewConfigTest.java
@@ -96,6 +96,27 @@ public class ViewConfigTest
         Assert.assertEquals(0, node.getCallbackDescriptors().size());
 
 
+        node = this.viewConfigExtension.findNode(Pages.Public.class);
+
+        Assert.assertNotNull(node);
+        Assert.assertNotNull(node.getParent());
+        Assert.assertNotNull(node.getParent().getParent());
+        Assert.assertNull(node.getParent().getParent().getParent());
+
+        Assert.assertNotNull(node.getChildren());
+        Assert.assertEquals(1, node.getChildren().size());
+
+        Assert.assertNotNull(node.getMetaData());
+        Assert.assertEquals(1, node.getMetaData().size());
+        Assert.assertEquals(TestFacesRedirect.class, node.getMetaData().iterator().next().annotationType());
+
+        Assert.assertNotNull(node.getInheritedMetaData());
+        Assert.assertEquals(0, node.getInheritedMetaData().size());
+
+        Assert.assertNotNull(node.getCallbackDescriptors());
+        Assert.assertEquals(0, node.getCallbackDescriptors().size());
+
+
         node = this.viewConfigExtension.findNode(Pages.Public.Index.class);
 
         Assert.assertNotNull(node);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/bdc9cdce/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java
index a4573b9..0f4585a 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/navigation/syntax/uc008/ViewConfigTest.java
@@ -157,9 +157,11 @@ public class ViewConfigTest
         Assert.assertEquals(Pages.Admin.Index.class, viewConfigDescriptor.getConfigClass());
 
         Assert.assertNotNull(viewConfigDescriptor.getMetaData());
+        Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
         Assert.assertEquals(View.NavigationMode.FORWARD, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
         Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
         Assert.assertEquals("index", viewConfigDescriptor.getMetaData(View.class).iterator().next().name());
         Assert.assertEquals("xhtml", viewConfigDescriptor.getMetaData(View.class).iterator().next().extension());
+        Assert.assertEquals("/pages/admin/", viewConfigDescriptor.getMetaData(View.class).iterator().next().basePath());
     }
 }


Mime
View raw message