myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1004877 - in /myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src: main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ test/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/myfaces/ test/java/org...
Date Wed, 06 Oct 2010 02:16:37 GMT
Author: gpetracek
Date: Wed Oct  6 02:16:36 2010
New Revision: 1004877

URL: http://svn.apache.org/viewvc?rev=1004877&view=rev
Log:
[intermediate result] tests for EXTCDI-36

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/MultipleSimpleNestedConfigs.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding1.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding2.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath1.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath2.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleNestedViewConfig.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleView.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleViewWithManualName.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/TestableViewConfigExtension.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/ViewConfigTest.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/VirtualNesting.java
Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ViewConfigExtension.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ViewConfigExtension.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ViewConfigExtension.java?rev=1004877&r1=1004876&r2=1004877&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ViewConfigExtension.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/config/view/ViewConfigExtension.java
Wed Oct  6 02:16:36 2010
@@ -61,7 +61,7 @@ public class ViewConfigExtension impleme
         }
     }
 
-    private void addPageDefinition(Class pageDefinitionClass)
+    protected void addPageDefinition(Class pageDefinitionClass)
     {
         if(!ViewConfig.class.isAssignableFrom(pageDefinitionClass))
         {
@@ -190,6 +190,19 @@ public class ViewConfigExtension impleme
             className = className.substring(0, 1).toLowerCase() + className.substring(1);
             viewId.append(className);
         }
+        //nested classes with manually defined page name and shared basePath
+        else if(!simpleClassNameToPathMapping.isEmpty())
+        {
+            String className = viewDefinitionClass.getName();
+
+            basePath = "";
+            className = className.substring(className.lastIndexOf(".") + 1);
+            className = convertToPathSyntax(className, simpleClassNameToPathMapping);
+            className = className.substring(0, 1).toLowerCase() + className.substring(1);
+            className = className.substring(0, className.lastIndexOf("/") + 1);
+            className += pageName;
+            viewId.append(className);
+        }
         else
         {
             viewId.append(pageName);
@@ -209,11 +222,25 @@ public class ViewConfigExtension impleme
                 result = rootPath + result.substring(1);
             }
         }
+
+        result = ensureValidViewIds(result);
+
         ViewConfigCache.addViewDefinition(
                 result, new ViewConfigEntry(
                         result, viewDefinitionClass, navigationMode, foundVoters, errorView,
viewMetaDataList));
     }
 
+    private String ensureValidViewIds(String result)
+    {
+        if(!result.startsWith("/"))
+        {
+            result = "/" + result;
+        }
+
+        //TODO
+        return result.replace("///", "/").replace("//", "/");
+    }
+
     private String convertToPathSyntax(String className, Map<String, String> simpleClassNameToPathMapping)
     {
         String[] parts = className.split("\\$");

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/MultipleSimpleNestedConfigs.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/MultipleSimpleNestedConfigs.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/MultipleSimpleNestedConfigs.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/MultipleSimpleNestedConfigs.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+
+/**
+ * Interfaces are primarily supported for multiple nesting.
+ *
+ * @author Gerhard Petracek
+ */
+interface MultipleSimpleNestedConfigs extends ViewConfig
+{
+    public interface Conversations extends MultipleSimpleNestedConfigs
+    {
+        public interface Grouped extends Conversations
+        {
+            @Page
+            public final class Step1 implements Grouped
+            {
+            }
+
+            @Page
+            public final class Step2 implements Grouped
+            {
+            }
+        }
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding1.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding1.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding1.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.NavigationMode;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(basePath = "", navigation = NavigationMode.REDIRECT)
+abstract class NavigationOverriding1 implements ViewConfig
+{
+    @Page
+    public final class RedirectedPage1 extends NavigationOverriding1
+    {
+    }
+
+    @Page(navigation = NavigationMode.FORWARD)
+    public final class ForwardedPage1 extends NavigationOverriding1
+    {
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding2.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding2.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding2.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NavigationOverriding2.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.NavigationMode;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(basePath = "", navigation = NavigationMode.FORWARD)
+abstract class NavigationOverriding2 implements ViewConfig
+{
+    public final class ForwardedPage2 extends NavigationOverriding2
+    {
+    }
+
+    @Page(navigation = NavigationMode.REDIRECT)
+    public final class RedirectedPage2 extends NavigationOverriding2
+    {
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath1.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath1.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath1.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(basePath = "manual")
+abstract class NestedViewConfigWithManualNamesAndSharedBasePath1 implements ViewConfig
+{
+    @Page(name = "page1")
+    public final class Page1 extends NestedViewConfigWithManualNamesAndSharedBasePath1
+    {
+    }
+
+    @Page(name = "page2")
+    public final class Page2 extends NestedViewConfigWithManualNamesAndSharedBasePath1
+    {
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath2.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath2.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath2.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/NestedViewConfigWithManualNamesAndSharedBasePath2.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(basePath = "/manual/")
+abstract class NestedViewConfigWithManualNamesAndSharedBasePath2 implements ViewConfig
+{
+    @Page(name = "/page3")
+    public final class Page1 extends NestedViewConfigWithManualNamesAndSharedBasePath2
+    {
+    }
+
+    @Page(name = "/page4")
+    public final class Page2 extends NestedViewConfigWithManualNamesAndSharedBasePath2
+    {
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleNestedViewConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleNestedViewConfig.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleNestedViewConfig.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleNestedViewConfig.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+abstract class SimpleNestedViewConfig implements ViewConfig
+{
+    @Page
+    public class Page1 implements ViewConfig
+    {
+    }
+
+    @Page
+    public class Page2 extends SimpleNestedViewConfig
+    {
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleView.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleView.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleView.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleView.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page
+class SimpleView implements ViewConfig
+{
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleViewWithManualName.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleViewWithManualName.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleViewWithManualName.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/SimpleViewWithManualName.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(name = "simpleManualPage")
+class SimpleViewWithManualName implements ViewConfig
+{
+}
\ No newline at end of file

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/TestableViewConfigExtension.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/TestableViewConfigExtension.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/TestableViewConfigExtension.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/TestableViewConfigExtension.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension;
+
+/**
+ * @author Gerhard Petracek
+ */
+class TestableViewConfigExtension extends ViewConfigExtension
+{
+    @Override
+    public void addPageDefinition(Class pageDefinitionClass)
+    {
+        super.addPageDefinition(pageDefinitionClass);
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/ViewConfigTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/ViewConfigTest.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/ViewConfigTest.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/ViewConfigTest.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,154 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache;
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigEntry;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.NavigationMode;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ViewConfigTest
+{
+    private TestableViewConfigExtension viewConfigExtension = new TestableViewConfigExtension();
+
+    @Test
+    public void testSimpleCase()
+    {
+        viewConfigExtension.addPageDefinition(SimpleView.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(SimpleView.class).getViewId(), "/simpleView.xhtml");
+    }
+
+    @Test
+    public void testSimpleManualCase()
+    {
+        viewConfigExtension.addPageDefinition(SimpleViewWithManualName.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(SimpleViewWithManualName.class).getViewId(),
+                                                       "/simpleManualPage.xhtml");
+    }
+
+    @Test
+    public void testSimpleNestedCase()
+    {
+        viewConfigExtension.addPageDefinition(SimpleNestedViewConfig.Page1.class);
+        viewConfigExtension.addPageDefinition(SimpleNestedViewConfig.Page2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(SimpleNestedViewConfig.Page1.class).getViewId(),
+                                                       "/simpleNestedViewConfig/page1.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(SimpleNestedViewConfig.Page2.class).getViewId(),
+                                                       "/simpleNestedViewConfig/page2.xhtml");
+    }
+
+    @Test
+    public void testNestedViewConfigWithManualNamesAndSharedBasePath1()
+    {
+        viewConfigExtension.addPageDefinition(NestedViewConfigWithManualNamesAndSharedBasePath1.Page1.class);
+        viewConfigExtension.addPageDefinition(NestedViewConfigWithManualNamesAndSharedBasePath1.Page2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(
+                NestedViewConfigWithManualNamesAndSharedBasePath1.Page1.class).getViewId(),
+                "/manual/page1.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(
+                NestedViewConfigWithManualNamesAndSharedBasePath1.Page2.class).getViewId(),
+                "/manual/page2.xhtml");
+    }
+
+    @Test
+    public void testNestedViewConfigWithManualNamesAndSharedBasePath2()
+    {
+        viewConfigExtension.addPageDefinition(NestedViewConfigWithManualNamesAndSharedBasePath2.Page1.class);
+        viewConfigExtension.addPageDefinition(NestedViewConfigWithManualNamesAndSharedBasePath2.Page2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(
+                NestedViewConfigWithManualNamesAndSharedBasePath2.Page1.class).getViewId(),
+                "/manual/page3.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(
+                NestedViewConfigWithManualNamesAndSharedBasePath2.Page2.class).getViewId(),
+                "/manual/page4.xhtml");
+    }
+
+    @Test
+    public void testVirtualNesting()
+    {
+        viewConfigExtension.addPageDefinition(VirtualNesting.Page1.class);
+        viewConfigExtension.addPageDefinition(VirtualNesting.Page2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(VirtualNesting.Page1.class).getViewId(),
+                                                       "/page1.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(VirtualNesting.Page2.class).getViewId(),
+                                                       "/page2.xhtml");
+    }
+
+    @Test
+    public void testMultipleSimpleNestedConfigs()
+    {
+        viewConfigExtension.addPageDefinition(MultipleSimpleNestedConfigs.Conversations.Grouped.Step1.class);
+        viewConfigExtension.addPageDefinition(MultipleSimpleNestedConfigs.Conversations.Grouped.Step2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(
+                MultipleSimpleNestedConfigs.Conversations.Grouped.Step1.class).getViewId(),
+                "/multipleSimpleNestedConfigs/conversations/grouped/step1.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(
+                MultipleSimpleNestedConfigs.Conversations.Grouped.Step2.class).getViewId(),
+                "/multipleSimpleNestedConfigs/conversations/grouped/step2.xhtml");
+    }
+
+    @Test
+    public void testNavigationOverriding1()
+    {
+        viewConfigExtension.addPageDefinition(NavigationOverriding1.RedirectedPage1.class);
+        viewConfigExtension.addPageDefinition(NavigationOverriding1.ForwardedPage1.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(NavigationOverriding1.RedirectedPage1.class).getViewId(),
+                                                       "/redirectedPage1.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(NavigationOverriding1.ForwardedPage1.class).getViewId(),
+                                                       "/forwardedPage1.xhtml");
+
+        ViewConfigEntry viewConfigEntry =ViewConfigCache.getViewDefinition(NavigationOverriding1.RedirectedPage1.class);
+        assertEquals(NavigationMode.REDIRECT, viewConfigEntry.getNavigationMode());
+
+        viewConfigEntry = ViewConfigCache.getViewDefinition(NavigationOverriding1.ForwardedPage1.class);
+
+        assertEquals(NavigationMode.FORWARD, viewConfigEntry.getNavigationMode());
+    }
+
+    @Test
+    public void testNavigationOverriding2()
+    {
+        viewConfigExtension.addPageDefinition(NavigationOverriding2.RedirectedPage2.class);
+        viewConfigExtension.addPageDefinition(NavigationOverriding2.ForwardedPage2.class);
+
+        assertEquals(ViewConfigCache.getViewDefinition(NavigationOverriding2.RedirectedPage2.class).getViewId(),
+                                                       "/redirectedPage2.xhtml");
+        assertEquals(ViewConfigCache.getViewDefinition(NavigationOverriding2.ForwardedPage2.class).getViewId(),
+                                                       "/forwardedPage2.xhtml");
+
+        ViewConfigEntry viewConfigEntry =ViewConfigCache.getViewDefinition(NavigationOverriding2.RedirectedPage2.class);
+        assertEquals(NavigationMode.REDIRECT, viewConfigEntry.getNavigationMode());
+
+        viewConfigEntry = ViewConfigCache.getViewDefinition(NavigationOverriding2.ForwardedPage2.class);
+
+        assertEquals(NavigationMode.FORWARD, viewConfigEntry.getNavigationMode());
+    }
+}

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/VirtualNesting.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/VirtualNesting.java?rev=1004877&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/VirtualNesting.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/test/java/org/apache/myfaces/extensions/cdi/jsf/test/impl/config/view/VirtualNesting.java
Wed Oct  6 02:16:36 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.extensions.cdi.jsf.test.impl.config.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Page(basePath = "")
+abstract class VirtualNesting implements ViewConfig
+{
+    @Page
+    public final class Page1 extends VirtualNesting
+    {
+    }
+
+    @Page
+    public final class Page2 extends VirtualNesting
+    {
+    }
+}
\ No newline at end of file



Mime
View raw message