deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-463 fixed node-copy
Date Mon, 09 Dec 2013 08:06:40 GMT
Updated Branches:
  refs/heads/master 2ed563da2 -> 249ab699f


DELTASPIKE-463 fixed node-copy


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

Branch: refs/heads/master
Commit: 249ab699ff05f74258586e7dc908b29c83613130
Parents: 2ed563d
Author: gpetracek <gpetracek@apache.org>
Authored: Mon Dec 9 08:53:02 2013 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Mon Dec 9 09:05:58 2013 +0100

----------------------------------------------------------------------
 .../jsf/impl/config/view/FolderConfigNode.java  | 13 ++++
 .../impl/config/view/custom/uc007/Pages.java    | 35 +++++++++
 .../view/custom/uc007/ViewConfigTest.java       | 80 ++++++++++++++++++++
 3 files changed, 128 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/249ab699/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
index cf7f451..3a357c7 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
@@ -18,9 +18,12 @@
  */
 package org.apache.deltaspike.jsf.impl.config.view;
 
+import org.apache.deltaspike.core.api.config.view.metadata.CallbackDescriptor;
 import org.apache.deltaspike.core.spi.config.view.ViewConfigNode;
 
 import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 public class FolderConfigNode extends AbstractConfigNode
@@ -38,6 +41,16 @@ public class FolderConfigNode extends AbstractConfigNode
     {
         super(nodeToCopy.getParent(), nodeToCopy.getMetaData());
         getInheritedMetaData().addAll(nodeToCopy.getInheritedMetaData());
+        getChildren().addAll(nodeToCopy.getChildren());
+
+        for (Map.Entry<Class<? extends Annotation>, List<CallbackDescriptor>>
callbackDescriptorEntry :
+                nodeToCopy.getCallbackDescriptors().entrySet())
+        {
+            for (CallbackDescriptor callbackDescriptor : callbackDescriptorEntry.getValue())
+            {
+                registerCallbackDescriptors(callbackDescriptorEntry.getKey(), callbackDescriptor);
+            }
+        }
         this.nodeId = viewConfigClass;
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/249ab699/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/Pages.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/Pages.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/Pages.java
new file mode 100644
index 0000000..3c59e99
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/Pages.java
@@ -0,0 +1,35 @@
+/*
+ * 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.deltaspike.test.jsf.impl.config.view.custom.uc007;
+
+import org.apache.deltaspike.core.api.config.view.ViewConfig;
+import org.apache.deltaspike.core.spi.config.view.ViewConfigRoot;
+import org.apache.deltaspike.jsf.api.config.view.View;
+import org.apache.deltaspike.jsf.impl.config.view.DefaultViewConfigInheritanceStrategy;
+
+import static org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode.INCLUDE;
+
+//just for testing root-node replacement in combination with a view-config
+@ViewConfigRoot(viewConfigInheritanceStrategy = DefaultViewConfigInheritanceStrategy.class)
+interface Pages extends ViewConfig
+{
+    class Index implements Pages
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/249ab699/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/ViewConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/ViewConfigTest.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/ViewConfigTest.java
new file mode 100644
index 0000000..a98b905
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/config/view/custom/uc007/ViewConfigTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.deltaspike.test.jsf.impl.config.view.custom.uc007;
+
+import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor;
+import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
+import org.apache.deltaspike.core.spi.config.view.ViewConfigNode;
+import org.apache.deltaspike.jsf.api.config.view.View;
+import org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension;
+import org.apache.deltaspike.jsf.impl.config.view.ViewConfigResolverProducer;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ViewConfigTest
+{
+    private ViewConfigExtension viewConfigExtension;
+
+    private ViewConfigResolverProducer viewConfigResolverProducer;
+
+    @Before
+    public void before()
+    {
+        this.viewConfigExtension = new ViewConfigExtension();
+        this.viewConfigResolverProducer = new ViewConfigResolverProducer(this.viewConfigExtension);
+    }
+
+    @After
+    public void after()
+    {
+        this.viewConfigExtension.freeViewConfigCache(null);
+    }
+
+    @Test
+    public void testMetaDataTreeWithRandomOrder()
+    {
+        this.viewConfigExtension.addPageDefinition(Pages.Index.class);
+        this.viewConfigExtension.addPageDefinition(Pages.class); //simulates random processing-order
+
+        ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Index.class);
+
+        Assert.assertNotNull(node);
+        Assert.assertNotNull(node.getParent());
+        Assert.assertNotNull(node.getParent().getParent());
+        Assert.assertNull(node.getParent().getParent().getParent());
+
+        Assert.assertNotNull(node.getMetaData());
+        Assert.assertEquals(0, node.getMetaData().size());
+    }
+
+    @Test
+    public void testViewConfigWithRandomOrder()
+    {
+        this.viewConfigExtension.addPageDefinition(Pages.Index.class);
+        this.viewConfigExtension.addPageDefinition(Pages.class); //simulates random processing-order
+
+        ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
+        ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Index.class);
+
+        Assert.assertEquals("/pages/index.xhtml", viewConfigDescriptor.getViewId());
+        Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
+    }
+}


Mime
View raw message