[jboss-svn-commits] JBL Code SVN: r37707 - in labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge: demo-test and 9 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 7 07:12:59 EST 2011


Author: istudens at redhat.com
Date: 2011-11-07 07:12:58 -0500 (Mon, 07 Nov 2011)
New Revision: 37707

Added:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/README
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/pom.xml
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/demotest/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/demotest/TxBridgeDemoTest.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/arquillian.xml
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/logging.properties
Log:
adding maven based tests for txbridge demo app, JBTM-948

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/README
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/README	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/README	2011-11-07 12:12:58 UTC (rev 37707)
@@ -0,0 +1,40 @@
+# JBoss, Home of Professional Open Source.
+# Copyright (c) 2011, Red Hat, Inc., and individual contributors
+# as indicated by the @author tags. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+
+---------  Basic test coverage for JBossTS TxBridge Demo App
+Author: Ivo Studensky <istudens at redhat.com>
+
+This is some basic test coverage for the TxBridge Demo App. It is powered by Arquillian
+and its Drone extension. By default it calls a local Firefox browser to execute the tests.
+
+The test starts up the AS, deploys the TxBridge Demo App bits into it and runs a reservation of some
+seats using both WS-AT and JTA parent tx type (using inbound/outbound xa bridge).
+
+
+--- Requirements:
+1. apache maven tool
+2. xts demo built in /XTS/xts-install/demo dir
+3. tx bridge demo build in /txbridge/demo dir
+
+--- Steps to run:
+
+1. export JBOSS_HOME=<path to JBossAS >= 7.1.0.Alpha2-SNAPSHOT>
+2. mvn clean test

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/pom.xml
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/pom.xml	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/pom.xml	2011-11-07 12:12:58 UTC (rev 37707)
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.jboss.jbossts</groupId>
+    <artifactId>txbridgedemo-test</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <properties>
+        <version.jbossas>7.1.0.Alpha1-SNAPSHOT</version.jbossas>
+        <version.arquillian.junit>1.0.0.CR5</version.arquillian.junit>
+        <version.arquillian.drone>1.0.0.CR2</version.arquillian.drone>
+        <version.junit>4.8.2</version.junit>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Arquillian Drone dependencies and Selenium dependencies -->
+            <dependency>
+                <groupId>org.jboss.arquillian.extension</groupId>
+                <artifactId>arquillian-drone-bom</artifactId>
+                <version>${version.arquillian.drone}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.spec</groupId>
+            <artifactId>jboss-javaee-6.0</artifactId>
+            <version>1.0.0.Final</version>
+            <type>pom</type>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${version.junit}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.arquillian.junit</groupId>
+            <artifactId>arquillian-junit-container</artifactId>
+            <version>${version.arquillian.junit}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.arquillian.ajocado</groupId>
+            <artifactId>arquillian-ajocado-junit</artifactId>
+            <version>${version.arquillian.drone}</version>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>jboss-public-repository-group</id>
+            <name>JBoss Public Repository Group</name>
+            <url>http://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 Repository Group</name>
+            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <version>2.4.1</version>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>${basedir}</directory>
+                            <includes>
+                                <include>restaurantManagerState</include>
+                            </includes>
+                            <followSymlinks>false</followSymlinks>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>arq-jbossas-managed-7</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.as</groupId>
+                    <artifactId>jboss-as-arquillian-container-managed</artifactId>
+                    <version>${version.jbossas}</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+</project>

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/demotest/TxBridgeDemoTest.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/demotest/TxBridgeDemoTest.java	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/java/org/jboss/jbossts/txbridge/demotest/TxBridgeDemoTest.java	2011-11-07 12:12:58 UTC (rev 37707)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jbossts.txbridge.demotest;
+
+import static org.jboss.arquillian.ajocado.Ajocado.elementPresent;
+import static org.jboss.arquillian.ajocado.Ajocado.name;
+import static org.jboss.arquillian.ajocado.Ajocado.waitForHttp;
+import static org.jboss.arquillian.ajocado.Ajocado.waitModel;
+import static org.jboss.arquillian.ajocado.Ajocado.xp;
+
+import org.jboss.arquillian.ajocado.framework.AjaxSelenium;
+import org.jboss.arquillian.ajocado.locator.NameLocator;
+import org.jboss.arquillian.ajocado.locator.XPathLocator;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+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.logging.Logger;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.importer.ZipImporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.net.URL;
+import java.util.zip.ZipFile;
+
+/**
+ * Basic tests for tx bridge demo application.
+ *
+ * @author istudens at redhat.com
+ */
+ at RunWith(Arquillian.class)
+ at RunAsClient
+public class TxBridgeDemoTest {
+    private static final Logger log = Logger.getLogger(TxBridgeDemoTest.class);
+
+    private static final String XTS_DEMO_DIR = "../../XTS/xts-install/demo/build/";
+    private static final String XTS_DEMO_ARCHIVE = "xts-demo.ear";
+
+    private static final String TXBRIDGE_DEMO_DIR = "../demo/build/";
+    private static final String TXBRIDGE_DEMO_SERVICE_ARCHIVE = "txbridge-demo-service.jar";
+    private static final String TXBRIDGE_DEMO_CLIENT_ARCHIVE = "txbridge-demo-client.war";
+
+    private static final String RESULT_TITLE = "Transaction Result";
+    private static final String TRANSACTION_FINISHED = "Transaction finished OK";
+
+    private static final String PARENT_TX_TYPE_AT = "AtomicTransaction";
+    private static final String PARENT_TX_TYPE_JTA = "JTA";
+
+
+    // load ajocado driver
+    @Drone
+    AjaxSelenium driver;
+
+
+    protected NameLocator TX_TYPE_FIELD = name("txType");
+    protected NameLocator SEATS_FIELD = name("seats");
+
+    protected NameLocator SUBMIT_BUTTON = name("submit");
+
+    protected XPathLocator RESULT_TABLE_TITLE_XP = xp("//span[@class='result_title']");
+    protected XPathLocator RESULT_TABLE_CONTENT_XP = xp("//span[@class='result']");
+
+
+    @Deployment(name = XTS_DEMO_ARCHIVE, testable = false, order = 1)
+    public static Archive<?> createXTSDemoArchive() throws Exception {
+        Archive<?> archive = ShrinkWrap.create(ZipImporter.class, XTS_DEMO_ARCHIVE)
+                .importFrom(new ZipFile(XTS_DEMO_DIR + XTS_DEMO_ARCHIVE)).as(EnterpriseArchive.class);
+        return archive;
+    }
+
+    @Deployment(name = TXBRIDGE_DEMO_SERVICE_ARCHIVE, testable = false, order = 2)
+    public static Archive<?> createTxBridgeDemoServiceArchive() throws Exception {
+        Archive<?> archive = ShrinkWrap.create(ZipImporter.class, TXBRIDGE_DEMO_SERVICE_ARCHIVE)
+                .importFrom(new ZipFile(TXBRIDGE_DEMO_DIR + TXBRIDGE_DEMO_SERVICE_ARCHIVE)).as(JavaArchive.class);
+        return archive;
+    }
+
+    @Deployment(name = TXBRIDGE_DEMO_CLIENT_ARCHIVE, testable = false, order = 3)
+    public static Archive<?> createTxBridgeDemoClientArchive() throws Exception {
+        Archive<?> archive = ShrinkWrap.create(ZipImporter.class, TXBRIDGE_DEMO_CLIENT_ARCHIVE)
+                .importFrom(new ZipFile(TXBRIDGE_DEMO_DIR + TXBRIDGE_DEMO_CLIENT_ARCHIVE)).as(WebArchive.class);
+        return archive;
+    }
+
+    @Test  @OperateOnDeployment(TXBRIDGE_DEMO_CLIENT_ARCHIVE)
+    public void testAT(@ArquillianResource URL contextPath) throws Exception {
+        testReservation(PARENT_TX_TYPE_AT, "2", contextPath);
+    }
+
+    @Test  @OperateOnDeployment(TXBRIDGE_DEMO_CLIENT_ARCHIVE)
+    public void testJTA(@ArquillianResource URL contextPath) throws Exception {
+        testReservation(PARENT_TX_TYPE_JTA, "3", contextPath);
+    }
+
+    protected void testReservation(String txType, String seats, URL contextPath) throws Exception {
+        log.info("contextPath = " + contextPath);
+        driver.open(contextPath);
+
+        waitModel.until(elementPresent.locator(TX_TYPE_FIELD));
+        log.info("driver.getTitle() = " + driver.getTitle());
+
+        driver.type(TX_TYPE_FIELD, txType);
+        driver.type(SEATS_FIELD, seats);
+
+        waitForHttp(driver).click(SUBMIT_BUTTON);
+
+        String resultTableTitle = driver.getText(RESULT_TABLE_TITLE_XP);
+        log.info("resultTableTitle = " + resultTableTitle);
+        Assert.assertTrue("Page does not contain any results!", resultTableTitle.contains(RESULT_TITLE));
+
+        String resultTableContent = driver.getText(RESULT_TABLE_CONTENT_XP);
+        log.info("resultTableContent = " + resultTableContent);
+        Assert.assertTrue("Transaction failed with: " + resultTableContent, resultTableContent.contains(TRANSACTION_FINISHED));
+    }
+
+}

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/arquillian.xml
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/arquillian.xml	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/arquillian.xml	2011-11-07 12:12:58 UTC (rev 37707)
@@ -0,0 +1,15 @@
+<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="jboss" default="true">
+        <configuration>
+            <property name="serverConfig">standalone-xts.xml</property>
+        </configuration>
+    </container>
+    <extension qualifier="ajocado">
+        <property name="seleniumTimeoutDefault">60000</property>
+        <property name="seleniumTimeoutGui">60000</property>
+        <property name="seleniumTimeoutAjax">60000</property>
+        <property name="seleniumTimeoutModel">60000</property>
+    </extension>
+</arquillian>
\ No newline at end of file

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/logging.properties
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/logging.properties	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/txbridge/demo-test/src/test/resources/logging.properties	2011-11-07 12:12:58 UTC (rev 37707)
@@ -0,0 +1,55 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2010, Red Hat, Inc., and individual contributors
+# as indicated by the @author tags. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# Additional logger names to configure (root logger is always configured)
+loggers=sun.rmi,org.jboss.shrinkwrap
+logger.org.jboss.shrinkwrap.level=INFO
+logger.sun.rmi.level=WARNING
+
+# Root logger level
+logger.level=DEBUG
+
+# Root logger handlers
+logger.handlers=FILE, CONSOLE
+
+# Console handler configuration
+handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
+handler.CONSOLE.properties=autoFlush
+handler.CONSOLE.level=INFO
+handler.CONSOLE.autoFlush=true
+handler.CONSOLE.formatter=PATTERN
+
+# File handler configuration
+handler.FILE=org.jboss.logmanager.handlers.FileHandler
+handler.FILE.level=DEBUG
+handler.FILE.properties=autoFlush,fileName
+handler.FILE.autoFlush=true
+handler.FILE.fileName=./target/test.log
+handler.FILE.formatter=PATTERN
+
+# Formatter pattern configuration
+formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.PATTERN.properties=pattern
+formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n
+
+
+logger.sun.rmi



More information about the jboss-svn-commits mailing list