tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject [1/6] tomee git commit: add tests.
Date Fri, 21 Dec 2018 13:01:05 GMT
Repository: tomee
Updated Branches:
  refs/heads/master e420c0fe6 -> c64d35243


add tests.


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/e3ab4dd9
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/e3ab4dd9
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/e3ab4dd9

Branch: refs/heads/master
Commit: e3ab4dd9c45d8274248f9cec7ac2b73c31a91ec6
Parents: 8633e3b
Author: Daniel Dias <daniel.dias.analistati@gmail.com>
Authored: Fri Dec 21 01:50:37 2018 -0200
Committer: Daniel Dias <daniel.dias.analistati@gmail.com>
Committed: Fri Dec 21 01:52:26 2018 -0200

----------------------------------------------------------------------
 examples/mvc-resteasy/pom.xml                   | 28 ++++++++
 .../src/test/java/org/superbiz/mvc/MVCTest.java | 74 ++++++++++++++++++++
 .../src/test/resources/arquillian.xml           | 31 ++++++++
 3 files changed, 133 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/e3ab4dd9/examples/mvc-resteasy/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mvc-resteasy/pom.xml b/examples/mvc-resteasy/pom.xml
index a4a0c3d..53994a5 100644
--- a/examples/mvc-resteasy/pom.xml
+++ b/examples/mvc-resteasy/pom.xml
@@ -34,6 +34,8 @@
     <tomee.version>8.0.0-SNAPSHOT</tomee.version>
     <version.ozark>1.0.0-m04</version.ozark>
     <resteasy.version>3.6.1.Final</resteasy.version>
+     <version.arquillian>1.1.13.Final</version.arquillian>
+    <version.graphene.webdriver>2.3.1</version.graphene.webdriver>
   </properties>
 
   <build>
@@ -95,6 +97,32 @@
       <artifactId>resteasy-servlet-initializer</artifactId>
       <version>${resteasy.version}</version>
     </dependency>
+
+     <!--  tests  -->
+     <dependency>
+      <groupId>org.jboss.arquillian.junit</groupId>
+      <artifactId>arquillian-junit-container</artifactId>
+      <version>${version.arquillian}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>arquillian-tomee-remote</artifactId>
+      <version>${tomee.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.graphene</groupId>
+      <artifactId>graphene-webdriver</artifactId>
+      <version>${version.graphene.webdriver}</version>
+      <type>pom</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <!--

http://git-wip-us.apache.org/repos/asf/tomee/blob/e3ab4dd9/examples/mvc-resteasy/src/test/java/org/superbiz/mvc/MVCTest.java
----------------------------------------------------------------------
diff --git a/examples/mvc-resteasy/src/test/java/org/superbiz/mvc/MVCTest.java b/examples/mvc-resteasy/src/test/java/org/superbiz/mvc/MVCTest.java
new file mode 100644
index 0000000..cd54922
--- /dev/null
+++ b/examples/mvc-resteasy/src/test/java/org/superbiz/mvc/MVCTest.java
@@ -0,0 +1,74 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.mvc;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.URL;
+
+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.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+@RunWith(Arquillian.class)
+public class MVCTest {
+
+    @ArquillianResource
+    private URL base;
+
+    @Drone
+    private WebDriver webDriver;
+
+    @Deployment
+    public static WebArchive createDeployment() {
+        File[] files = Maven.resolver()
+                            .loadPomFromFile("pom.xml")
+                            .importRuntimeDependencies()
+                            .resolve()
+                            .withTransitivity()
+                            .asFile();
+
+        return ShrinkWrap.create(WebArchive.class, "test.war")
+                         .addPackages(true, "org.superbiz.mvc")
+                         .addAsLibraries(files)
+                         .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
+                         .addAsWebInfResource(new File("src/main/webapp/WEB-INF/web.xml"),
"/web.xml")
+                         .addAsWebInfResource(new File("src/main/webapp/WEB-INF/views/hello.jsp"),
"/views/hello.jsp");
+    }
+
+    @Test
+    @RunAsClient
+    public void test() {
+        webDriver.get(this.base.toExternalForm() + "app/hello?name=TomEE");
+        WebElement h1 = webDriver.findElement(By.tagName("h1"));
+        assertNotNull(h1);
+        assertTrue(h1.getText().contains("Welcome TomEE !"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/e3ab4dd9/examples/mvc-resteasy/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/examples/mvc-resteasy/src/test/resources/arquillian.xml b/examples/mvc-resteasy/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..f792b09
--- /dev/null
+++ b/examples/mvc-resteasy/src/test/resources/arquillian.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+        <container qualifier="tomee" default="true">
+            <configuration>
+               <property name="httpPort">-1</property>
+               <property name="stopPort">-1</property>
+               <property name="ajpPort">-1</property>
+               <property name="dir">target/tomee</property>
+               <property name="appWorkingDir">target/arquillian-dump-dir</property>
+            </configuration>
+        </container>
+</arquillian>


Mime
View raw message