[jboss-svn-commits] JBL Code SVN: r37719 - in labs/jbosstm/trunk/XTS/localjunit: WSAS and 20 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Nov 11 01:35:05 EST 2011
Author: zhfeng
Date: 2011-11-11 01:35:04 -0500 (Fri, 11 Nov 2011)
New Revision: 37719
Added:
labs/jbosstm/trunk/XTS/localjunit/WSAS/
labs/jbosstm/trunk/XTS/localjunit/WSAS/pom.xml
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoHLS.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoSOAPContextImple.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/FailureHLS.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/WSASTestUtils.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Context.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Hierarchy.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NestedActivity.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NullEnd.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Resume.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StartEnd.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StatusCheck.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Suspend.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Timeout.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context1.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context2.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Service.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/WarDeployment.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ContextTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/HierarchyTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NestedActivityTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NullEndTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ResumeTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StartEndTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StatusCheckTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/SuspendTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/TimeoutTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context1Test.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context2Test.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/ServiceTest.java
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/resources/
labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/resources/arquillian.xml
Log:
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS
___________________________________________________________________
Added: svn:ignore
+ target
.project
.classpath
.settings
Added: svn:ingore
+ target
.project
.classpath
.settings
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/pom.xml
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/pom.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/pom.xml 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,84 @@
+<?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-wsas-tests</artifactId>
+ <packaging>jar</packaging>
+ <name>wsas unit tests</name>
+ <description>wsas unit tests</description>
+ <version>5.0.0.M2-SNAPSHOT</version>
+ <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>jbossxts</artifactId>
+ <version>5.0.0.M2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>1.0.0.CR5</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>true</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>
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoHLS.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoHLS.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoHLS.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoHLS.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests;
+
+import com.arjuna.mw.wsas.context.Context;
+
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.common.GlobalId;
+
+import com.arjuna.mw.wsas.activity.Outcome;
+import com.arjuna.mw.wsas.activity.HLS;
+
+import com.arjuna.mw.wsas.completionstatus.CompletionStatus;
+
+import com.arjuna.mw.wsas.exceptions.*;
+
+import java.util.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoHLS.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class DemoHLS implements HLS
+{
+ private Stack<GlobalId> _id;
+
+ public DemoHLS()
+ {
+ _id = new Stack<GlobalId>();
+ }
+
+ /**
+ * An activity has begun and is active on the current thread.
+ */
+
+ public void begun () throws SystemException
+ {
+ try
+ {
+ GlobalId activityId = UserActivityFactory.userActivity().activityId();
+
+ _id.push(activityId);
+
+ System.out.println("DemoHLS.begun "+activityId);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * The current activity is completing with the specified completion status.
+ *
+ * @return The result of terminating the relationship of this HLS and
+ * the current activity.
+ */
+
+ public Outcome complete (CompletionStatus cs) throws SystemException
+ {
+ try
+ {
+ System.out.println("DemoHLS.complete ( "+cs+" ) " + UserActivityFactory.userActivity().activityId());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * The activity has been suspended. How does the HLS know which activity
+ * has been suspended? It must remember what its notion of current is.
+ */
+
+ public void suspended () throws SystemException
+ {
+ System.out.println("DemoHLS.suspended");
+ }
+
+ /**
+ * The activity has been resumed on the current thread.
+ */
+
+ public void resumed () throws SystemException
+ {
+ System.out.println("DemoHLS.resumed");
+ }
+
+ /**
+ * The activity has completed and is no longer active on the current
+ * thread.
+ */
+
+ public void completed () throws SystemException
+ {
+ try {
+ System.out.println("DemoHLS.completed "+ UserActivityFactory.userActivity().activityId());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ if (!_id.isEmpty()) {
+ _id.pop();
+ }
+ }
+
+ /**
+ * The HLS name.
+ */
+
+ public String identity () throws SystemException
+ {
+ return "DemoHLS";
+ }
+
+ /**
+ * The activity service maintains a priority ordered list of HLS
+ * implementations. If an HLS wishes to be ordered based on priority
+ * then it can return a non-negative value: the higher the value,
+ * the higher the priority and hence the earlier in the list of HLSes
+ * it will appear (and be used in).
+ *
+ * @return a positive value for the priority for this HLS, or zero/negative
+ * if the order is not important.
+ */
+
+ public int priority () throws SystemException
+ {
+ return 0;
+ }
+
+ /**
+ * Return the context augmentation for this HLS, if any on the current
+ * activity.
+ *
+ * @return a context object or null if no augmentation is necessary.
+ */
+
+ public Context context () throws SystemException
+ {
+ if (_id.isEmpty()) {
+ throw new SystemException("request for context when inactive");
+ }
+ try {
+ System.out.println("DemoHLS.context "+ UserActivityFactory.userActivity().activityId());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return new DemoSOAPContextImple(identity() + "_" + _id.size());
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoSOAPContextImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoSOAPContextImple.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/DemoSOAPContextImple.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoSOAPContextImple.java,v 1.5.4.1 2005/11/22 10:31:42 kconner Exp $
+ */
+
+package com.arjuna.wsas.tests;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+
+import com.arjuna.mw.wsas.context.soap.SOAPContext;
+
+/**
+ */
+
+public class DemoSOAPContextImple implements SOAPContext
+{
+
+ public DemoSOAPContextImple (String id)
+ {
+ try
+ {
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+
+ org.w3c.dom.Document doc = docBuilder.newDocument();
+ _context = doc.createElement(id);
+
+ _context.appendChild(doc.createTextNode("urn:mycomputer.org:"+id+":foo:bar"));
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ _context = null;
+ }
+ }
+
+ public void initialiseContext (Object param)
+ {
+ }
+
+ /**
+ * Serialise the SOAP context into a DOM node.
+ * @param element The element to contain the serialisation.
+ * @return the element added.
+ */
+ public Element serialiseToElement(final Element element)
+ {
+ Document document = element.getOwnerDocument();
+ // copy the context structure into the document
+ Element context = document.createElement(_context.getTagName());
+ context.appendChild(document.createTextNode(_context.getTextContent()));
+ element.appendChild(context);
+ return context;
+ }
+
+ public String identifier ()
+ {
+ return "DemoSOAPContextImple";
+ }
+
+ public String toString ()
+ {
+ return _context.toString() ;
+ }
+
+ private org.w3c.dom.Element _context;
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/FailureHLS.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/FailureHLS.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/FailureHLS.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: FailureHLS.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests;
+
+import com.arjuna.mw.wsas.context.Context;
+
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.common.GlobalId;
+
+import com.arjuna.mw.wsas.activity.Outcome;
+import com.arjuna.mw.wsas.activity.HLS;
+
+import com.arjuna.mw.wsas.completionstatus.CompletionStatus;
+
+import com.arjuna.mw.wsas.exceptions.*;
+
+import java.util.Stack;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: FailureHLS.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class FailureHLS implements HLS
+{
+ private Stack<GlobalId> _id;
+
+ public static final int BEGUN_FAIL = 0;
+ public static final int COMPLETE_FAIL = 1;
+ public static final int SUSPENDED_FAIL = 2;
+ public static final int RESUMED_FAIL = 3;
+ public static final int COMPLETED_FAIL = 4;
+ public static final int CONTEXT_FAIL = 5;
+ public static final int NO_FAIL = 10;
+
+ public FailureHLS ()
+ {
+ this(FailureHLS.NO_FAIL);
+ }
+
+ public FailureHLS (int failPoint)
+ {
+ _failPoint = failPoint;
+ _id = new Stack<GlobalId>();
+ }
+
+ /**
+ * An activity has begun and is active on the current thread.
+ */
+
+ public void begun () throws SystemException
+ {
+ if (_failPoint == FailureHLS.BEGUN_FAIL)
+ throw new SystemException();
+
+ try
+ {
+ GlobalId activityId = UserActivityFactory.userActivity().activityId();
+
+ _id.push(activityId);
+
+ System.out.println("FailureHLS.begun "+activityId);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * The current activity is completing with the specified completion status.
+ *
+ * @param cs cs The completion status to use.
+ *
+ * @return The result of terminating the relationship of this HLS and
+ * the current activity.
+ */
+
+ public Outcome complete (CompletionStatus cs) throws SystemException
+ {
+ if (_failPoint == FailureHLS.COMPLETE_FAIL)
+ throw new SystemException();
+
+ try
+ {
+ System.out.println("FailureHLS.complete ( "+cs+" ) "+ UserActivityFactory.userActivity().activityId());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * The activity has been suspended. How does the HLS know which activity
+ * has been suspended? It must remember what its notion of current is.
+ */
+
+ public void suspended () throws SystemException
+ {
+ if (_failPoint == FailureHLS.SUSPENDED_FAIL)
+ throw new SystemException();
+
+ System.out.println("FailureHLS.suspended");
+ }
+
+ /**
+ * The activity has been resumed on the current thread.
+ */
+
+ public void resumed () throws SystemException
+ {
+ if (_failPoint == FailureHLS.RESUMED_FAIL)
+ throw new SystemException();
+
+ System.out.println("FailureHLS.resumed");
+ }
+
+ /**
+ * The activity has completed and is no longer active on the current
+ * thread.
+ */
+
+ public void completed () throws SystemException
+ {
+ if (_failPoint == FailureHLS.COMPLETED_FAIL)
+ throw new SystemException();
+
+ try
+ {
+ System.out.println("FailureHLS.completed " + UserActivityFactory.userActivity().activityId());
+ if (!_id.isEmpty()) {
+ _id.pop();
+ }
+ }
+ catch (NoActivityException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * The HLS name.
+ */
+
+ public String identity () throws SystemException
+ {
+ return "FailureHLS";
+ }
+
+ /**
+ * The activity service maintains a priority ordered list of HLS
+ * implementations. If an HLS wishes to be ordered based on priority
+ * then it can return a non-negative value: the higher the value,
+ * the higher the priority and hence the earlier in the list of HLSes
+ * it will appear (and be used in).
+ *
+ * @return a positive value for the priority for this HLS, or zero/negative
+ * if the order is not important.
+ */
+
+ public int priority () throws SystemException
+ {
+ return 0;
+ }
+
+ /**
+ * Return the context augmentation for this HLS, if any on the current
+ * activity.
+ *
+ * @return a context object or null if no augmentation is necessary.
+ */
+
+ public Context context () throws SystemException
+ {
+ if (_failPoint == FailureHLS.CONTEXT_FAIL)
+ throw new SystemException();
+
+ if (_id.isEmpty()) {
+ throw new SystemException("request for context when inactive");
+ }
+
+ try {
+ System.out.println("DemoHLS.context "+ UserActivityFactory.userActivity().activityId());
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return new DemoSOAPContextImple(identity() + "_" + _id.size());
+ }
+
+ private int _failPoint;
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/WSASTestUtils.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/WSASTestUtils.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/WSASTestUtils.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,23 @@
+package com.arjuna.wsas.tests;
+
+import com.arjuna.mw.wsas.UserActivity;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: adinn
+ * Date: Mar 12, 2008
+ * Time: 11:17:26 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class WSASTestUtils {
+ static public void cleanup(UserActivity ua)
+ {
+ try {
+ while (ua.currentActivity() != null) {
+ ua.end();
+ }
+ } catch (Exception e) {
+ // do nothing -- caller will be dealing with exceptions
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Context.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Context.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Context.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Context.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.ActivityManagerFactory;
+import com.arjuna.mw.wsas.activity.HLS;
+
+import com.arjuna.mw.wsas.context.ContextManager;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Context.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Context
+{
+
+ public void testContext()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ HLS[] currentHLS = ActivityManagerFactory.activityManager().allHighLevelServices();
+
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().removeHLS(hls);
+ }
+
+ try
+ {
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ContextManager manager = new ContextManager();
+ com.arjuna.mw.wsas.context.Context context = manager.context("dummy");
+
+ if (context != null) {
+ fail("Context not null: "+ context);
+ }
+ } finally {
+ try {
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().addHLS(hls);
+ }
+ } catch (Exception e) {
+
+ }
+ WSASTestUtils.cleanup(ua);
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Hierarchy.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Hierarchy.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Hierarchy.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Hierarchy.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.exceptions.NoActivityException;
+import com.arjuna.mw.wsas.activity.ActivityHierarchy;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Hierarchy.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Hierarchy
+{
+
+ public void testHierarchy()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+
+ try
+ {
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ActivityHierarchy ctx = ua.currentActivity();
+
+ System.out.println("\nHierarchy: "+ctx);
+
+ if (ctx == null) {
+ fail("current activity should not be null");
+ } else {
+ ua.end();
+
+ System.out.println("\nCurrent: "+ua.activityName());
+
+ ua.end();
+
+ try {
+ if (ua.activityName() != null) {
+ fail("activity name should be null but is " + ua.activityName());
+ }
+ } catch (NoActivityException ex) {
+ // ok if we get here
+ }
+ }
+ } catch (Exception ex) {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ }
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NestedActivity.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NestedActivity.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NestedActivity.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: NestedActivity.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.exceptions.NoActivityException;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: NestedActivity.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class NestedActivity
+{
+
+ public void testNestedActivity()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+
+ try
+ {
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start("dummy");
+
+ String nested = ua.activityName();
+
+ System.out.println("Started: "+nested);
+
+ System.out.println("\nEnding: "+nested);
+
+ ua.end();
+
+ String parent = ua.activityName();
+
+ System.out.println("\nCurrent: "+parent);
+
+ System.out.println("\nEnding: "+parent);
+
+ ua.end();
+
+ try {
+ if (ua.activityName() != null) {
+ fail("activity name should be null but is " + ua.activityName());
+ }
+ } catch (NoActivityException ex) {
+ // ok if we get here
+ }
+
+ System.out.println("\nEnded.");
+
+ }
+ catch (Exception ex)
+ {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NullEnd.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NullEnd.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/NullEnd.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: NullEnd.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.exceptions.NoActivityException;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: NullEnd.java,v 1.1 2002/11/25 10:51:46 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class NullEnd
+{
+
+ public void testNullEnd()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ try
+ {
+ ua.end();
+ fail("should have thrown NoActivityException");
+ }
+ catch (NoActivityException ex)
+ {
+ // it's ok if we arrive here?
+ }
+ catch (Exception ex) {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Resume.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Resume.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Resume.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Resume.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.activity.ActivityHierarchy;
+
+import com.arjuna.mw.wsas.common.GlobalId;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Resume.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Resume
+{
+
+ public void testResume()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+
+ try
+ {
+ GlobalId ac1 = null;
+ GlobalId ac2 = null;
+
+ ua.start("dummy");
+
+ ac1 = ua.activityId();
+
+ System.out.println("Started: "+ac1);
+
+ ua.start("dummy");
+
+ ac2 = ua.activityId();
+
+ System.out.println("\nStarted: "+ac2);
+
+ ActivityHierarchy ctx = ua.suspend();
+
+ System.out.println("\nSuspended: "+ctx);
+
+ if (ua.currentActivity() != null) {
+ fail("Current activity shoudl be null " + ua.currentActivity());
+ }
+
+ ua.resume(ctx);
+
+ if (!ac2.equals(ua.activityId()))
+ {
+ fail("Current activity id " + ua.activityId() + " should equal " + ac2);
+ }
+
+ ua.end();
+
+ if (!ac1.equals(ua.activityId())) {
+ fail("Current activity id " + ua.activityId() + " should equal " + ac1);
+ }
+ } finally {
+ WSASTestUtils.cleanup(ua);
+ }
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StartEnd.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StartEnd.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StartEnd.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: StartEnd.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: StartEnd.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class StartEnd
+{
+ public void testStartEnd()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ ua.start("dummy");
+
+ ua.end();
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StatusCheck.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StatusCheck.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/StatusCheck.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: StatusCheck.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.activity.Outcome;
+
+import com.arjuna.mw.wsas.status.NoActivity;
+import com.arjuna.mw.wsas.status.Active;
+
+import com.arjuna.mw.wsas.completionstatus.Failure;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: StatusCheck.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class StatusCheck
+{
+
+ public void testStatusCheck()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+
+ if (ua.status() != NoActivity.instance()) {
+ fail("Status should be NoActivity " + ua.status());
+ }
+
+ ua.start("dummy");
+
+ if (ua.status() != Active.instance()) {
+ fail("Status should be Active " + ua.status());
+ }
+ Outcome res = ua.end();
+
+ if (!res.completedStatus().equals(Failure.instance())) {
+ fail("Completed status should be Failure " + res.completedStatus());
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Suspend.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Suspend.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Suspend.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Suspend.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.activity.ActivityHierarchy;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Suspend.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Suspend
+{
+
+ public void testSuspend()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+
+ try
+ {
+ ua.start("dummy");
+
+ System.out.println("Started: "+ua.activityName());
+
+ ActivityHierarchy ctx = ua.suspend();
+
+ System.out.println("\nSuspended: "+ctx);
+
+ if (ua.currentActivity() != null) {
+ fail("Current activity should be null " + ua.currentActivity());
+ }
+ }
+ catch (Exception ex)
+ {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Timeout.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Timeout.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/basic/Timeout.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Timeout.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+
+import com.arjuna.mw.wsas.status.*;
+
+import com.arjuna.mw.wsas.completionstatus.*;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Timeout.java,v 1.2 2005/05/19 12:13:19 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Timeout
+{
+
+ public void testTimeout()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ int timeout = ua.getTimeout();
+ try {
+ ua.setTimeout(1);
+
+ ua.start("dummy");
+
+ Thread.currentThread();
+ Thread.sleep(2000);
+
+ if (!(ua.status() instanceof Completed)) {
+ ua.end();
+ fail("Activity status should be Completed " + ua.status());
+ }
+ if (!(ua.getCompletionStatus() instanceof Failure)) {
+ fail("Activity completion status should be Failure " + ua.getCompletionStatus());
+ }
+ System.out.println("Activity status: "+ua.status());
+ } finally {
+ ua.setTimeout(timeout);
+ WSASTestUtils.cleanup(ua);
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context1.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context1.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context1.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Context1.java,v 1.2.24.1 2005/11/22 10:31:41 kconner Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Named;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import com.arjuna.mw.wsas.ActivityManagerFactory;
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.activity.HLS;
+import com.arjuna.mw.wsas.context.Context;
+import com.arjuna.mw.wsas.context.ContextManager;
+import com.arjuna.mw.wsas.context.soap.SOAPContext;
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.DemoSOAPContextImple;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Context1.java,v 1.2.24.1 2005/11/22 10:31:41 kconner Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Context1
+{
+
+ public void testContext1()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ DemoHLS demoHLS = new DemoHLS();
+ HLS[] currentHLS = ActivityManagerFactory.activityManager().allHighLevelServices();
+
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().removeHLS(hls);
+ }
+ try
+ {
+ ActivityManagerFactory.activityManager().addHLS(demoHLS);
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+ org.w3c.dom.Document doc = docBuilder.newDocument();
+ org.w3c.dom.Element root = doc.createElement("Context1-test");
+ doc.appendChild(root);
+ String coordinationType = demoHLS.identity();
+
+ ua.start(coordinationType);
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start(coordinationType);
+
+ System.out.println("Started: "+ua.activityName()+"\n");
+
+ ContextManager contextManager = new ContextManager();
+ Context theContext = contextManager.context(coordinationType);
+
+ if (theContext == null) {
+ fail("Demo context not found");
+ }
+
+ if (!(theContext instanceof DemoSOAPContextImple)) {
+ fail("Demo context not found");
+ }
+
+ ((SOAPContext)theContext).serialiseToElement(root);
+
+ System.out.println("Context is " + root.getTextContent());
+
+ ua.end();
+
+ System.out.println("\nFinished child activity.\n");
+
+ theContext = contextManager.context(coordinationType);
+
+ if (theContext == null) {
+ fail("Demo context not found");
+ }
+
+ if (!(theContext instanceof DemoSOAPContextImple)) {
+ fail("Demo context not found");
+ }
+
+ doc = docBuilder.newDocument();
+ root = doc.createElement("Context1-test");
+ doc.appendChild(root);
+
+
+ ((SOAPContext)theContext).serialiseToElement(root);
+
+ System.out.println("Context is " + root.getTextContent());
+
+ ua.end();
+
+ System.out.println("\nFinished parent activity.\n");
+
+ theContext = contextManager.context(coordinationType);
+
+ if (theContext != null) {
+ fail("Demo context not removed");
+ }
+ }
+ catch (Exception ex)
+ {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ } finally {
+ try {
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().addHLS(hls);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ try {
+ if (demoHLS != null) {
+ ActivityManagerFactory.activityManager().removeHLS(demoHLS);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context2.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context2.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Context2.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Context2.java,v 1.3.24.1 2005/11/22 10:31:41 kconner Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Named;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import com.arjuna.mw.wsas.ActivityManagerFactory;
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.activity.HLS;
+import com.arjuna.mw.wsas.context.Context;
+import com.arjuna.mw.wsas.context.ContextManager;
+import com.arjuna.mw.wsas.context.soap.SOAPContext;
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.FailureHLS;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.DemoSOAPContextImple;
+import static org.junit.Assert.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Context2.java,v 1.3.24.1 2005/11/22 10:31:41 kconner Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Context2
+{
+
+ public void testContext2()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ DemoHLS demoHLS = new DemoHLS();
+ FailureHLS failureHLS = new FailureHLS(); // this constructor means it will not fail
+ HLS[] currentHLS = ActivityManagerFactory.activityManager().allHighLevelServices();
+
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().removeHLS(hls);
+ }
+ try
+ {
+ ActivityManagerFactory.activityManager().addHLS(demoHLS);
+ ActivityManagerFactory.activityManager().addHLS(failureHLS);
+
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+ org.w3c.dom.Document doc = docBuilder.newDocument();
+ org.w3c.dom.Element root = doc.createElement("Context2-test");
+ doc.appendChild(root);
+ String demoServiceType = demoHLS.identity();
+ String failureServiceType = failureHLS.identity();
+
+ ua.start(demoServiceType);
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start(failureServiceType);
+
+ System.out.println("Started: "+ua.activityName()+"\n");
+
+ String currentServiceType = ua.serviceType();
+
+ if (currentServiceType != failureServiceType) {
+ fail("invalid service type for current activity");
+ }
+
+ ContextManager contextManager = new ContextManager();
+
+ Context demoServiceContext;
+ Context failureServiceContext;
+
+ demoServiceContext = contextManager.context(demoServiceType);
+ failureServiceContext = contextManager.context(failureServiceType);
+
+ // we should find a context for each service
+
+ if (failureServiceContext == null) {
+ fail("Failure context not found");
+ } else if (demoServiceContext != null) {
+ fail("Found multiple contexts");
+ }
+
+ if (!(failureServiceContext instanceof DemoSOAPContextImple)) {
+ fail("Failure context not found");
+ }
+
+ ((SOAPContext)failureServiceContext).serialiseToElement(root);
+
+ System.out.println("Faiure Context is " + root.getTextContent());
+
+ ua.end();
+
+ System.out.println("\nFinished child activity.\n");
+
+ currentServiceType = ua.serviceType();
+
+ if (currentServiceType != demoServiceType) {
+ fail("invalid service type for current activity");
+ }
+
+ demoServiceContext = contextManager.context(demoServiceType);
+ failureServiceContext = contextManager.context(failureServiceType);
+
+ // we should only find one context for the demo service
+
+ if (demoServiceContext == null) {
+ fail("Demo context not found");
+ } else if (failureServiceContext != null) {
+ fail("Found multiple contexts");
+ }
+
+ if (!(demoServiceContext instanceof DemoSOAPContextImple)) {
+ fail("Demo context not found");
+ }
+
+ ((SOAPContext)demoServiceContext).serialiseToElement(root);
+
+ System.out.println("Demo Context is " + root.getTextContent());
+
+ ua.end();
+
+ System.out.println("\nFinished parent activity.\n");
+ }
+ catch (Exception ex)
+ {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ } finally {
+ try {
+ for (HLS hls : currentHLS) {
+ ActivityManagerFactory.activityManager().addHLS(hls);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ try {
+ if (demoHLS != null) {
+ ActivityManagerFactory.activityManager().removeHLS(demoHLS);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ try {
+ if (failureHLS != null) {
+ ActivityManagerFactory.activityManager().removeHLS(failureHLS);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Service.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Service.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/main/java/com/arjuna/wsas/tests/arq/hls/Service.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Service.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ */
+
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Named;
+
+import com.arjuna.mw.wsas.UserActivity;
+import com.arjuna.mw.wsas.UserActivityFactory;
+import com.arjuna.mw.wsas.ActivityManagerFactory;
+
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.WSASTestUtils;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: Service.java,v 1.1 2002/11/25 10:51:47 nmcl Exp $
+ * @since 1.0.
+ */
+
+ at Named
+public class Service
+{
+
+ public void testService()
+ throws Exception
+ {
+ UserActivity ua = UserActivityFactory.userActivity();
+ DemoHLS demoHLS = new DemoHLS();
+ try
+ {
+ ActivityManagerFactory.activityManager().addHLS(demoHLS);
+ String coordinationType = demoHLS.identity();
+
+ ua.start(coordinationType);
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.start(coordinationType);
+
+ System.out.println("Started: "+ua.activityName());
+
+ ua.end();
+
+ ua.end();
+ }
+ catch (Exception ex)
+ {
+ WSASTestUtils.cleanup(ua);
+ throw ex;
+ } finally {
+ try {
+ if (demoHLS != null) {
+ ActivityManagerFactory.activityManager().removeHLS(demoHLS);
+ }
+ } catch (Exception ex) {
+ // ignore this
+ }
+ }
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/WarDeployment.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/WarDeployment.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/WarDeployment.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,24 @@
+package com.arjuna.wsas.tests.arq;
+
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+public class WarDeployment {
+ public static WebArchive getDeployment(Class<?>...args){
+ WebArchive archive = ShrinkWrap
+ .create(WebArchive.class, "test.war")
+ .addClasses(args)
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+
+ archive.delete(ArchivePaths.create("META-INF/MANIFEST.MF"));
+
+ final String ManifestMF = "Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.modules,deployment.arquillian-service,org.jboss.msc,org.jboss.jts,org.jboss.xts\n";
+ archive.setManifest(new StringAsset(ManifestMF));
+
+ return archive;
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ContextTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ContextTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ContextTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class ContextTest {
+ @Inject
+ Context test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Context.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testContext();
+ }
+}
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/HierarchyTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/HierarchyTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/HierarchyTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class HierarchyTest {
+ @Inject
+ Hierarchy test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Hierarchy.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testHierarchy();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/HierarchyTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NestedActivityTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NestedActivityTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NestedActivityTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class NestedActivityTest {
+ @Inject
+ NestedActivity test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ NestedActivity.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testNestedActivity();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NestedActivityTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NullEndTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NullEndTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NullEndTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class NullEndTest {
+ @Inject
+ NullEnd test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ NullEnd.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testNullEnd();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/NullEndTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ResumeTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ResumeTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ResumeTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class ResumeTest {
+ @Inject
+ Resume test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Resume.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testResume();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/ResumeTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StartEndTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StartEndTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StartEndTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class StartEndTest {
+ @Inject
+ StartEnd test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ StartEnd.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testStartEnd();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StartEndTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StatusCheckTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StatusCheckTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StatusCheckTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class StatusCheckTest {
+ @Inject
+ StatusCheck test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ StatusCheck.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testStatusCheck();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/StatusCheckTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/SuspendTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/SuspendTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/SuspendTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class SuspendTest {
+ @Inject
+ Suspend test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Suspend.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testSuspend();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/SuspendTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/TimeoutTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/TimeoutTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/TimeoutTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,30 @@
+package com.arjuna.wsas.tests.arq.basic;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class TimeoutTest {
+ @Inject
+ Timeout test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Timeout.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testTimeout();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/basic/TimeoutTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context1Test.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context1Test.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context1Test.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,34 @@
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.DemoSOAPContextImple;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class Context1Test {
+ @Inject
+ Context1 test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Context1.class,
+ DemoHLS.class,
+ DemoSOAPContextImple.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testContext1();
+ }
+}
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context1Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context2Test.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context2Test.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context2Test.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,37 @@
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.DemoSOAPContextImple;
+import com.arjuna.wsas.tests.FailureHLS;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class Context2Test {
+ @Inject
+ Context2 test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Context2.class,
+ DemoHLS.class,
+ FailureHLS.class,
+ DemoSOAPContextImple.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testContext2();
+ }
+}
+
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/Context2Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/ServiceTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/ServiceTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/ServiceTest.java 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,33 @@
+package com.arjuna.wsas.tests.arq.hls;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.arjuna.wsas.tests.DemoHLS;
+import com.arjuna.wsas.tests.WSASTestUtils;
+import com.arjuna.wsas.tests.arq.WarDeployment;
+
+ at RunWith(Arquillian.class)
+public class ServiceTest {
+ @Inject
+ Service test;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ return WarDeployment.getDeployment(
+ Service.class,
+ DemoHLS.class,
+ WSASTestUtils.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ test.testService();
+ }
+}
+
Property changes on: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/java/com/arjuna/wsas/tests/arq/hls/ServiceTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/resources/arquillian.xml
===================================================================
--- labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/resources/arquillian.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/localjunit/WSAS/src/test/resources/arquillian.xml 2011-11-11 06:35:04 UTC (rev 37719)
@@ -0,0 +1,13 @@
+<?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">
+ <!-- Example configuration for a remote JBoss AS 7 instance -->
+ <container qualifier="jboss-as" default="true">
+ <protocol type="jmx-as7">
+ <property name="executionType">REMOTE</property>
+ </protocol>
+ <configuration>
+ <property name="serverConfig">standalone-xts.xml</property>
+ </configuration>
+ </container>
+</arquillian>
More information about the jboss-svn-commits
mailing list