You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2011/03/16 16:36:55 UTC

svn commit: r1082168 [2/2] - in /myfaces/extensions/cdi/trunk: ./ examples/jsf-examples/hello_myfaces-codi_jsf20/ test-modules/ test-modules/base-test-infrastructure-module/ test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/...

Added: myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/HybridStandaloneLifeCycle.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/HybridStandaloneLifeCycle.java?rev=1082168&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/HybridStandaloneLifeCycle.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/HybridStandaloneLifeCycle.java Wed Mar 16 15:36:53 2011
@@ -0,0 +1,77 @@
+/*
+ * 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.test.owb;
+
+import org.apache.myfaces.test.mock.MockHttpServletRequest;
+import org.apache.webbeans.cditest.owb.MockHttpSession;
+import org.apache.webbeans.cditest.owb.MockServletContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.el.ELContextStore;
+import org.apache.webbeans.lifecycle.StandaloneLifeCycle;
+
+import javax.servlet.ServletRequestEvent;
+
+/**
+ * @author Gerhard Petracek
+ */
+class HybridStandaloneLifeCycle extends StandaloneLifeCycle
+{
+    private MockServletContext servletContext;
+    private MockHttpSession session;
+
+    private MockHttpServletRequest request;
+
+    public HybridStandaloneLifeCycle(MockServletContext servletContext,
+                                      MockHttpSession session,
+                                      MockHttpServletRequest request)
+    {
+        this.servletContext = servletContext;
+        this.session = session;
+        this.request = request;
+    }
+
+    @Override
+    public void beforeStartApplication(Object object)
+    {
+        ContextFactory.initRequestContext(new ServletRequestEvent(this.servletContext, this.request));
+        ContextFactory.initSessionContext(this.session);
+        ContextFactory.initConversationContext(null);
+        ContextFactory.initApplicationContext(this.servletContext);
+        ContextFactory.initSingletonContext(this.servletContext);
+    }
+
+    @Override
+    public void beforeStopApplication(Object endObject)
+    {
+        ContextFactory.destroyRequestContext(new ServletRequestEvent(this.servletContext, this.request));
+        ContextFactory.destroySessionContext(this.session);
+        ContextFactory.destroyConversationContext();
+        ContextFactory.destroyApplicationContext(this.servletContext);
+        ContextFactory.destroySingletonContext(this.servletContext);
+
+        ContextFactory.cleanUpContextFactory();
+
+        // clean up the EL caches after each request
+        ELContextStore elStore = ELContextStore.getInstance(false);
+        if (elStore != null)
+        {
+            elStore.destroyELContextStore();
+        }
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/ServletOpenWebBeans10TestContainer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/ServletOpenWebBeans10TestContainer.java?rev=1082168&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/ServletOpenWebBeans10TestContainer.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/ServletOpenWebBeans10TestContainer.java Wed Mar 16 15:36:53 2011
@@ -0,0 +1,57 @@
+/*
+ * 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.test.owb;
+
+import org.apache.myfaces.extensions.cdi.test.spi.WebAppAwareCdiTestContainer;
+import org.apache.webbeans.context.ContextFactory;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ServletOpenWebBeans10TestContainer
+        extends AbstractOpenWebBeans10TestContainer implements WebAppAwareCdiTestContainer
+{
+    public ServletOpenWebBeans10TestContainer()
+    {
+        this.testContainer = new HybridCdiTestOpenWebBeansContainer();
+    }
+
+    public void beginSession()
+    {
+        ContextFactory.activateContext(SessionScoped.class);
+    }
+
+    public void beginRequest()
+    {
+        ContextFactory.activateContext(RequestScoped.class);
+    }
+
+    public void endRequest()
+    {
+        ContextFactory.deActivateContext(RequestScoped.class);
+    }
+
+    public void endSession()
+    {
+        ContextFactory.deActivateContext(SessionScoped.class);
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/StandaloneOpenWebBeans10TestContainer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/StandaloneOpenWebBeans10TestContainer.java?rev=1082168&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/StandaloneOpenWebBeans10TestContainer.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/owb/StandaloneOpenWebBeans10TestContainer.java Wed Mar 16 15:36:53 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.test.owb;
+
+import org.apache.webbeans.cditest.CdiTestContainerLoader;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class StandaloneOpenWebBeans10TestContainer extends AbstractOpenWebBeans10TestContainer
+{
+    public StandaloneOpenWebBeans10TestContainer()
+    {
+        this.testContainer = CdiTestContainerLoader.getCdiContainer();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer?rev=1082168&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer (added)
+++ myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/src/main/resources/META-INF/services/org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer Wed Mar 16 15:36:53 2011
@@ -0,0 +1,2 @@
+org.apache.myfaces.extensions.cdi.test.owb.StandaloneOpenWebBeans10TestContainer
+org.apache.myfaces.extensions.cdi.test.owb.ServletOpenWebBeans10TestContainer
\ No newline at end of file

Modified: myfaces/extensions/cdi/trunk/test-modules/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/pom.xml?rev=1082168&r1=1082167&r2=1082168&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/pom.xml Wed Mar 16 15:36:53 2011
@@ -1,62 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <packaging>pom</packaging>
-
-    <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
-    <artifactId>myfaces-extcdi-test-project</artifactId>
-    <version>0.9.4-SNAPSHOT</version>
-
-    <name>MyFaces Extensions-CDI Test-Project</name>
-
-    <parent>
-        <groupId>org.apache.myfaces.extensions.cdi</groupId>
-        <artifactId>myfaces-extcdi-parent</artifactId>
-        <version>0.9.4-SNAPSHOT</version>
-    </parent>
-
-    <profiles>
-        <profile>
-            <id>test-infrastructure</id>
-            <modules>
-                <module>base-test-infrastructure-module</module>
-            </modules>
-        </profile>
-        
-        <!-- use mvn clean install -Pwebapptest to run the webapp-tests -->
-        <profile>
-            <id>webapptest</id>
-            <modules>
-                <module>webapp-test-module</module>
-            </modules>
-        </profile>
-
-        <!-- use mvn clean install -Pcargo to run the cargo-htmlunit-tests -->
-        <profile>
-            <id>cargo</id>
-            <modules>
-                <module>cargo-test-module</module>
-            </modules>
-        </profile>
-    </profiles>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <packaging>pom</packaging>
+
+    <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+    <artifactId>myfaces-extcdi-test-project</artifactId>
+    <version>0.9.4-SNAPSHOT</version>
+
+    <name>MyFaces Extensions-CDI Test-Project</name>
+
+    <parent>
+        <groupId>org.apache.myfaces.extensions.cdi</groupId>
+        <artifactId>myfaces-extcdi-parent</artifactId>
+        <version>0.9.4-SNAPSHOT</version>
+    </parent>
+
+    <profiles>
+        <profile>
+            <id>test-infrastructure</id>
+            <modules>
+                <module>base-test-infrastructure-module</module>
+                <module>owb10-support-module</module>
+                <module>jsf12-support-module</module>
+            </modules>
+        </profile>
+        
+        <!-- use mvn clean install -Pwebapptest to run the webapp-tests -->
+        <profile>
+            <id>webapptest</id>
+            <modules>
+                <module>webapp-test-module</module>
+            </modules>
+        </profile>
+
+        <!-- use mvn clean install -Pcargo to run the cargo-htmlunit-tests -->
+        <profile>
+            <id>cargo</id>
+            <modules>
+                <module>cargo-test-module</module>
+            </modules>
+        </profile>
+    </profiles>
+
+</project>