You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ja...@apache.org on 2010/09/07 11:02:55 UTC

svn commit: r993292 [2/2] - in /myfaces/gsoc/webapptest: ./ api/ api/src/ api/src/main/ api/src/main/java/ api/src/main/java/org/ api/src/main/java/org/apache/ api/src/main/java/org/apache/myfaces/ api/src/main/java/org/apache/myfaces/test/ api/src/mai...

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ELResolverWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ELResolverWrapper.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ELResolverWrapper.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ELResolverWrapper.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,127 @@
+/*
+ *  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.test.webapp.impl;
+
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableELExpression;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableProxyMethod;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableValue;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.TestAssertExpectCall;
+
+import javax.el.*;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import java.beans.FeatureDescriptor;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Cosmin Martinconi, 11.08.2010
+ */
+public class ELResolverWrapper extends ELResolver {
+
+    private List<TestAssertExpectCall> expectCall = new ArrayList<TestAssertExpectCall>();
+    private Application application;
+
+    public ELResolverWrapper(Application application) {
+        this.application = application;
+    }
+
+    @Override
+    public Object getValue(ELContext context, Object base, Object property) {
+
+        for (TestAssertExpectCall taec : expectCall) {
+            if (validateCallExpected(base, property, taec.getAssertableValue()))
+                taec.setCalled(true);
+        }
+
+        return getWrapped().getValue(context, base, property);
+    }
+
+    @Override
+    public void setValue(ELContext context, Object base, Object property, Object value) {
+
+        for (TestAssertExpectCall taec : expectCall) {
+            taec.setCalled(validateCallExpected(base, property, taec.getAssertableValue()));
+        }
+
+        getWrapped().setValue(context, base, property, value);
+    }
+
+    @Override
+    public Class<?> getType(ELContext context, Object base, Object property) {
+        return getWrapped().getType(context, base, property);
+    }
+
+    @Override
+    public boolean isReadOnly(ELContext context, Object base, Object property) {
+        return getWrapped().isReadOnly(context, base, property);
+    }
+
+    @Override
+    public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
+        return getWrapped().getFeatureDescriptors(context, base);
+    }
+
+    @Override
+    public Class<?> getCommonPropertyType(ELContext context, Object base) {
+        return getWrapped().getCommonPropertyType(context, base);
+    }
+
+    private ELResolver getWrapped() {
+        return application.getELResolver();
+    }
+
+
+    private boolean validateCallExpected(Object base, Object property, AssertableValue assertableValue) {
+
+        if ((assertableValue == null) || (base == null))
+            return false;
+
+        FacesContext fc = FacesContext.getCurrentInstance();
+        if (assertableValue instanceof AssertableELExpression) {
+            AssertableELExpression elValue = (AssertableELExpression)assertableValue;
+
+            Object assertBase = getValue(fc.getELContext(), null, elValue.getELBaseAsString());
+
+            return base.equals(assertBase) &&
+                    property.equals(elValue.getELPropertyAsString());
+        }
+
+        if (assertableValue instanceof AssertableProxyMethod) {
+            AssertableProxyMethod methodValue = (AssertableProxyMethod)assertableValue;
+
+            String firstUPProperty = Character.toUpperCase(property.toString().charAt(0)) + property.toString().substring(1);
+            String assertPropertyName = methodValue.getMethodProxy().getSignature().getName();
+
+            return base.getClass().equals(methodValue.getMethodObj().getClass().getSuperclass()) &&
+                    assertPropertyName.matches("((get)|(set))" + firstUPProperty);
+        }
+
+        return false;
+    }
+
+    public void addExpectCall(TestAssertExpectCall eCall) {
+        expectCall.add(eCall);
+    }
+
+    public void removeExpectCall(TestAssertExpectCall eCall) {
+        expectCall.remove(eCall);
+    }
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ProxyInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ProxyInterceptor.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ProxyInterceptor.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/ProxyInterceptor.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,130 @@
+/*
+ *  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.test.webapp.impl;
+
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+import org.apache.myfaces.test.webapp.api.ResourceFinder;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableELExpression;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableProxyMethod;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.AssertableValue;
+import sun.reflect.Reflection;
+
+import javax.faces.context.FacesContext;
+import java.lang.reflect.Method;
+import java.util.logging.Logger;
+
+/**
+ * @author Cosmin Martinconi, 14.07.2010
+ */
+public class ProxyInterceptor implements MethodInterceptor {
+
+    private static final Logger log = Logger.getLogger(ProxyInterceptor.class.getName());
+
+    private AssertableProxyMethod methodInvoked;
+    private Object methodReturnValue;
+    private Class testClass;
+
+    public ProxyInterceptor() {
+        methodInvoked = new AssertableProxyMethod();
+    }
+
+    public Object newInstance(Class clazz) {
+        try {
+            Enhancer e = new Enhancer();
+            e.setSuperclass(clazz);
+            e.setCallback(this);
+            return e.create();
+        } catch (Throwable e) {
+            log.severe("Could not generate ne instance of class " + clazz.getName());
+            throw new Error(e.getMessage());
+        }
+    }
+
+    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
+
+        // if assertThat() or expectCall() method is called an AssertableValue will be injected as argument
+        if (WebappTesterImpl.class.isInstance(obj) && ( method.getName().equals("assertThat")
+                                                 || method.getName().equals("expectCall"))) {
+            AssertableValue assertValue = getAssertableValue(args[0]);
+
+            if (assertValue == null)
+                throw new IllegalArgumentException(args[0] + " argument of " + method + " method is not supported.");
+            else
+                return proxy.invokeSuper(obj, new Object[]{assertValue});
+        }
+
+        if (testClass.equals(Reflection.getCallerClass(3))) {
+            saveMethodInvoked(obj, args, proxy);
+
+            // calls are not supported on FacesContext since it has no implementation attached yet
+            if (FacesContext.class.isAssignableFrom(obj.getClass()))
+                return methodReturnValue = null;
+            
+            methodReturnValue = methodInvoked.evaluate();
+            return methodReturnValue;
+        }
+
+        return proxy.invokeSuper(obj, args);
+    }
+
+    public static ProxyInterceptor getCurrentInstance() {
+        return (ProxyInterceptor) ResourceFinder.getResource(ProxyInterceptor.class.getName());
+    }
+
+    public void setTestClass(Class tClass) {
+        testClass = tClass;
+    }
+
+    public AssertableProxyMethod getSavedMethod() {
+        return new AssertableProxyMethod(methodInvoked.getMethodObj(),
+                                          methodInvoked.getMethodArgs(),
+                                          methodInvoked.getMethodProxy());
+    }
+
+    private void saveMethodInvoked(Object obj, Object[] args, MethodProxy proxy) {
+        methodInvoked.setMethodObj(obj);
+        methodInvoked.setMethodArgs(args);
+        methodInvoked.setMethodProxy(proxy);
+    }
+
+    private AssertableValue getAssertableValue(Object arg) {
+
+        if (arg == methodReturnValue || (arg != null && arg.equals(methodReturnValue))) {
+            return getSavedMethod();
+        }
+
+        if (String.class.isInstance(arg)) {
+            String elValue = (String) arg;
+
+            if (elValue.matches("#\\{.*}")) {
+                AssertableELExpression elExpression = new AssertableELExpression();
+                elExpression.setELValue(elValue);
+                return elExpression;
+            }
+            else {
+                throw new IllegalArgumentException("String value " + elValue + " is not a valid EL expression!");
+            }
+        }
+
+        return null;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/TesttErrorManager.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/TesttErrorManager.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/TesttErrorManager.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/TesttErrorManager.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,55 @@
+/*
+ *  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.test.webapp.impl;
+
+import org.apache.myfaces.test.webapp.api.ResourceFinder;
+import org.junit.Assert;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Cosmin Martinconi, 05.08.2010
+ */
+public class TesttErrorManager {
+
+    private static final Logger log = Logger.getLogger(TesttErrorManager.class.getName());
+    private List<Error> assertErrors = new ArrayList<Error>();
+
+    public static TesttErrorManager getCurrentInstance() {
+        return (TesttErrorManager) ResourceFinder.getResource(TesttErrorManager.class.getName());
+    }
+
+    public void handleErrors() {
+        if (assertErrors.size() > 0 ) {
+            for (Error e : assertErrors) {
+                log.log(Level.SEVERE, "Assertion error", e);
+            }
+            assertErrors.clear();
+            Assert.fail("Test failed due to previous errors.");
+        }
+    }
+
+    public void addError(Error e) {
+        assertErrors.add(e);
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestConfiguratorImpl.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestConfiguratorImpl.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestConfiguratorImpl.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,146 @@
+/*
+ *  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.test.webapp.impl;
+
+import org.apache.myfaces.test.webapp.api.ResourceFinder;
+import org.apache.myfaces.test.webapp.api.WebappTestConfigurator;
+
+import javax.el.ELResolver;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.application.ApplicationWrapper;
+import javax.faces.event.ActionListener;
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Cosmin Martinconi, 06.08.2010
+ */
+public class WebappTestConfiguratorImpl extends WebappTestConfigurator {
+
+    private static final Logger log = Logger.getLogger(WebappTestConfiguratorImpl.class.getName());
+
+    private static final String ARCHIVE_MANAGER = ArchiveManager.class.getName();                                        
+    private static final String ANNOTATION_MANAGER = AnnotationManager.class.getName();
+    private static final String PROXY_INTERCEPTOR = ProxyInterceptor.class.getName();
+    private static final String TEST_ASSERT_ERRORS = TesttErrorManager.class.getName();
+
+    public static final Class DEFAULT_WEBAPP_TESTER = WebappTesterImpl.class;
+
+
+    public void configure(Class testClass) {
+        configureResources();
+
+        // configure the annotation manager
+        AnnotationManager.getCurrentInstance().setTestClass(testClass);
+        AnnotationManager.getCurrentInstance().initializeAnnotations();
+
+        ProxyInterceptor.getCurrentInstance().setTestClass(testClass);
+        ArchiveManager.getCurrentInstance().initializeTestSuiteArchive();
+        WebappTesterImpl.getCurrentInstance().initializeWebappTester();
+        
+        injectWebappTester();
+    }
+
+    public void injectAssertableProxies(Object testObj) {
+        List<Field> assertFieldList = AnnotationManager.getCurrentInstance().getAssertFieldList();
+
+        for (Field f : assertFieldList) {
+
+            try {
+                if (!f.isAccessible()) {
+                    f.setAccessible(true);
+                }
+
+                if (f.get(testObj) == null) {
+                    Object newFieldProxy = createProxy(f.getType());
+                    f.set(testObj, newFieldProxy);
+                }
+            } catch (IllegalAccessException e) {
+                log.log(Level.SEVERE, "Could not access field: " + f, e);
+            }
+        }
+    }
+
+    public void atServletConfiguration() {
+        final Application application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).getApplication();
+
+        ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).setApplication(new ApplicationWrapper() {
+
+            private ELResolverWrapper wrappedELR = new ELResolverWrapper(application);
+            private ActionListenerWrapper wrappedAL = new ActionListenerWrapper(application);
+
+            @Override
+            public ActionListener getActionListener() {
+                return wrappedAL;
+            }
+
+            @Override
+            public ELResolver getELResolver() {
+                return wrappedELR;
+            }
+
+            @Override
+            public Application getWrapped() {
+                return application;
+            }
+        });
+    }
+
+    public boolean isTestSuiteConfig() {
+        return ArchiveManager.getCurrentInstance().isTestSuiteConfig();
+    }
+    
+    private void configureResources() {
+
+        // add Impl dependent resources
+        ResourceFinder.setResource(ARCHIVE_MANAGER, new ArchiveManager());
+        ResourceFinder.setResource(ANNOTATION_MANAGER, new AnnotationManager());
+        ResourceFinder.setResource(PROXY_INTERCEPTOR, new ProxyInterceptor());
+        ResourceFinder.setResource(TEST_ASSERT_ERRORS, new TesttErrorManager());
+
+        // add API dependent resources
+        ResourceFinder.setResource(ResourceFinder.WEBAPP_TESTER, createProxy(DEFAULT_WEBAPP_TESTER ));
+
+    }
+                                                          
+    private Object createProxy(Class pClass) {
+        ProxyInterceptor proxyInterceptor = ProxyInterceptor.getCurrentInstance();
+
+        return proxyInterceptor.newInstance(pClass);
+    }
+
+
+    private void injectWebappTester() {
+        Field testerField = AnnotationManager.getCurrentInstance().getTesterField();
+                                    
+        try {
+            if (!testerField.isAccessible())
+                testerField.setAccessible(true);
+
+            testerField.set(null, WebappTesterImpl.getCurrentInstance());
+        } catch (IllegalAccessException e) {
+            log.log(Level.SEVERE, "Could not access tester field: " + testerField, e);
+        }
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestPhaseListener.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestPhaseListener.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTestPhaseListener.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,72 @@
+/*
+ *  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.test.webapp.impl;
+
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.TestAssertion;
+
+import javax.faces.FactoryFinder;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import java.util.List;
+
+/**
+ * This class is a PhaseListener for all requests made to the defined view of the Test Case
+ *
+ * @author Cosmin Martinconi, 14.07.2010
+ */
+public class WebappTestPhaseListener implements PhaseListener {
+
+    private List<TestAssertion> requestAssertList;
+    
+    public void afterPhase(PhaseEvent event) {
+        for (TestAssertion assertion : requestAssertList) {
+            if (event.getPhaseId().equals(assertion.getPhaseId()) && assertion.isAfter() ) {
+                assertion.doAssertion();
+            }
+        }
+    }
+
+    public void beforePhase(PhaseEvent event){
+        for (TestAssertion assertion : requestAssertList) {
+            if (event.getPhaseId().equals(assertion.getPhaseId()) && !assertion.isAfter() ) {
+                assertion.doAssertion();
+            }
+        }
+    }
+
+    public void registerToLifecycle() {
+        LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
+                .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+        Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+
+        lifecycle.addPhaseListener(this);
+    }
+
+    public void setRequestAssertList(List<TestAssertion> requestAssertList) {
+        this.requestAssertList = requestAssertList;
+    }
+
+    public PhaseId getPhaseId() {
+        return PhaseId.ANY_PHASE;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTesterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTesterImpl.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTesterImpl.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/WebappTesterImpl.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,280 @@
+/*
+ *  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.test.webapp.impl;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+import org.apache.myfaces.test.webapp.api.ResourceFinder;
+import org.apache.myfaces.test.webapp.api.tester.WebappTester;
+import org.apache.myfaces.test.webapp.impl.metadata.TestCaseMetadata;
+import org.apache.myfaces.test.webapp.impl.metadata.action.TestActionClick;
+import org.apache.myfaces.test.webapp.impl.metadata.action.TestActionEvent;
+import org.apache.myfaces.test.webapp.impl.metadata.action.TestActionGetPage;
+import org.apache.myfaces.test.webapp.impl.metadata.action.TestActionInput;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.*;
+import org.jboss.shrinkwrap.api.Archive;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+/**
+ * This class represents the default Tester that must be instantiated by any test class
+ * using the {@link org.apache.myfaces.test.webapp.api.annotation.Tester} annotation.
+ * The class provides all necessary methods to control the test case.
+ *
+ * @author Cosmin Martinconi, 01.07.2010
+ */
+public class WebappTesterImpl implements WebappTester {
+
+    private static final Logger log = Logger.getLogger(WebappTesterImpl.class.getName());
+    private static final String LOCAL_NAME = "http://localhost:8080/";
+    private static final String ARCHIVE_NAME = "test";
+
+    private FacesContext facesContext;
+    private UIViewRoot root;
+
+    private List<TestCaseMetadata> testMetadataList;
+    private WebClient webClient;
+
+
+    public void initializeWebappTester() {
+
+        ProxyInterceptor proxyInterceptor = (ProxyInterceptor) ResourceFinder.getResource(ProxyInterceptor.class.getName());
+        
+        facesContext = (FacesContext)proxyInterceptor.newInstance(FacesContext.class);
+        root = (UIViewRoot)proxyInterceptor.newInstance(UIViewRoot.class);
+    }
+
+    public static WebappTesterImpl getCurrentInstance() {
+        return (WebappTesterImpl) ResourceFinder.getResource(ResourceFinder.WEBAPP_TESTER);
+    }
+
+    public Archive<?> createArchive(Archive<?> applicationArchive) {
+        ArchiveManager archiveManager = ArchiveManager.getCurrentInstance();
+        archiveManager.createArchive(applicationArchive, ARCHIVE_NAME);
+
+        if (archiveManager.isTestSuiteConfig())
+            return archiveManager.getTestSuiteArchive();
+        else
+            return archiveManager.getTestArchive();
+    }
+
+    public void executeTestMethod() {
+
+        WebappTestPhaseListener listener = new WebappTestPhaseListener();
+        listener.registerToLifecycle();
+
+        Page page = null;
+
+        for (TestCaseMetadata tcm : testMetadataList) {
+            listener.setRequestAssertList(tcm.getAssertionList());
+
+            for (TestActionEvent tae : tcm.getActionEventList()) {
+                page = tae.doAction(page);
+            }
+        }
+
+        TesttErrorManager.getCurrentInstance().handleErrors();
+    }
+
+    public void setUpTestMethod() {
+
+        testMetadataList = new ArrayList<TestCaseMetadata>();
+
+        if (webClient == null)
+            webClient = new WebClient();
+
+        AnnotationManager annotationManager = (AnnotationManager) ResourceFinder.getResource(AnnotationManager.class.getName());
+
+        String startURL = LOCAL_NAME + ARCHIVE_NAME + "/" + annotationManager.getView().id();
+        TestActionGetPage actionGetPage = new TestActionGetPage(startURL, webClient);
+
+        addNewMetadata().addActionEvent(actionGetPage);
+    }
+
+    public void tearDownTestMethod() {
+        testMetadataList = null;
+        webClient.closeAllWindows();
+    }
+
+    public FacesContext getFacesContext() {
+        return facesContext;
+    }
+    
+    public UIViewRoot getRoot() {
+        return root;
+    }
+
+    private TestCaseMetadata getCurrentMetadata() {
+        return testMetadataList.get(testMetadataList.size() - 1);
+    }
+
+    private TestCaseMetadata addNewMetadata() {
+        TestCaseMetadata newMetadata = new TestCaseMetadata();
+        testMetadataList.add(newMetadata);
+
+        return newMetadata;
+    }
+
+    /*--------------------------------------------------------------
+     Begin methods, that interact like the user would do
+    ---------------------------------------------------------------*/
+
+    /**
+     * Inputs the given value in the field specified by the in() method.
+     * @param value
+     * @return
+     */
+    public Input input(String value) {
+        TestActionInput actionInput = new TestActionInput();
+        actionInput.setInputValue(value);
+        getCurrentMetadata().addActionEvent(actionInput);
+        
+        return new InputImpl(actionInput);
+    }
+
+    /**
+     * Clicks the UICommand component with the given clientId
+     *
+     * @param clientId
+     * @throws java.io.IOException
+     */
+    public void click(String clientId) {
+        TestActionClick actionClick = new TestActionClick();
+        actionClick.setClientId(clientId);
+
+        addNewMetadata().addActionEvent(actionClick);
+    }
+
+
+    /*--------------------------------------------------------------
+     Begin methods, that verify expected behavior or values
+    ---------------------------------------------------------------*/
+
+    public Assertable assertThat(Object injectedAssertableValue) {
+
+        TestAssertCondition assertCondition = new TestAssertCondition();
+
+        if ((AssertableValue.class).isAssignableFrom(injectedAssertableValue.getClass())) {
+            assertCondition.setAssertableValue((AssertableValue) injectedAssertableValue);
+        } else {
+            throw new IllegalArgumentException("No " + AssertableValue.class.getName() + " instance found!");
+        }
+
+        getCurrentMetadata().addAssertion(assertCondition);
+
+        return new AssertableImpl(assertCondition);
+    }
+
+    public Call expectCall(Object injectedAssertableValue) {
+
+        TestAssertExpectCall assertExpectCall = new TestAssertExpectCall();
+
+        if ((AssertableValue.class).isAssignableFrom(injectedAssertableValue.getClass())) {
+            assertExpectCall.setAssertableValue((AssertableValue) injectedAssertableValue);
+        } else {
+            throw new IllegalArgumentException("No " + AssertableValue.class.getName() + " instance found!");
+        }        
+
+        getCurrentMetadata().addAssertion(assertExpectCall);
+
+        return new CallImpl(assertExpectCall);
+    }
+
+    public final Call expectLastCall() {
+        TestAssertExpectCall assertExpectLastCall = new TestAssertExpectCall();
+        AssertableProxyMethod proxyMethod = ProxyInterceptor.getCurrentInstance().getSavedMethod();
+
+        assertExpectLastCall.setAssertableValue(proxyMethod);
+        getCurrentMetadata().addAssertion(assertExpectLastCall);
+
+        return new CallImpl(assertExpectLastCall);
+    }
+
+    /*--------------------------------------------------------------
+     Begin classes needed for fluent API
+    ---------------------------------------------------------------*/
+
+    public final class AssertableImpl implements Assertable{
+
+        private TestAssertCondition assertCondition;
+
+        public AssertableImpl(TestAssertCondition assertCondition) {
+            this.assertCondition = assertCondition;
+        }
+
+        public PhaseAware is(String expectedValue) {
+            assertCondition.setExpectedValue(expectedValue);
+
+            return new PhaseAwareImpl(assertCondition);
+        }
+    }
+
+    public final class PhaseAwareImpl implements PhaseAware {
+
+        private TestAssertCondition assertCondition;
+
+        public PhaseAwareImpl(TestAssertCondition assertCondition) {
+            this.assertCondition = assertCondition;
+        }
+
+        public void after(PhaseId phase) {
+            assertCondition.setPhaseId(phase);
+            assertCondition.setAfter(true);
+        }
+
+        public void before(PhaseId phase) {
+            assertCondition.setPhaseId(phase);
+            assertCondition.setAfter(false);
+        }
+    }
+
+    public final class InputImpl implements Input {
+
+        private TestActionInput actionInput;
+
+        public InputImpl(TestActionInput actionInput) {
+            this.actionInput = actionInput;
+        }
+
+        public void into(String clientId) {
+            actionInput.setClientId(clientId);
+        }
+    }
+
+    public final class CallImpl implements Call {
+
+        private TestAssertExpectCall assertExpectCall;
+
+        public CallImpl(TestAssertExpectCall assertExpectCall) {
+            this.assertExpectCall = assertExpectCall;
+        }
+
+        public void in(PhaseId phase) {
+            assertExpectCall.setPhaseId(phase);
+            assertExpectCall.setAfter(false);
+        }
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/HtmlUnitDependency.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/HtmlUnitDependency.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/HtmlUnitDependency.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/HtmlUnitDependency.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,71 @@
+/*
+ *  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.test.webapp.impl.dependencies;
+
+import org.apache.myfaces.test.webapp.api.dependencies.WebappConfiguration;
+
+/**
+ * Defines the HtmlUnit dependency jars that must be included into the archive
+ * deployed on the server in order to have HtmlUnit working.
+ *
+ * @author Cosmin Martinconi, 13.07.2010
+ */
+public enum HtmlUnitDependency implements WebappConfiguration {
+
+    //HtmlUnit compile and run dependencies
+    COMMONS_IO_1_4("commons-io", "commons-io", "1.4"),
+    COMMONS_LANG_2_4("commons-lang", "commons-lang", "2.4"),
+    COMMONS_CODEC_1_3("commons-codec", "commons-codec", "1.3"),
+    COMMONS_HTTPClIENT_3_1("commons-httpclient", "commons-httpclient", "3.1"),
+
+    HTMLUNIT_CORE_2_4("net.sourceforge.htmlunit", "htmlunit-core-js", "2.4"),
+    HTMLUNIT_2_4("net.sourceforge.htmlunit", "htmlunit", "2.4"),
+    HTMLUNIT_DRIVER_2_6("net.sourceforge.htmlunit", "webdriver", "2.6"),
+    CSSPARSER_0_9_5("net.sourceforge.cssparser", "cssparser", "0.9.5"),
+    NEKOHTML_1_9_11("net.sourceforge.nekohtml", "nekohtml", "1.9.11"),
+    W3C_SAC_1_3("org.w3c.css", "sac", "1.3");
+
+
+    private String _groupId;
+    private String _artifactId;
+    private String _version;
+
+    private HtmlUnitDependency(String groupId, String artifactId, String version)
+    {
+        _groupId = groupId;
+        _artifactId = artifactId;
+        _version = version;
+    }
+
+    public String getGroupId()
+    {
+        return _groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return _artifactId;
+    }
+
+    public String getVersion()
+    {
+        return _version;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/StandardDependency.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/StandardDependency.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/StandardDependency.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/dependencies/StandardDependency.java Tue Sep  7 09:02:52 2010
@@ -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.test.webapp.impl.dependencies;
+
+import org.apache.myfaces.test.webapp.api.dependencies.WebappConfiguration;
+
+/**
+ * @author Cosmin Martinconi, 16.06.2010
+ */
+public enum StandardDependency implements WebappConfiguration {
+
+    SERVLET_API_2_5("javax.servlet", "servlet-api", "2.5"),
+    CGLIB_2_1_3("cglib","cglib","2.1_3"),
+    ASM_1_5_3("asm","asm","1.5.3");
+
+    private String _groupId;
+    private String _artifactId;
+    private String _version;
+
+    private StandardDependency(String groupId, String artifactId, String version)
+    {
+        _groupId = groupId;
+        _artifactId = artifactId;
+        _version = version;
+    }
+
+    public String getGroupId()
+    {
+        return _groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return _artifactId;
+    }
+
+    public String getVersion()
+    {
+        return _version;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/TestCaseMetadata.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/TestCaseMetadata.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/TestCaseMetadata.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/TestCaseMetadata.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,56 @@
+/*
+ *  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.test.webapp.impl.metadata;
+
+import org.apache.myfaces.test.webapp.impl.metadata.action.TestActionEvent;
+import org.apache.myfaces.test.webapp.impl.metadata.assertion.TestAssertion;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class TestCaseMetadata {
+
+    private List<TestAssertion> assertionList;
+    private List<TestActionEvent> actionEventList;
+    
+    public TestCaseMetadata() {
+        assertionList = new ArrayList<TestAssertion>();
+        actionEventList = new ArrayList<TestActionEvent>();
+    }
+
+    public void addAssertion(TestAssertion newAssertion) {
+        assertionList.add(newAssertion);
+    }
+
+    public void addActionEvent(TestActionEvent newAction) {
+        actionEventList.add(newAction);
+    }
+
+    public List<TestAssertion> getAssertionList() {
+        return assertionList;
+    }
+
+    public List<TestActionEvent> getActionEventList() {
+        return actionEventList;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionClick.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionClick.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionClick.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionClick.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,64 @@
+/*
+ *  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.test.webapp.impl.metadata.action;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import java.io.IOException;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class TestActionClick implements TestActionEvent {
+
+    private String clientId;
+
+    public Page doAction(Page page) {
+
+        if (page instanceof HtmlPage) {
+            HtmlElement button = ((HtmlPage) page).getElementById(clientId);
+
+            if (button instanceof HtmlSubmitInput) {
+                try {
+                    return ((HtmlSubmitInput) button).click();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    return null;
+                }
+            } else {
+                throw new IllegalArgumentException("Html element with id: " + clientId
+                    + " must be of type " + HtmlSubmitInput.class.getName());
+            }
+        } else {
+            throw new ClassCastException(page + " instance must be of type " + HtmlPage.class.getName());
+        }
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionEvent.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionEvent.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionEvent.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionEvent.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.test.webapp.impl.metadata.action;
+
+import com.gargoylesoftware.htmlunit.Page;
+
+import java.io.IOException;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public interface TestActionEvent {
+
+    public Page doAction(Page page);
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionGetPage.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionGetPage.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionGetPage.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionGetPage.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,52 @@
+/*
+ *  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.test.webapp.impl.metadata.action;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Cosmin Martinconi, 02.08.2010
+ */
+public class TestActionGetPage implements TestActionEvent {
+
+    private static final Logger log = Logger.getLogger(TestActionGetPage.class.getName());
+
+    private String urlValue;
+    private WebClient webClient;
+
+    public TestActionGetPage(String urlValue, WebClient webClient) {
+        this.urlValue = urlValue;
+        this.webClient = webClient;
+    }
+
+    public Page doAction(Page page) {
+        try {
+            return webClient.getPage(urlValue);
+        } catch (IOException e) {
+            log.log(Level.SEVERE, "Could not access the URL: " + urlValue + " on client " + webClient, e);
+            return null;
+        }
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionInput.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionInput.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionInput.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/action/TestActionInput.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,66 @@
+/*
+ *  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.test.webapp.impl.metadata.action;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class TestActionInput implements TestActionEvent {
+
+    private String inputValue;
+    private String clientId;
+
+    public Page doAction(Page page) {
+
+        if (page instanceof HtmlPage) {
+            HtmlElement field = ((HtmlPage) page).getElementById(clientId);
+
+            if (field instanceof HtmlTextInput) {
+                return ((HtmlTextInput) field).setValueAttribute(inputValue);
+            } else {
+                throw new IllegalArgumentException("Html element with id: " + clientId
+                        + " must be of type " + HtmlTextInput.class.getName());
+            }
+        } else {
+            throw new ClassCastException(page + " instance must be of type " + HtmlPage.class.getName());
+        }
+    }
+
+    public String getInputValue() {
+        return inputValue;
+    }
+
+    public void setInputValue(String inputValue) {
+        this.inputValue = inputValue;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableELExpression.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableELExpression.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableELExpression.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableELExpression.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,56 @@
+/*
+ *  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.test.webapp.impl.metadata.assertion;
+
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class AssertableELExpression implements AssertableValue {
+
+    private String elValue;
+
+    public Object evaluate() {
+        FacesContext fc = FacesContext.getCurrentInstance();
+        ExpressionFactory exprFactory = fc.getApplication().getExpressionFactory();
+        ValueExpression valueExpr = exprFactory.createValueExpression(fc.getELContext(), elValue, Object.class);
+
+        return valueExpr.getValue(fc.getELContext());
+    }
+
+    public void setELValue(String elValue) {
+        this.elValue = elValue;
+    }
+
+    public String getElValue() {
+        return elValue;
+    }
+
+    public String getELBaseAsString() {
+        return elValue.substring(elValue.indexOf("{") + 1, elValue.indexOf("."));
+    }
+
+    public String getELPropertyAsString() {
+        return elValue.substring(elValue.indexOf(".") + 1, elValue.indexOf("}"));
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableProxyMethod.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableProxyMethod.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableProxyMethod.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableProxyMethod.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,85 @@
+/*
+ *  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.test.webapp.impl.metadata.assertion;
+
+import net.sf.cglib.proxy.MethodProxy;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @author Cosmin Martinconi, 19.07.2010
+ */
+public class AssertableProxyMethod implements AssertableValue {
+
+    private static final Logger log = Logger.getLogger(AssertableProxyMethod.class.getName());
+
+    private Object methodObj;
+    private Object[] methodArgs;
+    private MethodProxy methodProxy;
+
+    public AssertableProxyMethod() {
+        this(null, null, null);
+    }
+
+    public AssertableProxyMethod(Object methodObj, Object[] methodArgs,
+                                 MethodProxy methodProxy) {
+        this.methodObj = methodObj;
+        this.methodArgs = methodArgs;
+        this.methodProxy = methodProxy;
+    }
+
+    public Object evaluate() {
+
+        if (methodProxy != null) {
+            try {
+                return methodProxy.invoke(methodObj, methodArgs);
+
+            } catch (Throwable throwable) {
+                log.log(Level.SEVERE, "Could not invoke method " + methodProxy, throwable);
+            }
+        }
+
+        return null;
+    }
+
+    public Object getMethodObj() {
+        return methodObj;
+    }
+
+    public Object[] getMethodArgs() {
+        return methodArgs;
+    }
+
+    public MethodProxy getMethodProxy() {
+        return methodProxy;
+    }
+
+    public void setMethodObj(Object methodObj) {
+        this.methodObj = methodObj;
+    }
+
+    public void setMethodArgs(Object[] methodArgs) {
+        this.methodArgs = methodArgs;
+    }
+
+    public void setMethodProxy(MethodProxy methodProxy) {
+        this.methodProxy = methodProxy;
+    }
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableValue.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableValue.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableValue.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/AssertableValue.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,27 @@
+/*
+ *  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.test.webapp.impl.metadata.assertion;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public interface AssertableValue {
+
+    public Object evaluate();
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertCondition.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertCondition.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertCondition.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertCondition.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,78 @@
+/*
+ *  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.test.webapp.impl.metadata.assertion;
+
+import org.apache.myfaces.test.webapp.impl.AnnotationManager;
+import org.apache.myfaces.test.webapp.impl.TesttErrorManager;
+import org.junit.Assert;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class TestAssertCondition extends TestAssertion {
+
+    private String expectedValue;
+
+    @Override
+    public void doAssertion() {
+
+        configureAssertionValue();
+
+        Object providedValue = getAssertableValue().evaluate();
+        try {
+            Assert.assertEquals(expectedValue, providedValue);
+        } catch (Error e) {
+            TesttErrorManager.getCurrentInstance().addError(e);
+        }
+    }
+
+    protected void configureAssertionValue() {
+        ELResolver elResolver = FacesContext.getCurrentInstance().getApplication().getELResolver();
+        ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+
+        if (getAssertableValue() instanceof AssertableProxyMethod) {
+            AssertableProxyMethod assertMethod = (AssertableProxyMethod) getAssertableValue();
+            Class assertClass = assertMethod.getMethodObj().getClass().getSuperclass();
+
+            Object realInstance;
+
+            if (FacesContext.class.isAssignableFrom(assertClass)) {
+                realInstance = FacesContext.getCurrentInstance();
+            } else if (UIViewRoot.class.isAssignableFrom(assertClass)){
+                realInstance = FacesContext.getCurrentInstance().getViewRoot();
+            } else {
+                String className = AnnotationManager.getCurrentInstance().getBeanName(assertClass);
+                realInstance = elResolver.getValue(elContext, null, className);
+            }
+
+            assertMethod.setMethodObj(realInstance);
+        }
+    }
+
+
+    public void setExpectedValue(String expectedValue) {
+        this.expectedValue = expectedValue;
+    }
+
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertExpectCall.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertExpectCall.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertExpectCall.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertExpectCall.java Tue Sep  7 09:02:52 2010
@@ -0,0 +1,66 @@
+/*
+ *  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.test.webapp.impl.metadata.assertion;
+
+import org.apache.myfaces.test.webapp.impl.ActionListenerWrapper;
+import org.apache.myfaces.test.webapp.impl.ELResolverWrapper;
+import org.apache.myfaces.test.webapp.impl.TesttErrorManager;
+import org.junit.Assert;
+
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public class TestAssertExpectCall extends TestAssertion {
+
+    private boolean called;
+
+    @Override
+    public void doAssertion() {
+        Application application = FacesContext.getCurrentInstance().getApplication();
+        ActionListenerWrapper alWrapper = (ActionListenerWrapper)application.getActionListener();
+        ELResolverWrapper elWrapper = (ELResolverWrapper)application.getELResolver();
+
+        if (isAfter()) {
+            try {
+                Assert.assertTrue(isCalled());
+            } catch (AssertionError e) {
+                TesttErrorManager.getCurrentInstance().addError(e);
+            } finally {
+                alWrapper.removeExpectCall(this);
+                elWrapper.removeExpectCall(this);
+
+            }
+        } else {
+            alWrapper.addExpectCall(this);
+            elWrapper.addExpectCall(this);
+            setAfter(true);
+        }
+    }
+
+    public boolean isCalled() {
+        return called;
+    }
+
+    public void setCalled(boolean called) {
+        this.called = called;
+    }
+}

Added: myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertion.java
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertion.java?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertion.java (added)
+++ myfaces/gsoc/webapptest/impl/src/main/java/org/apache/myfaces/test/webapp/impl/metadata/assertion/TestAssertion.java Tue Sep  7 09:02:52 2010
@@ -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.test.webapp.impl.metadata.assertion;
+
+import javax.faces.event.PhaseId;
+
+/**
+ * @author Cosmin Martinconi, 26.07.2010
+ */
+public abstract class TestAssertion {
+
+    private AssertableValue assertableValue;
+    private PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
+    private boolean after = true;
+
+    public AssertableValue getAssertableValue() {
+        return assertableValue;
+    }
+
+    public void setAssertableValue(AssertableValue assertableValue) {
+        this.assertableValue = assertableValue;
+    }
+
+    public PhaseId getPhaseId() {
+        return phaseId;
+    }
+
+    public void setPhaseId(PhaseId phaseId) {
+        this.phaseId = phaseId;
+    }
+
+    public boolean isAfter() {
+        return after;
+    }
+
+    public void setAfter(boolean after) {
+        this.after = after;
+    }
+
+    public abstract void doAssertion();
+}

Added: myfaces/gsoc/webapptest/impl/src/main/resources/META-INF/services/org.apache.myfaces.test.webapp.api.WebappTestConfigurator
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/impl/src/main/resources/META-INF/services/org.apache.myfaces.test.webapp.api.WebappTestConfigurator?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/impl/src/main/resources/META-INF/services/org.apache.myfaces.test.webapp.api.WebappTestConfigurator (added)
+++ myfaces/gsoc/webapptest/impl/src/main/resources/META-INF/services/org.apache.myfaces.test.webapp.api.WebappTestConfigurator Tue Sep  7 09:02:52 2010
@@ -0,0 +1 @@
+org.apache.myfaces.test.webapp.impl.WebappTestConfiguratorImpl
\ No newline at end of file

Added: myfaces/gsoc/webapptest/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/gsoc/webapptest/pom.xml?rev=993292&view=auto
==============================================================================
--- myfaces/gsoc/webapptest/pom.xml (added)
+++ myfaces/gsoc/webapptest/pom.xml Tue Sep  7 09:02:52 2010
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.myfaces</groupId>
+        <artifactId>myfaces</artifactId>
+        <version>8</version>
+    </parent>
+    <groupId>org.apache.myfaces.test</groupId>
+    <artifactId>webapp-tests-project</artifactId>
+    <packaging>pom</packaging>
+    <name>MyFaces Automated Webapp Tests Project</name>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <modules>
+        <module>api</module>
+        <module>impl</module>
+        <module>examples</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.arquillian</groupId>
+            <artifactId>arquillian-junit</artifactId>
+            <version>1.0.0.Alpha3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-impl</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <version>1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.enterprise</groupId>
+            <artifactId>cdi-api</artifactId>
+            <version>1.0-SP1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.el</groupId>
+            <artifactId>el-api</artifactId>
+            <version>2.2</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib</artifactId>
+            <version>2.1_3</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <profiles>
+
+        <profile>
+            <id>tomcat-embedded</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-tomcat-embedded-6</artifactId>
+                    <version>1.0.0.Alpha3</version>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.tomcat</groupId>
+                    <artifactId>catalina</artifactId>
+                    <version>6.0.26</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.tomcat</groupId>
+                    <artifactId>coyote</artifactId>
+                    <version>6.0.26</version>
+                    <scope>provided</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.tomcat</groupId>
+                    <artifactId>jasper</artifactId>
+                    <version>6.0.26</version>
+                    <scope>provided</scope>
+                </dependency>
+                <!-- Weld servlet, EL and JSP required for testing CDI injections -->
+<!--                <dependency>
+                    <groupId>org.jboss.weld.servlet</groupId>
+                    <artifactId>weld-servlet</artifactId>
+                    <version>1.0.1-Final</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.glassfish.web</groupId>
+                    <artifactId>el-impl</artifactId>
+                    <version>2.2</version>
+                    <scope>test</scope>
+                </dependency>-->
+<!--                <dependency>
+                    <groupId>javax.servlet.jsp</groupId>
+                    <artifactId>jsp-api</artifactId>
+                    <version>2.2</version>
+                    <scope>test</scope>
+                </dependency>-->
+            </dependencies>
+
+
+        </profile>
+
+        <profile>
+            <id>jbossas-remote-60</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-jbossas-remote-60</artifactId>
+                    <version>1.0.0.Alpha3</version>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.jbossas</groupId>
+                    <artifactId>jboss-server-manager</artifactId>
+                    <version>1.0.3.GA</version>
+                </dependency>
+                <dependency>
+                    <groupId>org.jboss.jbossas</groupId>
+                    <artifactId>jboss-as-client</artifactId>
+                    <version>6.0.0.20100429-M3</version>
+                    <type>pom</type>
+                </dependency>
+            </dependencies>
+        </profile>
+
+        <profile>
+            <id>openwebbeans-embedded</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-openwebbeans-embedded</artifactId>
+                    <version>1.0.0.Alpha3</version>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.openwebbeans</groupId>
+                    <artifactId>openwebbeans-spi</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.openwebbeans</groupId>
+                    <artifactId>openwebbeans-impl</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-el_2.2_spec</artifactId>
+                    <version>1.0</version>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-jta_1.1_spec</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-validation_1.0_spec</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-atinject_1.0_spec</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-servlet_2.5_spec</artifactId>
+                </dependency>
+            </dependencies>
+            <dependencyManagement>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.openwebbeans</groupId>
+                        <artifactId>openwebbeans</artifactId>
+                        <version>1.0.0-M4</version>
+                        <type>pom</type>
+                        <scope>import</scope>
+                    </dependency>
+                </dependencies>
+            </dependencyManagement>
+        </profile>
+
+    </profiles>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>jboss-public-repository-group</id>
+            <name>JBoss Public Maven Repository Group</name>
+            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+            <layout>default</layout>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </snapshots>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>jboss-public-repository-group</id>
+            <name>JBoss Public Maven Repository Group</name>
+            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+            <layout>default</layout>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
\ No newline at end of file