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/25 05:25:55 UTC

svn commit: r1085251 - 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/extens...

Author: gpetracek
Date: Fri Mar 25 04:25:54 2011
New Revision: 1085251

URL: http://svn.apache.org/viewvc?rev=1085251&view=rev
Log:
EXTCDI-157 moving junit dependencies to a specialized support module

Added:
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractJsfAwareTestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractServletAwareTestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/TestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractContainerAwareCargoTestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractSimpleCargoTestStrategy.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java
Removed:
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java
Modified:
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml
    myfaces/extensions/cdi/trunk/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/pom.xml

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf20/pom.xml Fri Mar 25 04:25:54 2011
@@ -90,7 +90,7 @@
         <!-- test dependencies -->
         <dependency>
             <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
-            <artifactId>myfaces-extcdi-base-test-infrastructure</artifactId>
+            <artifactId>myfaces-extcdi-junit-support-module</artifactId>
             <scope>test</scope>
         </dependency>
 
@@ -599,7 +599,7 @@
 
                 <dependency>
                     <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
-                    <artifactId>myfaces-extcdi-base-test-infrastructure</artifactId>
+                    <artifactId>myfaces-extcdi-junit-support-module</artifactId>
                     <scope>test</scope>
                 </dependency>
 

Modified: myfaces/extensions/cdi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/pom.xml Fri Mar 25 04:25:54 2011
@@ -266,7 +266,13 @@
                 <artifactId>myfaces-extcdi-base-test-infrastructure</artifactId>
                 <version>0.9.4-SNAPSHOT</version>
             </dependency>
-            
+
+            <dependency>
+                <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+                <artifactId>myfaces-extcdi-junit-support-module</artifactId>
+                <version>0.9.4-SNAPSHOT</version>
+            </dependency>
+
             <dependency>
                 <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
                 <artifactId>myfaces-extcdi-owb-support-module</artifactId>

Modified: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/pom.xml Fri Mar 25 04:25:54 2011
@@ -61,12 +61,6 @@
         </dependency>
 
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
             <scope>provided</scope>

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractCdiAwareTestStrategy.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,90 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.cdi.test.TestContainerFactory;
+import org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer;
+
+import javax.enterprise.context.ContextNotActiveException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Allows dependency injection in (standalone) JUnit tests.
+ * For implementing unit tests with servlet-scopes or CODI unit tests use
+ * {@link AbstractServletAwareTestStrategy} or {@link AbstractJsfAwareTestStrategy}
+ *
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractCdiAwareTestStrategy implements TestStrategy
+{
+    protected CdiTestContainer testContainer;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void beforeMethod()
+    {
+        before();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void afterMethod()
+    {
+        try
+        {
+            after();
+        }
+        catch (ContextNotActiveException e)
+        {
+            Logger logger = Logger.getLogger(AbstractServletAwareTestStrategy.class.getName());
+
+            if (logger.isLoggable(Level.WARNING))
+            {
+                logger.log(Level.WARNING, "this exception usually occurs due to an owb issue", e);
+            }
+        }
+    }
+
+    /**
+     * Bootstraps a new container
+     */
+    //@Before
+    public void before()
+    {
+        this.testContainer = TestContainerFactory.createTestContainer(CdiTestContainer.class);
+        this.testContainer.initEnvironment();
+        this.testContainer.startContainer();
+        this.testContainer.startContexts();
+
+        this.testContainer.injectFields(this);
+    }
+
+    /**
+     * Stops the current container
+     */
+    //@After
+    public void after()
+    {
+        this.testContainer.stopContexts();
+        this.testContainer.stopContainer();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractJsfAwareTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractJsfAwareTestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractJsfAwareTestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractJsfAwareTestStrategy.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.cdi.test.TestContainerFactory;
+import org.apache.myfaces.extensions.cdi.test.spi.WebAppTestContainer;
+
+/**
+ * Base class which can be used for CODI unit-tests
+ *
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractJsfAwareTestStrategy extends AbstractServletAwareTestStrategy
+{
+    protected WebAppTestContainer webAppTestContainer;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@Before
+    public void before()
+    {
+        this.webAppTestContainer = TestContainerFactory.createTestContainer(WebAppTestContainer.class);
+
+        this.webAppTestContainer.initEnvironment();
+        this.webAppTestContainer.startContainer();
+
+        super.before();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@After
+    public void after()
+    {
+        super.after();
+        this.webAppTestContainer.stopContainer();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractServletAwareTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractServletAwareTestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractServletAwareTestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/AbstractServletAwareTestStrategy.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,94 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.cdi.test.TestContainerFactory;
+import org.apache.myfaces.extensions.cdi.test.spi.CdiTestContainer;
+import org.apache.myfaces.extensions.cdi.test.spi.ServletContainerAwareCdiTestContainer;
+
+import javax.enterprise.context.ContextNotActiveException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Allows dependency injection in JUnit tests and implementing JUnit tests in web-projects.
+ *
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractServletAwareTestStrategy implements TestStrategy
+{
+    protected CdiTestContainer testContainer;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void beforeMethod()
+    {
+        before();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void afterMethod()
+    {
+        try
+        {
+            after();
+        }
+        catch (ContextNotActiveException e)
+        {
+            Logger logger = Logger.getLogger(AbstractServletAwareTestStrategy.class.getName());
+
+            if(logger.isLoggable(Level.WARNING))
+            {
+                logger.log(Level.WARNING, "this exception usually occurs due to an owb issue", e);
+            }
+        }
+    }
+
+    /**
+     * Bootstraps a new container
+     */
+    //@Before
+    public void before()
+    {
+        this.testContainer = TestContainerFactory.createTestContainer(ServletContainerAwareCdiTestContainer.class);
+
+        this.testContainer.initEnvironment();
+        this.testContainer.startContainer();
+        this.testContainer.startContexts();
+        ((ServletContainerAwareCdiTestContainer)this.testContainer).startSession();
+        ((ServletContainerAwareCdiTestContainer)this.testContainer).startRequest();
+
+        this.testContainer.injectFields(this);
+    }
+
+    /**
+     * Stops the current container
+     */
+    //@After
+    public void after()
+    {
+        ((ServletContainerAwareCdiTestContainer)this.testContainer).stopRequest();
+        ((ServletContainerAwareCdiTestContainer)this.testContainer).stopSession();
+        this.testContainer.stopContexts();
+        this.testContainer.stopContainer();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/TestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/TestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/TestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/TestStrategy.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,31 @@
+/*
+ * 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.strategy;
+
+/**
+ * Decouples the default implementations from a concrete test framework
+ *
+ * @author Gerhard Petracek
+ */
+public interface TestStrategy
+{
+    void beforeMethod();
+
+    void afterMethod();
+}

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractContainerAwareCargoTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractContainerAwareCargoTestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractContainerAwareCargoTestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractContainerAwareCargoTestStrategy.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,139 @@
+/*
+ * 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.strategy.cargo;
+
+import com.gargoylesoftware.htmlunit.BrowserVersion;
+import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.apache.myfaces.extensions.cdi.test.cargo.TestConfiguration;
+import org.apache.myfaces.extensions.cdi.test.strategy.AbstractJsfAwareTestStrategy;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * @author Gerhard Petracek
+ * @author Jakob Korherr
+ */
+@Typed()
+public abstract class AbstractContainerAwareCargoTestStrategy extends AbstractJsfAwareTestStrategy
+{
+    private static final String CARGO_CONTEXT_PROPERTY = "cargo.context";
+    private static final String CARGO_PORT_PROPERTY = "cargo.port";
+
+    private static final String DEFAULT_CONTEXT = "cargo-test";
+    private static final String DEFAULT_PORT = "8080";
+
+    protected static String baseUrl = null;
+
+    protected WebClient webClient;
+
+    protected TestConfiguration getTestConfiguration()
+    {
+        return new TestConfiguration()
+        {
+            public WebClient getWebClient()
+            {
+                return webClient;
+            }
+
+            public String getBaseURL()
+            {
+                initBaseURL();
+                return baseUrl;
+            }
+
+            public boolean isCheckWindowId()
+            {
+                return true;
+            }
+        };
+    }
+
+    protected void initBaseURL()
+    {
+        if(baseUrl != null)
+        {
+            return;
+        }
+
+        baseUrl = getCustomBaseURL();
+
+        if(baseUrl != null)
+        {
+            return;
+        }
+
+        String port = System.getProperty(CARGO_PORT_PROPERTY);
+        if (port == null)
+        {
+            port = DEFAULT_PORT;
+        }
+
+        String context = System.getProperty(CARGO_CONTEXT_PROPERTY);
+        if (context == null)
+        {
+            context = DEFAULT_CONTEXT;
+        }
+
+        baseUrl = "http://localhost:" + port + "/" + context + "/";
+    }
+
+    protected String getCustomBaseURL()
+    {
+        //override if needed
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@Before
+    public void before()
+    {
+        super.before();
+
+        webClient = new WebClient(getBrowserVersion());
+        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@After
+    public void after()
+    {
+        super.after();
+
+        webClient.closeAllWindows();
+        webClient = null;
+    }
+
+    /**
+     * Returns the Browser to use.
+     * Default is Firefox 3.6, override to change this.
+     *
+     * @return default browser
+     */
+    public BrowserVersion getBrowserVersion()
+    {
+        return BrowserVersion.FIREFOX_3_6;
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractSimpleCargoTestStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractSimpleCargoTestStrategy.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractSimpleCargoTestStrategy.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/base-test-infrastructure-module/src/main/java/org/apache/myfaces/extensions/cdi/test/strategy/cargo/AbstractSimpleCargoTestStrategy.java Fri Mar 25 04:25:54 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.strategy.cargo;
+
+import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache;
+
+import javax.enterprise.inject.Typed;
+
+/**
+ * Removes support of dependency injection for a higher performances if it isn't needed.
+ *
+ * @author Gerhard Petracek
+ */
+@Typed()
+public abstract class AbstractSimpleCargoTestStrategy extends AbstractContainerAwareCargoTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@Before
+    public void before()
+    {
+        webClient = new WebClient(getBrowserVersion());
+        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    //@After
+    public void after()
+    {
+        webClient.closeAllWindows();
+        webClient = null;
+        ViewConfigCache.reset();
+    }
+}

Modified: myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-test-module/pom.xml Fri Mar 25 04:25:54 2011
@@ -146,7 +146,7 @@
 
         <dependency>
             <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
-            <artifactId>myfaces-extcdi-base-test-infrastructure</artifactId>
+            <artifactId>myfaces-extcdi-junit-support-module</artifactId>
             <scope>test</scope>
         </dependency>
 

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml Fri Mar 25 04:25:54 2011
@@ -0,0 +1,77 @@
+<?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>jar</packaging>
+
+    <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+    <artifactId>myfaces-extcdi-junit-support-module</artifactId>
+    <version>0.9.4-SNAPSHOT</version>
+
+    <name>MyFaces Extensions-CDI JUnit-Support Module</name>
+
+    <parent>
+        <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+        <artifactId>myfaces-extcdi-test-project</artifactId>
+        <version>0.9.4-SNAPSHOT</version>
+    </parent>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+            <artifactId>myfaces-extcdi-base-test-infrastructure</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
+            <artifactId>myfaces-extcdi-core-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
+            <artifactId>myfaces-extcdi-core-impl</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
+            <artifactId>myfaces-extcdi-jsf12-module-impl</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        
+    </dependencies>
+
+</project>

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.cargo;
+
+import org.apache.myfaces.extensions.cdi.test.strategy.cargo.AbstractContainerAwareCargoTestStrategy;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractContainerAwareCargoTest extends AbstractContainerAwareCargoTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Before
+    @Override
+    public void beforeMethod()
+    {
+        super.beforeMethod();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @After
+    @Override
+    public void afterMethod()
+    {
+        super.afterMethod();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.cargo;
+
+import org.apache.myfaces.extensions.cdi.test.strategy.cargo.AbstractSimpleCargoTestStrategy;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractSimpleCargoTest extends AbstractSimpleCargoTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Before
+    @Override
+    public void beforeMethod()
+    {
+        super.beforeMethod();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @After
+    @Override
+    public void afterMethod()
+    {
+        super.afterMethod();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java Fri Mar 25 04:25:54 2011
@@ -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.myfaces.extensions.cdi.test.cargo;
+
+import java.io.IOException;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Deprecated
+public class ContainerNotStartedException extends RuntimeException
+{
+    private static final long serialVersionUID = -2362433864481560645L;
+
+    public ContainerNotStartedException(IOException e)
+    {
+        super(e);
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,310 @@
+/*
+ * 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.cargo;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.http.conn.HttpHostConnectException;
+import org.apache.myfaces.extensions.cdi.core.api.UnhandledException;
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigCache;
+import org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension;
+import org.apache.myfaces.extensions.cdi.test.strategy.AbstractJsfAwareTestStrategy;
+import org.apache.myfaces.extensions.cdi.test.strategy.cargo.AbstractSimpleCargoTestStrategy;
+
+import javax.enterprise.inject.Typed;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Typed()
+public class SimplePageInteraction
+{
+    private static final Logger LOGGER = Logger.getLogger(SimplePageInteraction.class.getName());
+
+    private WebClient webClient;
+
+    private String baseURL;
+
+    private HtmlPage currentPage;
+    private HtmlForm currentForm;
+
+    private String initialWindowId;
+    private String okButtonId = "ok";
+    private boolean checkWindowId;
+    private boolean defaultFormActive = true;
+
+    public SimplePageInteraction(TestConfiguration testConfiguration)
+    {
+        this.webClient = testConfiguration.getWebClient();
+        this.baseURL = testConfiguration.getBaseURL();
+        this.checkWindowId = testConfiguration.isCheckWindowId();
+    }
+
+    public SimplePageInteraction with(Class<? extends ViewConfig> pageDefinition)
+    {
+        checkUsage();
+        new ViewConfigExtension()
+        {
+            @Override
+            public void addPageDefinition(Class pageDefinitionClass)
+            {
+                super.addPageDefinition(pageDefinitionClass);
+            }
+        }.addPageDefinition(pageDefinition);
+        return this;
+    }
+
+    protected void checkUsage()
+    {
+        @SuppressWarnings({"ThrowableInstanceNeverThrown"})
+        RuntimeException runtimeException = new RuntimeException();
+
+        StackTraceElement[] stackTrace = runtimeException.getStackTrace();
+
+        Class currentClass;
+        for(StackTraceElement element : stackTrace)
+        {
+            currentClass = ClassUtils.tryToLoadClassForName(element.getClassName());
+            if(currentClass == null)
+            {
+                continue;
+            }
+
+            if(AbstractJsfAwareTestStrategy.class.isAssignableFrom(currentClass) &&
+                    !AbstractSimpleCargoTestStrategy.class.isAssignableFrom(currentClass))
+            {
+                LOGGER.warning(getClass().getName() + "#with is only required for tests which extend " +
+                    AbstractSimpleCargoTestStrategy.class.getName() + ". It's used with " + element.getClassName());
+                return;
+            }
+        }
+    }
+
+    public SimplePageInteraction start(Class<? extends ViewConfig> pageDefinition)
+    {
+        this.currentPage = getPage(pageDefinition);
+        this.initialWindowId = getCurrentWindowId();
+
+        return this;
+    }
+
+    public SimplePageInteraction useDefaultForm()
+    {
+        if(this.defaultFormActive)
+        {
+            return useForm("mainForm");
+        }
+        return this;
+    }
+
+    public SimplePageInteraction useForm(String formId)
+    {
+        this.currentForm = this.currentPage.getFormByName(formId);
+        this.defaultFormActive = false;
+        return this;
+    }
+
+    public SimplePageInteraction useIdForOkButton(String okButtonId)
+    {
+        this.okButtonId = okButtonId;
+        return this;
+    }
+
+    public SimplePageInteraction setValue(String inputId, String value)
+    {
+        setInputValue(this.currentPage, inputId, value);
+        return this;
+    }
+
+    public SimplePageInteraction clickOk()
+    {
+        return clickOk(null);
+    }
+
+    public SimplePageInteraction clickOk(Class<? extends ViewConfig> expectedPage)
+    {
+        click(this.okButtonId, viewId(expectedPage));
+
+        if(expectedPage != null)
+        {
+            checkCurrentPage(expectedPage);
+        }
+
+        return this;
+    }
+
+    public SimplePageInteraction click(String id)
+    {
+        click(id, null);
+        return this;
+    }
+
+    public SimplePageInteraction checkState(Class<? extends ViewConfig> expectedPage)
+    {
+        checkCurrentPage(expectedPage);
+        checkCurrentWindowId();
+        return this;
+    }
+
+    public SimplePageInteraction checkCurrentPage(Class<? extends ViewConfig> expectedPage)
+    {
+        assertTrue(url(this.currentPage).contains(viewId(expectedPage)));
+        return this;
+    }
+
+    public SimplePageInteraction checkCurrentWindowId()
+    {
+        if(this.checkWindowId)
+        {
+            assertEquals(this.initialWindowId, getCurrentWindowId());
+        }
+        return this;
+    }
+
+    public SimplePageInteraction checkTextValue(String inputId, String expectedValue)
+    {
+        return checkValue(inputId, expectedValue, true);
+    }
+
+    public SimplePageInteraction checkInputValue(String inputId, String expectedValue)
+    {
+        return checkValue(inputId, expectedValue, false);
+    }
+
+    protected SimplePageInteraction checkValue(String inputId, String expectedValue, boolean outputText)
+    {
+        assertEquals(expectedValue, getValue(this.currentPage, inputId, outputText));
+        return this;
+    }
+
+    protected String getValue(HtmlPage htmlPage, String id, boolean outputText)
+    {
+        if(outputText)
+        {
+            return htmlPage.getElementById(id).getTextContent();
+        }
+        return htmlPage.getElementById(id).getAttribute("value");
+    }
+
+    protected void setInputValue(HtmlPage htmlPage, String inputId, String value)
+    {
+        setInputValue(htmlPage, this.currentForm, inputId, value);
+    }
+
+    protected void setInputValue(HtmlPage htmlPage, HtmlForm htmlForm, String inputId, String value)
+    {
+        try
+        {
+            htmlForm.getInputByName(inputId).setValueAttribute(value);
+        }
+        catch (ElementNotFoundException e)
+        {
+            ((HtmlInput)htmlPage.getElementById(inputId)).setValueAttribute(value);
+        }
+    }
+
+    protected String getCurrentWindowId()
+    {
+        //TODO
+        return this.currentPage.getUrl().getQuery();
+    }
+
+    protected HtmlPage getPage(Class<? extends ViewConfig> pageDefinition)
+    {
+        return getPage(ViewConfigCache.getViewConfig(pageDefinition).getViewId());
+    }
+
+    protected HtmlPage getPage(String viewId)
+    {
+        try
+        {
+            if(viewId.startsWith("/"))
+            {
+                viewId = viewId.substring(1);
+            }
+
+            return this.webClient.getPage(this.baseURL + viewId);
+        }
+        catch (IOException e)
+        {
+            if(e instanceof HttpHostConnectException)
+            {
+                throw new ContainerNotStartedException(e);
+            }
+            else
+            {
+                throw new UnhandledException(e);
+            }
+        }
+    }
+
+    protected void click(String id, String expectedTarget)
+    {
+        try
+        {
+            HtmlInput commandNode;
+
+            try
+            {
+                commandNode = this.currentForm.getInputByName(id);
+            }
+            catch (ElementNotFoundException e)
+            {
+                //in case of get-requests it isn't required that the element is in a form
+                commandNode = this.currentPage.getHtmlElementById(id);
+            }
+
+            this.currentPage = commandNode.click();
+            useDefaultForm();
+
+            if(expectedTarget != null)
+            {
+                assertTrue(url(this.currentPage).contains(expectedTarget));
+            }
+        }
+        catch (IOException e)
+        {
+            throw new UnhandledException(e);
+        }
+    }
+
+    protected String viewId(Class<? extends ViewConfig> pageDefinition)
+    {
+        if(pageDefinition == null)
+        {
+            return null;
+        }
+        return ViewConfigCache.getViewConfig(pageDefinition).getViewId();
+    }
+
+    protected String url(HtmlPage htmlPage)
+    {
+        return htmlPage.getUrl().toString();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,88 @@
+/*
+ * 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.cargo.runner;
+
+import org.apache.myfaces.extensions.cdi.test.cargo.ContainerNotStartedException;
+import org.junit.Ignore;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.internal.runners.model.EachTestNotifier;
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+import java.util.logging.Logger;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Deprecated
+public class JUnit4WithCargo extends BlockJUnit4ClassRunner
+{
+    private static final Logger LOGGER = Logger.getLogger(JUnit4WithCargo.class.getName());
+
+    /**
+     * {@inheritDoc}
+     */
+    public JUnit4WithCargo(Class<?> testClass) throws InitializationError
+    {
+        super(testClass);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void runChild(FrameworkMethod method, RunNotifier notifier)
+    {
+        Description description = describeChild(method);
+        EachTestNotifier eachTestNotifier = new EachTestNotifier(notifier, description);
+
+        if (method.getAnnotation(Ignore.class) != null)
+        {
+            eachTestNotifier.fireTestIgnored();
+            return;
+        }
+
+        eachTestNotifier.fireTestStarted();
+
+        try
+        {
+            methodBlock(method).evaluate();
+        }
+        catch (AssumptionViolatedException e)
+        {
+            eachTestNotifier.addFailedAssumption(e);
+        }
+        catch (ContainerNotStartedException e)
+        {
+            LOGGER.fine("In this step the container isn't started -> test result is ignored for now. " +
+                    "Please make sure that the test gets executed in a later phase.");
+        }
+        catch (Throwable e)
+        {
+            eachTestNotifier.addFailure(e);
+        }
+        finally
+        {
+            eachTestNotifier.fireTestFinished();
+        }
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractCdiAwareTest.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.junit4;
+
+import org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractCdiAwareTest extends AbstractCdiAwareTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Before
+    @Override
+    public void beforeMethod()
+    {
+        super.beforeMethod();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @After
+    @Override
+    public void afterMethod()
+    {
+        super.afterMethod();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractJsfAwareTest.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.junit4;
+
+import org.apache.myfaces.extensions.cdi.test.strategy.AbstractJsfAwareTestStrategy;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractJsfAwareTest extends AbstractJsfAwareTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Before
+    @Override
+    public void beforeMethod()
+    {
+        super.beforeMethod();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @After
+    @Override
+    public void afterMethod()
+    {
+        super.afterMethod();
+    }
+}

Added: myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java?rev=1085251&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/junit4/AbstractServletAwareTest.java Fri Mar 25 04:25:54 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.junit4;
+
+import org.apache.myfaces.extensions.cdi.test.strategy.AbstractServletAwareTestStrategy;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractServletAwareTest extends AbstractServletAwareTestStrategy
+{
+    /**
+     * {@inheritDoc}
+     */
+    @Before
+    @Override
+    public void beforeMethod()
+    {
+        super.beforeMethod();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @After
+    @Override
+    public void afterMethod()
+    {
+        super.afterMethod();
+    }
+}

Modified: myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/owb10-support-module/pom.xml Fri Mar 25 04:25:54 2011
@@ -26,7 +26,7 @@
     <artifactId>myfaces-extcdi-owb-support-module</artifactId>
     <version>0.9.4-SNAPSHOT</version>
 
-    <name>MyFaces Extensions-CDI OpenWebBeans 1.0.0 Test-Support Module</name>
+    <name>MyFaces Extensions-CDI OpenWebBeans Test-Support Module</name>
 
     <parent>
         <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
@@ -54,6 +54,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+            <artifactId>myfaces-extcdi-junit-support-module</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.openwebbeans</groupId>
             <artifactId>openwebbeans-impl</artifactId>
             <scope>compile</scope>

Modified: myfaces/extensions/cdi/trunk/test-modules/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/pom.xml?rev=1085251&r1=1085250&r2=1085251&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/pom.xml Fri Mar 25 04:25:54 2011
@@ -36,6 +36,8 @@
 
     <modules>
         <module>base-test-infrastructure-module</module>
+
+        <module>junit-support-module</module>
         <module>owb10-support-module</module>
         <module>jsf12-support-module</module>
     </modules>