[jboss-svn-commits] JBL Code SVN: r37735 - in labs/jbosstm/trunk/XTS/localjunit: crash-recovery-tests and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 24 02:26:34 EST 2011
Author: zhfeng
Date: 2011-11-24 02:26:33 -0500 (Thu, 24 Nov 2011)
New Revision: 37735
Added:
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/pom.xml
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/BaseCrashTest.java
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/TestATCrashDuringOnePhaseCommit.java
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/
Modified:
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/arquillian.xml
labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt
Log:
JBTM-817 update to add crash recovery tests
Property changes on: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests
___________________________________________________________________
Added: svn:ignore
+ target
.classpath
.project
.settings
Added: svn:ingore
+ target
.project
.classpath
.settings
Added: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/pom.xml
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/pom.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/pom.xml 2011-11-24 07:26:33 UTC (rev 37735)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated by the @authors tag. All rights reserved. See the copyright.txt in the distribution
+ for a full listing of individual contributors. This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the GNU Lesser
+ General Public License, v. 2.1. This program is distributed in the hope that it will be useful, but WITHOUT A 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, v.2.1 along with this distribution; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <groupId>org.jboss.narayana.xts</groupId>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>localjunit-crash-recovery-tests</artifactId>
+ <packaging>jar</packaging>
+ <name>xts crash recovery tests</name>
+ <description>xts crash recovery tests</description>
+ <version>5.0.0.M2-SNAPSHOT</version>
+ <!--
+ <repositories>
+ <repository>
+ <id>jboss-public-repository</id>
+ <name>JBoss Repository</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.narayana.xts</groupId>
+ <artifactId>xtstest</artifactId>
+ <version>5.0.0.M2-SNAPSHOT</version>
+ <type>war</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <!-- The default profile skips all tests, though you can tune it
+ to run just unit tests based on a custom pattern -->
+ <!-- Seperate profiles are provided for running all tests, including
+ Arquillian tests that execute in the specified container -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.2</version>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>7.0.2.Final</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
Added: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/BaseCrashTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/BaseCrashTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/BaseCrashTest.java 2011-11-24 07:26:33 UTC (rev 37735)
@@ -0,0 +1,43 @@
+package com.arjuna.qa.junit;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+
+public class BaseCrashTest {
+ protected String XTSServiceTest = " -Dorg.jboss.jbossts.xts.servicetests.XTSServiceTestName=@TestName@";
+ protected String BytemanArgs = "-Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.byteman.transform.all -javaagent:target/test-classes/lib/byteman.jar=script:target/test-classes/scripts/@BMScript at .txt,boot:target/test-classes/lib/byteman.jar,listener:true";
+ protected String javaVmArguments;
+ protected String testName;
+ protected String scriptName;
+
+ @Before
+ public void setUp() {
+ javaVmArguments = BytemanArgs.replace("@BMScript@", scriptName);
+
+ File file = new File("testlog");
+ if(file.isFile() && file.exists()){
+ file.delete();
+ }
+ }
+
+ @After
+ public void tearDown() {
+ String log = "target/log";
+
+ if(testName != null && scriptName != null) {
+ String logFileName = scriptName + "." + testName;
+ File file = new File("testlog");
+ File logDir = new File(log);
+
+ if(!logDir.exists()) {
+ logDir.mkdirs();
+ }
+
+ if(file.isFile() && file.exists()){
+ file.renameTo(new File(log+"/"+logFileName));
+ }
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/TestATCrashDuringOnePhaseCommit.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/TestATCrashDuringOnePhaseCommit.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/TestATCrashDuringOnePhaseCommit.java 2011-11-24 07:26:33 UTC (rev 37735)
@@ -0,0 +1,63 @@
+package com.arjuna.qa.junit;
+
+import java.io.File;
+
+import org.jboss.arquillian.container.test.api.Config;
+import org.jboss.arquillian.container.test.api.ContainerController;
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class TestATCrashDuringOnePhaseCommit extends BaseCrashTest {
+ private final static String xtstestWar = "../../sar/tests/target/xtstest.war";
+
+ @ArquillianResource
+ private ContainerController controller;
+
+ @ArquillianResource
+ private Deployer deployer;
+
+ public TestATCrashDuringOnePhaseCommit() {
+ scriptName ="ATCrashDuringOnePhaseCommit";
+ }
+
+ @Deployment(name = "xtstest", testable = false, managed = false)
+ @TargetsContainer("jboss-as")
+ public static Archive<?> createTestArchive() {
+ WebArchive archive = ShrinkWrap.
+ createFromZipFile(WebArchive.class, new File(xtstestWar));
+ return archive;
+ }
+
+ @Test
+ public void SingleParticipantPrepareAndCommit() throws Exception {
+ testName = "SingleParticipantPrepareAndCommit";
+ String testClass = "org.jboss.jbossts.xts.servicetests.test.at.SingleParticipantPrepareAndCommitTest";
+ Config config = new Config();
+ config.add("javaVmArguments", javaVmArguments + XTSServiceTest.replace("@TestName@", testClass));
+
+ controller.start("jboss-as", config.map());
+ deployer.deploy("xtstest");
+
+ //Waiting for crash
+ Thread.sleep(2 * 60 * 1000);
+
+ //Boot jboss as after crashing
+ config.add("javaVmArguments", javaVmArguments);
+ controller.start("jboss-as", config.map());
+
+ //Waiting for recovery
+ Thread.sleep(5 * 60 * 1000);
+
+ deployer.undeploy("xtstest");
+ controller.stop("jboss-as");
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/java/com/arjuna/qa/junit/TestATCrashDuringOnePhaseCommit.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/arquillian.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml 2011-11-08 16:22:13 UTC (rev 37711)
+++ labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/arquillian.xml 2011-11-24 07:26:33 UTC (rev 37735)
@@ -1,17 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
+ <!--
<engine>
<property name="maxTestClassesBeforeRestart">2</property>
</engine>
+ -->
<!-- Example configuration for a remote JBoss AS 7 instance -->
- <container qualifier="jboss-as" default="true">
+ <container qualifier="jboss-as" default="true" mode="manual">
<protocol type="jmx-as7">
<property name="executionType">REMOTE</property>
</protocol>
<configuration>
<property name="serverConfig">standalone-xts.xml</property>
+ <!--
<property name="javaVmArguments">-Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.byteman.transform.all -javaagent:target/test-classes/lib/byteman.jar=script:target/test-classes/scripts/Running.txt,boot:target/test-classes/lib/byteman.jar,listener:true</property>
+
+ <property name="javaVmArguments">-Dorg.jboss.jbossts.xts.servicetests.XTSServiceTestName=org.jboss.jbossts.xts.servicetests.test.at.SingleParticipantPrepareAndCommitTest</property>
+ -->
</configuration>
</container>
</arquillian>
Modified: labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt 2011-11-08 16:22:13 UTC (rev 37711)
+++ labs/jbosstm/trunk/XTS/localjunit/crash-recovery-tests/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt 2011-11-24 07:26:33 UTC (rev 37735)
@@ -439,6 +439,6 @@
BIND NOTHING
IF TRUE
DO debug("!!!killing JVM!!!"),
- traceln("log", "JVM exit"),
- killJVM()
+ traceln("log", "JVM exit")
+# killJVM()
ENDRULE
More information about the jboss-svn-commits
mailing list