From 074e45d73e7dcba9405bc6b0f6826bc0a5c5a98c Mon Sep 17 00:00:00 2001 From: Stefan Miklosovic Date: Thu, 21 Nov 2013 17:53:37 +0100 Subject: [PATCH] Added example test project for ARQ-1577 --- .../README.adoc | 20 ++ tests/droidium-multiple-containers-03/pom.xml | 255 ++++++++++++++++++ .../droidium/showcase/classes/Foo.java | 25 ++ .../test03/MultipleContainersTestCase.java | 56 ++++ .../src/test/resources/arquillian.xml | 45 ++++ 5 files changed, 401 insertions(+) create mode 100644 tests/droidium-multiple-containers-03/README.adoc create mode 100644 tests/droidium-multiple-containers-03/pom.xml create mode 100644 tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/classes/Foo.java create mode 100644 tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/multiple/test03/MultipleContainersTestCase.java create mode 100644 tests/droidium-multiple-containers-03/src/test/resources/arquillian.xml diff --git a/tests/droidium-multiple-containers-03/README.adoc b/tests/droidium-multiple-containers-03/README.adoc new file mode 100644 index 00000000..cbd65de3 --- /dev/null +++ b/tests/droidium-multiple-containers-03/README.adoc @@ -0,0 +1,20 @@ +== Arquillian Droidium multiple containers test + +Tests scenario when you have JBoss container on class path and Android container on classpath +and both are specified in arquillian.xml and there is Drone on classpath as well with +webdriver extensions in arquillian.xml but no extension is asking for "android" browser +so it is not necessary to start Android container at all. + +This example is related to issue https://issues.jboss.org/browse/ARQ-1577[ARQ-1577] + +To execute the test: + +`mvn clean test` + +JBoss AS container is automatically downloaded for you into `target` so you do not have to +manage your JBoss instance on your own. Please be sure there is not any JBoss AS container already +running before execution of tests. + +This project can be run in a headless mode as well, typically in a CI service like Cloudbees. +You are obliged to activate headless profile with `-Pheadless`. It adds the following switches to `emulator` command +upon its start: `-no-skin -no-audio -no-window -nocache -no-snapshot-save -no-snapstorage`. diff --git a/tests/droidium-multiple-containers-03/pom.xml b/tests/droidium-multiple-containers-03/pom.xml new file mode 100644 index 00000000..b0289aa8 --- /dev/null +++ b/tests/droidium-multiple-containers-03/pom.xml @@ -0,0 +1,255 @@ + + + + + + 4.0.0 + + + org.arquillian.droidium.tests + arquillian-droidium-multiple-containers-test-03 + 1.0.0.Alpha3-SNAPSHOT + + Shows configuration of multiple container adapters on classpath + + + + UTF-8 + + 1.2.0 + 1.1.2.Final + 1.2.0.Final + + 4.8.1 + 7.1.1.Final + + 1.6 + 1.6 + + testingEmulator + + + + + + + + org.jboss.shrinkwrap + shrinkwrap-bom + ${version.shrinkwrap_shrinkwrap} + pom + import + + + org.jboss.arquillian + arquillian-bom + ${version.arquillian.core} + pom + import + + + org.jboss.arquillian.extension + arquillian-drone-webdriver-depchain + ${version.arquillian.drone} + pom + test + + + org.jboss.as + jboss-as-arquillian-container-managed + ${version.org.jboss.as} + test + + + org.arquillian.container + arquillian-droidium-container + ${project.version} + test + + + junit + junit + test + ${version.junit} + + + + + + + + org.jboss.arquillian.extension + arquillian-drone-webdriver-depchain + pom + test + + + org.jboss.as + jboss-as-arquillian-container-managed + test + + + org.arquillian.container + arquillian-droidium-container + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + junit + junit + test + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + process-test-resources + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.eclipse.m2e + lifecycle-mapping + + + + + + + org.apache.maven.plugins + + + maven-dependency-plugin + + + [2.1,) + + + unpack + + + + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + unpack + process-test-classes + + unpack + + + + + org.jboss.as + jboss-as-dist + ${version.org.jboss.as} + zip + false + ${project.build.directory} + + + + + + + + + + src/test/resources + true + + **/*.xml + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-dependency-plugin + [1.0.0,) + + unpack + + + + + + + + + + + + + + + + + + + headless + + false + + + + + + -no-skin -no-audio -no-window -nocache -no-snapshot-save -no-snapstorage + + + + + + diff --git a/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/classes/Foo.java b/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/classes/Foo.java new file mode 100644 index 00000000..eef57f60 --- /dev/null +++ b/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/classes/Foo.java @@ -0,0 +1,25 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual + * contributors by the @authors tag. See the copyright.txt in the + * distribution for a full listing of individual contributors. + * + * Licensed 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.arquillian.droidium.showcase.classes; + +/** + * @author Stefan Miklosovic + * + */ +public class Foo { + +} diff --git a/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/multiple/test03/MultipleContainersTestCase.java b/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/multiple/test03/MultipleContainersTestCase.java new file mode 100644 index 00000000..ea920f2e --- /dev/null +++ b/tests/droidium-multiple-containers-03/src/test/java/org/arquillian/droidium/showcase/multiple/test03/MultipleContainersTestCase.java @@ -0,0 +1,56 @@ +/** + * JBoss, Home of Professional Open Source + * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual + * contributors by the @authors tag. See the copyright.txt in the + * distribution for a full listing of individual contributors. + * + * Licensed 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.arquillian.droidium.showcase.multiple.test03; + +import org.arquillian.droidium.showcase.classes.Foo; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.drone.api.annotation.Drone; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.openqa.selenium.WebDriver; + +/** + * Proof of concept test for showing multiple containers on classpath. + * + * @author Stefan Miklosovic + * + */ +@RunWith(Arquillian.class) +@RunAsClient +public class MultipleContainersTestCase { + + // this asks for firefox browser + @Drone + WebDriver browser; + + @Deployment(name = "jbossas") // only one container will be started so we can omit @TargetsContainer + public static Archive createJBossASDeployment() { + return ShrinkWrap.create(JavaArchive.class, "jbossas.jar").addClass(Foo.class); + } + + @Test + public void test01() { + Assert.assertNotNull(browser); + } + +} diff --git a/tests/droidium-multiple-containers-03/src/test/resources/arquillian.xml b/tests/droidium-multiple-containers-03/src/test/resources/arquillian.xml new file mode 100644 index 00000000..0517a28f --- /dev/null +++ b/tests/droidium-multiple-containers-03/src/test/resources/arquillian.xml @@ -0,0 +1,45 @@ + + + + + + + + + + android-4.1.2 + ${android.emulator.options} + 600 + disable + + + + + + + ${basedir}/target/jboss-as-7.1.1.Final + + + + + + + firefox + +