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/26 15:54:16 UTC

svn commit: r1085729 - in /myfaces/extensions/cdi/trunk: ./ examples/jsf-examples/hello_myfaces-codi_jsf20/ test-modules/ test-modules/cargo-support-module/ test-modules/cargo-support-module/src/ test-modules/cargo-support-module/src/main/ test-modules...

Author: gpetracek
Date: Sat Mar 26 14:54:15 2011
New Revision: 1085729

URL: http://svn.apache.org/viewvc?rev=1085729&view=rev
Log:
EXTCDI-160 separated cargo support module

Added:
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/
    myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java
Removed:
    myfaces/extensions/cdi/trunk/test-modules/junit-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/
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/cargo-test-module/pom.xml
    myfaces/extensions/cdi/trunk/test-modules/junit-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=1085729&r1=1085728&r2=1085729&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 Sat Mar 26 14:54:15 2011
@@ -96,6 +96,12 @@
 
         <dependency>
             <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+            <artifactId>myfaces-extcdi-cargo-support-module</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
             <artifactId>myfaces-extcdi-owb-support-module</artifactId>
             <scope>test</scope>
         </dependency>
@@ -605,6 +611,12 @@
 
                 <dependency>
                     <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+                    <artifactId>myfaces-extcdi-cargo-support-module</artifactId>
+                    <scope>test</scope>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
                     <artifactId>myfaces-extcdi-owb-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=1085729&r1=1085728&r2=1085729&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/pom.xml Sat Mar 26 14:54:15 2011
@@ -275,6 +275,12 @@
 
             <dependency>
                 <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
+                <artifactId>myfaces-extcdi-cargo-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>
                 <version>0.9.4-SNAPSHOT</version>
             </dependency>

Added: myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/pom.xml?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/pom.xml (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/pom.xml Sat Mar 26 14:54:15 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-cargo-support-module</artifactId>
+    <version>0.9.4-SNAPSHOT</version>
+
+    <name>MyFaces Extensions-CDI Cargo-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/cargo-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/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractContainerAwareCargoTest.java Sat Mar 26 14:54:15 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/cargo-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/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/AbstractSimpleCargoTest.java Sat Mar 26 14:54:15 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/cargo-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/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/ContainerNotStartedException.java Sat Mar 26 14:54:15 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/cargo-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/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/SimplePageInteraction.java Sat Mar 26 14:54:15 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/cargo-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/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java?rev=1085729&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java (added)
+++ myfaces/extensions/cdi/trunk/test-modules/cargo-support-module/src/main/java/org/apache/myfaces/extensions/cdi/test/cargo/runner/JUnit4WithCargo.java Sat Mar 26 14:54:15 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();
+        }
+    }
+}

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=1085729&r1=1085728&r2=1085729&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 Sat Mar 26 14:54:15 2011
@@ -146,7 +146,7 @@
 
         <dependency>
             <groupId>org.apache.myfaces.extensions.cdi.test</groupId>
-            <artifactId>myfaces-extcdi-junit-support-module</artifactId>
+            <artifactId>myfaces-extcdi-cargo-support-module</artifactId>
             <scope>test</scope>
         </dependency>
 

Modified: 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=1085729&r1=1085728&r2=1085729&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/junit-support-module/pom.xml Sat Mar 26 14:54:15 2011
@@ -65,12 +65,6 @@
             <artifactId>junit</artifactId>
             <scope>compile</scope>
         </dependency>
-
-        <dependency>
-            <groupId>net.sourceforge.htmlunit</groupId>
-            <artifactId>htmlunit</artifactId>
-            <scope>provided</scope>
-        </dependency>
         
     </dependencies>
 

Modified: myfaces/extensions/cdi/trunk/test-modules/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/test-modules/pom.xml?rev=1085729&r1=1085728&r2=1085729&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/test-modules/pom.xml (original)
+++ myfaces/extensions/cdi/trunk/test-modules/pom.xml Sat Mar 26 14:54:15 2011
@@ -38,6 +38,7 @@
         <module>base-test-infrastructure-module</module>
 
         <module>junit-support-module</module>
+        <module>cargo-support-module</module>
         <module>owb-support-module</module>
         <module>jsf12-support-module</module>
     </modules>