[jboss-svn-commits] JBL Code SVN: r27997 - in labs/jbosstm/trunk/qa/tests/src: org/jboss/jbossts/qa and 14 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 14 07:19:28 EDT 2009
Author: jhalliday
Date: 2009-07-14 07:19:28 -0400 (Tue, 14 Jul 2009)
New Revision: 27997
Added:
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceFramework.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceGraphFrame.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceLogger.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTest.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestRunnerThread.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYData.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataPoint.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataSeries.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYGraphingBean.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedOnePhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTwoPhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/OnePhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TopLevelTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TwoPhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/DummyPerfTestImplementation.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleResourceRegistration.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleSubtranAwareResourceRegistration.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nested/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nested/NestedTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedonephase/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedonephase/NestedOnePhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedtwophase/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedtwophase/NestedTwoPhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/onephase/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/onephase/OnePhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/twophase/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/twophase/TwoPhaseTrx.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/AtomikosTxWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BaseWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BitronixTxWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/JBossTSTxWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/TxWrapper.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/records/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/records/DummyResource.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoResource.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoSubTranResource.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DummyResource.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/DummyImplServer.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedOnePhaseServer.java
labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedTwoPhaseServer.java
Removed:
labs/jbosstm/trunk/qa/tests/src/com/hp/mwtests/performance/
Log:
Repackage performance tests and remove their dependency on DTF. JBTM-390
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceFramework.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceFramework.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceFramework.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance;
+
+import org.jboss.jbossts.qa.performance.PerformanceGraphFrame;
+
+import java.io.PrintWriter;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class PerformanceFramework
+{
+ private final static int TRANSACTIONS_PER_SECOND = 0,
+ TIME_TAKEN = 1,
+ NUMBER_OF_TRANSACTIONS = 2,
+ NUMBER_OF_THREADS = 3;
+
+ private final static String[] DATA_TYPES = { "TRANSACTIONS_PER_SECOND", "TIME_TAKEN",
+ "NUMBER_OF_TRANSACTIONS", "NUMBER_OF_THREADS" };
+
+ private final static int[] DATA_TYPE_EQUIV_ENUM_VALUE = { TRANSACTIONS_PER_SECOND, TIME_TAKEN,
+ NUMBER_OF_TRANSACTIONS, NUMBER_OF_THREADS };
+
+ private final static int DEFAULT_NUMBER_OF_THREADS = 5;
+ private final static int DEFAULT_NUMBER_OF_ITERATIONS = 100;
+
+ public final static String ORB_INSTANCE_NAME = "org.jboss.jbossts.qa.performance.ORB";
+
+ private final static String PERF_DATA_PREFIX = "-PERF-DATA";
+
+ private int _minNumberOfThreads = DEFAULT_NUMBER_OF_THREADS;
+ private int _maxNumberOfThreads = DEFAULT_NUMBER_OF_THREADS;
+ private int _numberOfIterations = DEFAULT_NUMBER_OF_ITERATIONS;
+ private String[] _args = null;
+ private int _xDataToLog = NUMBER_OF_THREADS;
+ private int _yDataToLog = TRANSACTIONS_PER_SECOND;
+ private boolean _displayGraph = false;
+ private String _csvFilename = null;
+
+ public PerformanceFramework(String[] args)
+ {
+ _args = args;
+ }
+
+ public static int parseDataType( String type )
+ {
+ for (int count=0;count<DATA_TYPES.length;count++)
+ {
+ if ( DATA_TYPES[count].equals( type ) )
+ {
+ return DATA_TYPE_EQUIV_ENUM_VALUE[count];
+ }
+ }
+
+ return -1;
+ }
+
+ public void setXData(int xDataToLog)
+ {
+ _xDataToLog = xDataToLog;
+ }
+
+ public void setYData(int yDataToLog)
+ {
+ _yDataToLog = yDataToLog;
+ }
+
+ public void setMinimumNumberOfThreads(int numberOfThreads)
+ {
+ _minNumberOfThreads = numberOfThreads;
+ }
+
+ public void setMaximumNumberOfThreads(int numberOfThreads)
+ {
+ _maxNumberOfThreads = numberOfThreads;
+ }
+
+ public void setDisplayGraph(boolean value)
+ {
+ _displayGraph = value;
+ }
+
+ public void setNumberOfIterations(int numberOfIterations)
+ {
+ _numberOfIterations = numberOfIterations;
+ }
+
+ public void setCSVFilename(String filename)
+ {
+ _csvFilename = filename;
+ }
+
+ public int getMinimumNumberOfThreads()
+ {
+ return _minNumberOfThreads;
+ }
+
+ public int getMaximumNumberOfThreads()
+ {
+ return _maxNumberOfThreads;
+ }
+
+ public int getNumberOfIterations()
+ {
+ return _numberOfIterations;
+ }
+
+ private void generateCSV(String csvFilename, PerformanceLogger perfLogger)
+ {
+ try
+ {
+ PrintWriter out = new PrintWriter( new FileOutputStream( csvFilename ) );
+
+ out.println("Performance data '"+perfLogger.getDataName()+"'\n");
+
+ ArrayList data = perfLogger.getData();
+
+ out.println( perfLogger.getXAxisLabel() +","+ perfLogger.getYAxisLabel() );
+
+ for (int count=0;count<data.size();count++)
+ {
+ XYData point = (XYData)data.get(count);
+
+ out.println( point.getX() +","+ point.getY() );
+ }
+
+ out.close();
+ }
+ catch (IOException e)
+ {
+ System.err.println("Failed to create CSV file '"+csvFilename+"'");
+ }
+ }
+
+ public boolean performTest( String classname, String[] configs )
+ {
+ boolean success = false;
+
+ try
+ {
+ PerformanceLogger perfLogger = new PerformanceLogger( classname + PERF_DATA_PREFIX );
+
+ perfLogger.setXAxisLabel("Number of Threads");
+ perfLogger.setYAxisLabel("Tx/sec");
+
+ System.out.println("Threads from "+getMinimumNumberOfThreads()+" to "+getMaximumNumberOfThreads());
+ for (int threadCount=getMinimumNumberOfThreads();threadCount<=getMaximumNumberOfThreads();threadCount++)
+ {
+ PerformanceTest perfTest = (PerformanceTest)Thread.currentThread().getContextClassLoader().loadClass( classname ).newInstance();
+ perfTest.setServiceConfigs( configs );
+ perfTest.setParameters( _args );
+
+ PerformanceTestRunnerThread[] pRunner = new PerformanceTestRunnerThread[threadCount];
+
+ long startTimeForThreadSet= System.currentTimeMillis();
+
+ for (int count=0;count<threadCount;count++)
+ {
+ pRunner[count] = new PerformanceTestRunnerThread( perfTest, getNumberOfIterations() );
+
+ pRunner[count].start();
+ }
+
+ for (int count=0;count<threadCount;count++)
+ {
+ pRunner[count].join();
+ success &= pRunner[count].success();
+ }
+
+ long endTimeForThreadSet= System.currentTimeMillis();
+ long timeTaken = endTimeForThreadSet - startTimeForThreadSet;
+
+ long numberOfTransactions = getNumberOfIterations()*threadCount;
+ System.out.println( threadCount +" \t\t "+timeTaken+" \t\t"+(float) (numberOfTransactions/(timeTaken / 1000.0))+"\t\t"+numberOfTransactions);
+
+ double dataX, dataY;
+
+ switch ( _xDataToLog )
+ {
+ case NUMBER_OF_TRANSACTIONS :
+ {
+ dataX = numberOfTransactions;
+ break;
+ }
+ case NUMBER_OF_THREADS :
+ default:
+ {
+ dataX = threadCount;
+ break;
+ }
+ }
+
+ switch ( _yDataToLog )
+ {
+ case TIME_TAKEN :
+ {
+ dataY = timeTaken;
+ break;
+ }
+ case TRANSACTIONS_PER_SECOND :
+ default:
+ {
+ dataY = (numberOfTransactions/(timeTaken / 1000.0));
+ break;
+ }
+ }
+
+ perfLogger.addData( dataX, dataY );
+ }
+
+ perfLogger.output(System.err);
+
+ if ( _csvFilename != null )
+ {
+ generateCSV(_csvFilename, perfLogger);
+ }
+ if ( _displayGraph )
+ {
+ new PerformanceGraphFrame(perfLogger);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ success = false;
+ }
+
+ return success;
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceGraphFrame.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceGraphFrame.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceGraphFrame.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+
+public class PerformanceGraphFrame extends JFrame
+{
+ private XYGraphingBean _graphingBean;
+
+ public PerformanceGraphFrame(PerformanceLogger p)
+ {
+ setTitle("Performance Graph ("+p.getDataName()+")");
+
+ _graphingBean = new XYGraphingBean();
+ _graphingBean.addDataSeries(createDataSeries(p));
+ _graphingBean.setXAxisLabel(p.getXAxisLabel());
+ _graphingBean.setYAxisLabel(p.getYAxisLabel());
+
+ this.setSize(400,300);
+ this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ this.addWindowListener(new WindowAdapter() {
+ public void windowClosed(WindowEvent e)
+ {
+ super.windowClosing(e);
+
+ System.exit(0);
+ }
+ });
+ show();
+ }
+
+
+ private XYDataSeries createDataSeries(PerformanceLogger logger)
+ {
+ ArrayList data = logger.getData();
+ XYDataSeries series = new XYDataSeries(Color.blue);
+
+ for (int count=0;count<data.size();count++)
+ {
+ XYData point = (XYData)data.get(count);
+ series.addPoint( new XYDataPoint( point.getX(), point.getY() ) );
+ }
+
+ return series;
+ }
+
+
+ /**
+ * Paints the container. This forwards the paint to any lightweight
+ * components that are children of this container. If this method is
+ * reimplemented, super.paint(g) should be called so that lightweight
+ * components are properly rendered. If a child component is entirely
+ * clipped by the current clipping setting in g, paint() will not be
+ * forwarded to that child.
+ *
+ * @param g the specified Graphics window
+ * @see java.awt.Component#update(java.awt.Graphics)
+ */
+ public void paint(Graphics g)
+ {
+ BufferedImage img = _graphingBean.createGraphImage(this.getWidth(), this.getHeight());
+
+ g.drawImage(img,0,0,this);
+ }
+
+ /**
+ * Just calls <code>paint(g)</code>. This method was overridden to
+ * prevent an unnecessary call to clear the background.
+ *
+ * @param g the Graphics context in which to paint
+ */
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceLogger.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceLogger.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceLogger.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001, 2002,
+ *
+ * Hewlett-Packard Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: PerformanceLogger.java 170 2008-03-25 18:59:26Z jhalliday $
+ */
+package org.jboss.jbossts.qa.performance;
+
+import java.util.ArrayList;
+import java.io.OutputStream;
+import java.io.BufferedWriter;
+import java.io.OutputStreamWriter;
+
+public class PerformanceLogger
+{
+ private final static String PERF_DATA = "<PERF_DATA";
+
+ private ArrayList _points = new ArrayList();
+ private String _xAxisLabel = "X-Axis";
+ private String _yAxisLabel = "Y-Axis";
+ private String _name = null;
+
+ /**
+ * Create a performance logger that logs data of type 'dataName'.
+ *
+ * @param dataName A unique name which will be used to identify the type of data.
+ */
+ public PerformanceLogger(String dataName)
+ {
+ _name = dataName;
+ }
+
+ public String getDataName()
+ {
+ return _name;
+ }
+
+ /**
+ * Set the label for the X axis.
+ *
+ * @param label The label for the X-axis.
+ */
+ public void setXAxisLabel(String label)
+ {
+ _xAxisLabel = label;
+ }
+
+ /**
+ * Set the label for the Y axis.
+ *
+ * @param label The label for the Y-axis.
+ */
+ public void setYAxisLabel(String label)
+ {
+ _yAxisLabel = label;
+ }
+
+ /**
+ * Retrieve a copy of the performance data.
+ *
+ * @return An array list containing XYData objects.
+ */
+ public ArrayList getData()
+ {
+ return (ArrayList)_points.clone();
+ }
+
+ /**
+ * Add the data x,y to the performance data.
+ *
+ * @param x The X data.
+ * @param y The Y data.
+ */
+ public void addData(double x, double y)
+ {
+ _points.add(new XYData(x,y));
+ }
+
+ public String getXAxisLabel()
+ {
+ return _xAxisLabel;
+ }
+
+ public String getYAxisLabel()
+ {
+ return _yAxisLabel;
+ }
+
+ /**
+ * Output the logger performance data to the given output stream.
+ *
+ * @param out The stream to log the data to.
+ */
+ public void output(OutputStream out) throws Exception
+ {
+ BufferedWriter outStr = new BufferedWriter(new OutputStreamWriter(out));
+
+ outStr.write(PERF_DATA+"{"+_xAxisLabel+"}{"+_yAxisLabel+"}["+_name+"]");
+
+ for (int count=0;count<_points.size();count++)
+ {
+ XYData data = (XYData)_points.get(count);
+ outStr.write(":"+data.getX()+","+data.getY());
+ }
+
+ outStr.write(">");
+ outStr.close();
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTest.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTest.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTest.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance;
+
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+
+public abstract class PerformanceTest
+{
+ private String[] _configs = null;
+ private String[] _params = null;
+ private static String PRODUCT_CLASS_PARAM = "productClass=";
+ private String wrapperClass = "org.jboss.jbossts.qa.performance.products.JBossTSTxWrapper";
+ private TxWrapper wrapper;
+
+ protected abstract void work() throws Exception;
+
+ protected boolean requiresNestedTxSupport()
+ {
+ return false;
+ }
+
+ public void setServiceConfigs( String[] configs )
+ {
+ _configs = configs;
+ }
+
+ void setParameters(String[] params)
+ {
+ _params = params;
+
+ for (String param : _params)
+ {
+ if (param.startsWith(PRODUCT_CLASS_PARAM))
+ {
+ wrapperClass = param.substring(PRODUCT_CLASS_PARAM.length());
+ break;
+ }
+ }
+ }
+
+ public boolean isParameterDefined(String param)
+ {
+ for (int count=0;count<_params.length;count++)
+ {
+ if ( param.equals( _params[count] ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public String[] getParameters()
+ {
+ return _params;
+ }
+
+ public String getServiceConfig( int index )
+ {
+ return _configs[index];
+ }
+
+ public TxWrapper getTxWrapper()
+ {
+ return wrapper.createWrapper();
+ }
+
+ private void initTest() throws Exception
+ {
+ try
+ {
+ wrapper = (TxWrapper) Class.forName(wrapperClass).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Unable to instantiate transaction class: " + e);
+ }
+
+ if (requiresNestedTxSupport() && !wrapper.supportsNestedTx())
+ throw new IllegalArgumentException("Product " + wrapper.getName() + " does not support nested transactions");
+ }
+
+ public void performWork( int numberOfIterations ) throws Exception
+ {
+ initTest();
+
+ for (int count=0;count<numberOfIterations;count++)
+ {
+ work();
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestRunnerThread.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestRunnerThread.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestRunnerThread.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance;
+
+public class PerformanceTestRunnerThread extends Thread
+{
+ private int _numberOfIterations = 0;
+ private PerformanceTest _test = null;
+ private boolean _failed = false;
+
+ public PerformanceTestRunnerThread(PerformanceTest test, int numberOfIterations)
+ {
+ _numberOfIterations = numberOfIterations;
+ _test = test;
+ }
+
+ public boolean success()
+ {
+ return !_failed;
+ }
+
+ public void run()
+ {
+ try
+ {
+ _test.performWork(_numberOfIterations);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ _failed = true;
+ }
+ }
+
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/PerformanceTestWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,229 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance;
+
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+
+import java.util.ArrayList;
+
+import org.jboss.jbossts.qa.Utils.ServerIORStore;
+
+public class PerformanceTestWrapper
+{
+ private final static String ADD_SERVICE_NAME = "-service";
+ private final static String DISPLAY_GRAPH_PARAMETER = "-displaygraph";
+ private final static String DISABLE_ORB_PARAMETER = "-disableorb";
+ private final static String CSV_FILENAME_PARAMETER = "-csv";
+ private final static String CLASSNAME_PARAMETER = "-classname";
+ private final static String NUMBER_OF_THREADS_PARAMETER = "-threads";
+ private final static String NUMBER_OF_THREADS_MIN_PARAMETER = "-minthreads";
+ private final static String NUMBER_OF_THREADS_MAX_PARAMETER = "-maxthreads";
+ private final static String NUMBER_OF_ITERATIONS_PARAMETER = "-iterations";
+ private final static String XDATA_PARAMETER = "-xdata";
+ private final static String YDATA_PARAMETER = "-ydata";
+
+ private final static int DEFAULT_NUMBER_OF_THREADS = 5;
+ private final static int DEFAULT_NUMBER_OF_ITERATIONS = 100;
+
+ /**
+ * The main test method which must assert either a pass or a fail.
+ */
+ public static void main(String[] args)
+ {
+ String classname = null;
+ int minNumberOfThreads = DEFAULT_NUMBER_OF_THREADS;
+ int maxNumberOfThreads = DEFAULT_NUMBER_OF_THREADS;
+ int numberOfIterations = DEFAULT_NUMBER_OF_ITERATIONS;
+ boolean displayGraph = false;
+ int xData = -1;
+ int yData = -1;
+ String csvFilename = null;
+ ArrayList configList = new ArrayList();
+ boolean disableOrb = false;
+
+ try
+ {
+ if ( args.length > 0 )
+ {
+ for (int count=0;count<args.length;count++)
+ {
+ if ( args[count].equals( CLASSNAME_PARAMETER ) )
+ {
+ classname = args[count + 1];
+ }
+
+ if ( args[count].equals( CSV_FILENAME_PARAMETER ) )
+ {
+ csvFilename = args[count + 1];
+ }
+
+ if ( args[count].equals( DISPLAY_GRAPH_PARAMETER ) )
+ {
+ displayGraph = true;
+ }
+
+ if ( args[count].equals( NUMBER_OF_THREADS_PARAMETER ) )
+ {
+ maxNumberOfThreads = minNumberOfThreads = Integer.parseInt( args[count + 1] );
+ }
+
+ if ( args[count].equals( NUMBER_OF_THREADS_MIN_PARAMETER ) )
+ {
+ minNumberOfThreads = Integer.parseInt( args[count + 1] );
+ }
+
+ if ( args[count].equals( NUMBER_OF_THREADS_MAX_PARAMETER ) )
+ {
+ maxNumberOfThreads = Integer.parseInt( args[count + 1] );
+ }
+
+ if ( args[count].equals( NUMBER_OF_ITERATIONS_PARAMETER ) )
+ {
+ numberOfIterations = Integer.parseInt( args[count + 1] );
+ }
+
+ if ( args[count].equals( DISABLE_ORB_PARAMETER ) )
+ {
+ disableOrb = true;
+ }
+
+ if ( args[count].equals( XDATA_PARAMETER ) )
+ {
+ xData = PerformanceFramework.parseDataType( args[count + 1] );
+
+ if ( xData == -1 )
+ {
+ System.err.println("Error - specified x-data parameter is invalid");
+ assertFailure();
+ }
+ else
+ {
+ System.out.println("X-Data set to '"+args[count + 1]+"'");
+ }
+ }
+
+ if ( args[count].equals( YDATA_PARAMETER ) )
+ {
+ yData = PerformanceFramework.parseDataType( args[count + 1] );
+
+ if ( yData == -1 )
+ {
+ System.err.println("Error - specified y-data parameter is invalid");
+ assertFailure();
+ }
+ else
+ {
+ System.out.println("Y-Data set to '"+args[count + 1]+"'");
+ }
+ }
+
+ if ( args[count].equals( ADD_SERVICE_NAME ) )
+ {
+ System.out.println("Added Service config: '"+ args[count + 1] +"'");
+
+
+ configList.add( ServerIORStore.loadIOR( args[count + 1]) );
+ }
+ }
+
+ if ( classname != null )
+ {
+ System.out.println(" Classname: "+classname);
+ System.out.println("Min Number of Threads: "+minNumberOfThreads);
+ System.out.println("Max Number of Threads: "+maxNumberOfThreads);
+ System.out.println(" Number of Iterations: "+numberOfIterations);
+
+ if ( !disableOrb )
+ {
+ try
+ {
+ /**
+ * Retrieve ORB and OA references, intialise them
+ * and then set the OTSManager ORB and OA properties
+ */
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA( orb );
+
+ orb.initORB(args, null);
+ oa.initOA(args);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ assertFailure();
+ }
+ }
+
+ PerformanceFramework pf = new PerformanceFramework( args );
+
+ pf.setDisplayGraph(displayGraph);
+ pf.setCSVFilename(csvFilename);
+
+ if ( xData != -1 )
+ {
+ pf.setXData( xData );
+ }
+
+ if ( yData != -1 )
+ {
+ pf.setYData( yData );
+ }
+
+ pf.setNumberOfIterations(numberOfIterations);
+ pf.setMinimumNumberOfThreads(minNumberOfThreads);
+ pf.setMaximumNumberOfThreads(maxNumberOfThreads);
+
+ String[] configs = new String[ configList.size() ];
+ configList.toArray(configs);
+
+ if ( !pf.performTest( classname, configs ) )
+ {
+ //assertSuccess();
+ }
+ else
+ {
+ assertFailure();
+ }
+ }
+ else
+ {
+ System.out.println("Parameter '"+CLASSNAME_PARAMETER+"' not specified");
+ assertFailure();
+ }
+ }
+ else
+ {
+ System.out.println("No parameters passed");
+ assertFailure();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ assertFailure();
+ }
+ }
+
+ private static void assertFailure() {
+ System.out.println("Failed");
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYData.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYData.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYData.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001, 2002,
+ *
+ * Hewlett-Packard Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: XYData.java 170 2008-03-25 18:59:26Z jhalliday $
+ */
+package org.jboss.jbossts.qa.performance;
+
+public final class XYData
+{
+ private double _x, _y;
+
+ public XYData(double x, double y)
+ {
+ _x = x;
+ _y = y;
+ }
+
+ public double getX()
+ {
+ return (_x);
+ }
+
+ public double getY()
+ {
+ return (_y);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataPoint.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataPoint.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataPoint.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001, 2002,
+ *
+ * Hewlett-Packard Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: XYDataPoint.java 170 2008-03-25 18:59:26Z jhalliday $
+ */
+package org.jboss.jbossts.qa.performance;
+
+public final class XYDataPoint
+{
+ protected double _x, _y;
+
+ public XYDataPoint(double x, double y)
+ {
+ _x = x;
+ _y = y;
+ }
+
+ public double getX()
+ {
+ return _x;
+ }
+
+ public double getY()
+ {
+ return _y;
+ }
+
+ public void setLocation(double x, double y)
+ {
+ _x = x;
+ _y = y;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataSeries.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataSeries.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYDataSeries.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001, 2002,
+ *
+ * Hewlett-Packard Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: XYDataSeries.java 170 2008-03-25 18:59:26Z jhalliday $
+ */
+
+package org.jboss.jbossts.qa.performance;
+
+import java.util.ArrayList;
+import java.awt.*;
+
+public class XYDataSeries
+{
+ protected ArrayList _points = new ArrayList();
+ protected Color _color = null;
+ protected boolean _beginAtOrigin = false;
+ protected double _minX = Double.MAX_VALUE;
+ protected double _minY = Double.MAX_VALUE;
+ protected double _maxX = Double.MIN_VALUE;
+ protected double _maxY = Double.MIN_VALUE;
+
+ public XYDataSeries(Color color)
+ {
+ _color = color;
+ }
+
+ public void setData(ArrayList data)
+ {
+ _points = data;
+ }
+
+ public void setBeginAtOrigin(boolean beginAtOrigin)
+ {
+ _beginAtOrigin = beginAtOrigin;
+ }
+
+ public Color getSeriesColour()
+ {
+ return _color;
+ }
+
+ public boolean getBeginAtOrigin()
+ {
+ return _beginAtOrigin;
+ }
+
+ public void removeFirstPoint()
+ {
+ if (!_points.isEmpty())
+ {
+ _points.remove(0);
+ reevaluate();
+ }
+ }
+
+ private void reevaluate()
+ {
+ _minX = Double.MAX_VALUE;
+ _minY = Double.MAX_VALUE;
+ _maxX = Double.MIN_VALUE;
+ _maxY = Double.MIN_VALUE;
+
+ for (int count=0;count<_points.size();count++)
+ {
+ XYDataPoint p = (XYDataPoint)_points.get(count);
+
+ _minX = (p.getX() < _minX) ? p.getX() : _minX;
+ _maxX = (p.getX() > _maxX) ? p.getX() : _maxX;
+ _minY = (p.getY() < _minY) ? p.getY() : _minY;
+ _maxY = (p.getY() > _maxY) ? p.getY() : _maxY;
+ }
+ }
+
+ public void addPoint(XYDataPoint p)
+ {
+ _points.add(p);
+
+ _minX = (p.getX() < _minX) ? p.getX() : _minX;
+ _maxX = (p.getX() > _maxX) ? p.getX() : _maxX;
+ _minY = (p.getY() < _minY) ? p.getY() : _minY;
+ _maxY = (p.getY() > _maxY) ? p.getY() : _maxY;
+ }
+
+ public double getMinX()
+ {
+ return(_minX);
+ }
+
+ public double getMaxX()
+ {
+ return(_maxX);
+ }
+
+ public double getMinY()
+ {
+ return(_minY);
+ }
+
+ public double getMaxY()
+ {
+ return(_maxY);
+ }
+
+
+ public XYDataPoint[] getDataSeries()
+ {
+ Object[] points = _points.toArray();
+ XYDataPoint[] returnData = new XYDataPoint[points.length];
+
+ System.arraycopy(points,0,returnData,0,points.length);
+
+ return(returnData);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYGraphingBean.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYGraphingBean.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/XYGraphingBean.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,240 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001, 2002,
+ *
+ * Hewlett-Packard Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: XYGraphingBean.java 170 2008-03-25 18:59:26Z jhalliday $
+ */
+
+package org.jboss.jbossts.qa.performance;
+
+import java.awt.*;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.util.Vector;
+import java.text.DecimalFormat;
+
+public class XYGraphingBean implements ImageObserver
+{
+ protected Vector _dataSeries = null;
+ protected BufferedImage _image = null;
+ protected BufferedImage _yAxisLabel = null;
+ protected String _yAxisLabelText = "Y-Axis";
+ protected String _xAxisLabelText = "X-Axis";
+ protected int _numIncX = 10;
+ protected double _minX = Double.MAX_VALUE;
+ protected double _maxX = Double.MIN_VALUE;
+ protected double _minY = Double.MAX_VALUE;
+ protected double _maxY = Double.MIN_VALUE;
+ protected int _numIncY = 10;
+
+ public XYGraphingBean()
+ {
+ _dataSeries = new Vector();
+ }
+
+ public synchronized void addDataSeries(XYDataSeries data)
+ {
+ _dataSeries.addElement(data);
+ updateGraph();
+ }
+
+ public synchronized void updateGraph()
+ {
+ _minX = Double.MAX_VALUE;
+ _maxX = Double.MIN_VALUE;
+ _minY = Double.MAX_VALUE;
+ _maxY = Double.MIN_VALUE;
+
+ for (int count=0;count<_dataSeries.size();count++)
+ {
+ XYDataSeries d = (XYDataSeries)_dataSeries.elementAt(count);
+
+ _minX = (d.getMinX() < _minX) ? d.getMinX() : _minX;
+ _minY = (d.getMinY() < _minY) ? d.getMinY() : _minY;
+ _maxX = (d.getMaxX() > _maxX) ? d.getMaxX() : _maxX;
+ _maxY = (d.getMaxY() > _maxY) ? d.getMaxY() : _maxY;
+ }
+ }
+
+ protected BufferedImage createYAxisLabel(Graphics g, String text)
+ {
+ Rectangle2D labelRect = g.getFontMetrics().getStringBounds(text,g);
+
+ BufferedImage b = new BufferedImage( (int)labelRect.getHeight(), (int)labelRect.getWidth() + 2, BufferedImage.TYPE_INT_ARGB );
+ Graphics2D labelGraphics = (Graphics2D)b.getGraphics();
+ labelGraphics.setColor(Color.black);
+ labelGraphics.rotate( Math.toRadians(90.0) );
+ labelGraphics.drawString( text, 0, 0 );
+
+ return b;
+ }
+
+ public String getYAxisLabel()
+ {
+ return(_yAxisLabelText);
+ }
+
+ public String getXAxisLabel()
+ {
+ return(_xAxisLabelText);
+ }
+
+ public void setYAxisLabel(String text)
+ {
+ _yAxisLabelText = text;
+ }
+
+ public void setXAxisLabel(String text)
+ {
+ _xAxisLabelText = text;
+ }
+
+ /**
+ * Draw the graph
+ */
+ public synchronized BufferedImage createGraphImage(int width, int height)
+ {
+ updateGraph();
+
+ BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_USHORT_555_RGB );
+ Graphics2D g = image.createGraphics();
+ g.setColor(Color.white);
+ g.fillRect(0, 0, width, height);
+ g.setColor(Color.black);
+
+ double maxLabelWidth = Double.MIN_VALUE;
+ double maxLabelHeight = Double.MIN_VALUE;
+ DecimalFormat numFormat = new DecimalFormat( "#######.###" );
+
+ for (int count=0;count<=_numIncY;count++)
+ {
+ String label = numFormat.format(_minY + ((_maxY - _minY)/_numIncY)*(_numIncY - count));
+ Rectangle2D labelRect = g.getFontMetrics().getStringBounds(label,g);
+ maxLabelWidth = (labelRect.getWidth() > maxLabelWidth) ? labelRect.getWidth() : maxLabelWidth;
+ }
+
+ _yAxisLabel = createYAxisLabel( g, getYAxisLabel() );
+ Rectangle graphRect = new Rectangle( (int)maxLabelWidth + _yAxisLabel.getWidth() + 5, 50, width - 150, height - 150 );
+
+ /**
+ * Draw the axis
+ *
+ *5| Pixels / Value
+ *0| 1 / 5
+ *5| 1 1 / (1/5)
+ *0|
+ *5| 2
+ * +--------
+ */
+ g.setColor( Color.gray );
+ g.drawLine( (int)graphRect.getX(), (int)graphRect.getY(), (int)graphRect.getX(), (int)( graphRect.getY() + graphRect.getHeight() ) );
+ g.drawLine( (int)graphRect.getX(), (int)( graphRect.getY() + graphRect.getHeight() ), (int)(graphRect.getX() + graphRect.getWidth()), (int)(graphRect.getY() + graphRect.getHeight()) );
+
+ double scaleY = graphRect.getHeight() / (_maxY - _minY); // Pixels per value
+ double scaleX = graphRect.getWidth() / (_maxX - _minX);
+ double incY = (graphRect.getHeight() / _numIncY);
+
+ for (int count=0;count<=_numIncY;count++)
+ {
+ String label = numFormat.format(_minY + ((_maxY - _minY)/_numIncY)*(_numIncY - count));
+ Rectangle2D labelRect = g.getFontMetrics().getStringBounds(label,g);
+
+ g.setColor(Color.black);
+ g.drawString( label, (int)graphRect.getX() - (int)labelRect.getWidth() - 2, (int)(count * incY) + (int)graphRect.getY() + 5 );
+ g.drawLine((int)graphRect.getX(), (int)(count * incY) + (int)graphRect.getY(), (int)graphRect.getX() - 2, (int)(count * incY) + (int)graphRect.getY());
+
+ g.setColor(Color.lightGray);
+ g.drawLine((int)graphRect.getX() + 1, (int)(count * incY) + (int)graphRect.getY(), (int)graphRect.getMaxX(), (int)(count * incY) + (int)graphRect.getY());
+ }
+
+ double incX = (graphRect.getWidth() / _numIncX);
+ for (int count=0;count<=_numIncX;count++)
+ {
+ g.setColor(Color.black);
+
+ BufferedImage img = createYAxisLabel(g, numFormat.format((_minX +((_maxX - _minX)/_numIncX)*(count))));
+ maxLabelHeight = (img.getHeight() > maxLabelHeight) ? img.getHeight() : maxLabelHeight;
+ g.drawImage( img, (int)(count * incX) + (int)graphRect.getX() - 8, (int)(graphRect.getY() + graphRect.getHeight() + 15),this);
+ g.drawLine( (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight()),
+ (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight()) + 2 );
+
+ g.setColor(Color.lightGray);
+ g.drawLine( (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY() + graphRect.getHeight() - 1),
+ (int)(count * incX) + (int)graphRect.getX(), (int)(graphRect.getY()) );
+ }
+
+ g.setColor(Color.black);
+ Rectangle2D xAxisLabelRect = g.getFontMetrics().getStringBounds(getXAxisLabel(),g);
+ g.drawString(getXAxisLabel(), (int)graphRect.getCenterX() - (int)(xAxisLabelRect.getWidth() / 2), height - 5);
+ g.drawImage(_yAxisLabel, (int)(graphRect.getX() - maxLabelWidth - 10), (int)graphRect.getCenterY() - (int)_yAxisLabel.getHeight(), this);
+
+ for (int count=0;count<_dataSeries.size();count++)
+ {
+ XYDataSeries dataSeries = ((XYDataSeries)_dataSeries.elementAt(count));
+ XYDataPoint[] points = dataSeries.getDataSeries();
+ XYDataPoint previous = null;
+
+ if (dataSeries.getBeginAtOrigin())
+ {
+ previous = new XYDataPoint(_minX,_minY);
+ }
+ else
+ {
+ if (points.length!=0)
+ {
+ previous = points[0];
+ }
+ else
+ {
+ previous = new XYDataPoint(_minX, _minY);
+ }
+ }
+
+ g.setColor(dataSeries.getSeriesColour());
+
+ for (int pCount=0;pCount<points.length;pCount++)
+ {
+ int xPosition = (int)graphRect.getX() + (int)( ( points[pCount].getX() - _minX ) * scaleX );
+ int xPreviousPosition = (int)graphRect.getX() + (int)( ( previous.getX() - _minX ) * scaleX );
+ int yPosition = ( (int)graphRect.getY() + (int)graphRect.getHeight() ) - (int)( (points[pCount].getY() - _minY) * scaleY );
+ int yPreviousPosition = ( (int)graphRect.getY() + (int)graphRect.getHeight() ) - (int)( (previous.getY() - _minY) * scaleY );
+ g.drawLine( xPreviousPosition, yPreviousPosition, xPosition, yPosition );
+
+ previous = points[pCount];
+ }
+ }
+
+ return(image);
+ }
+
+ public boolean imageUpdate(Image img, int infoflags,
+ int x, int y, int width, int height)
+ {
+ return false;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedOnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedOnePhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedOnePhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+import org.jboss.jbossts.qa.performance.records.DummyResource;
+
+public class NestedOnePhaseTrx extends PerformanceTest
+{
+ protected boolean requiresNestedTxSupport()
+ {
+ return true;
+ }
+
+ protected void work() throws Exception
+ {
+ try
+ {
+ TxWrapper tx1 = getTxWrapper();
+ TxWrapper tx2 = getTxWrapper();
+
+ tx1.begin(); // Top level
+ tx2.begin(); // Nested level
+
+ // enlist single participant
+ tx2.add(DummyResource.create());
+
+ if (isParameterDefined("-commit"))
+ {
+ tx2.commit(); // Nested level commit
+ tx1.commit(); // Top level commit
+ }
+ else
+ {
+ tx2.abort(); // Nested level rollback
+ tx1.abort(); // Top level rollback
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+
+public class NestedTrx extends PerformanceTest
+{
+ protected boolean requiresNestedTxSupport()
+ {
+ return true;
+ }
+
+ protected void work() throws Exception
+ {
+ try
+ {
+ TxWrapper tx1 = getTxWrapper();
+ TxWrapper tx2 = getTxWrapper();
+
+ tx1.begin(); // Top level begin
+ tx2.begin(); // Nested level begin
+
+ if (isParameterDefined("-commit"))
+ {
+ tx2.commit(); // Nested level commit
+ tx1.commit(); // Top level commit
+ }
+ else
+ {
+ tx2.abort(); // Nested level rollback
+ tx1.abort(); // Top level rollback
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTwoPhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/NestedTwoPhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+import org.jboss.jbossts.qa.performance.records.DummyResource;
+
+public class NestedTwoPhaseTrx extends PerformanceTest
+{
+ protected boolean requiresNestedTxSupport()
+ {
+ return true;
+ }
+
+ protected void work() throws Exception
+ {
+ try
+ {
+ TxWrapper tx1 = getTxWrapper();
+ TxWrapper tx2 = getTxWrapper();
+
+ tx1.begin(); // Top level
+ tx2.begin(); // Nested level
+
+ //enlist two participants for TRX
+ tx1.add(DummyResource.create());
+ tx2.add(DummyResource.create());
+
+ if (isParameterDefined("-commit"))
+ {
+ tx2.commit(); // Nested level commit
+ tx1.commit(); // Top level commit
+ }
+ else
+ {
+ tx2.abort(); // Nested level rollback
+ tx1.abort(); // Top level rollback
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/OnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/OnePhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/OnePhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+import org.jboss.jbossts.qa.performance.records.DummyResource;
+
+public class OnePhaseTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ TxWrapper tx = getTxWrapper();
+ tx.begin(); // Top level begin
+
+ //enlist the single participant (resource) one-phase commit
+ DummyResource ds = new DummyResource();
+ tx.add(ds);
+
+ if (isParameterDefined("-commit"))
+ tx.commit(); // Top level commit
+ else
+ tx.abort(); // Top level rollback
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TopLevelTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TopLevelTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TopLevelTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+
+public class TopLevelTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ TxWrapper tx = getTxWrapper();
+
+ tx.begin(); // Top level begin
+
+ if (isParameterDefined("-commit"))
+ tx.commit(); // Top level commit
+ else
+ tx.abort(); // Top level rollback
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Error!!");
+ e.printStackTrace();
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TwoPhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/local/TwoPhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.local;
+
+// Top-level transactions with two enlisted participants.
+// (two phase commit/rollback)
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.products.TxWrapper;
+import org.jboss.jbossts.qa.performance.records.DummyResource;
+
+
+public class TwoPhaseTrx extends PerformanceTest
+{
+ public void work()
+ {
+ try
+ {
+ TxWrapper tx = getTxWrapper();
+ tx.begin(); // Top level begin
+
+ // enlist two participants (resource) two-phase commit
+
+ tx.add(DummyResource.create());
+ tx.add(DummyResource.create());
+
+ if (isParameterDefined("-commit"))
+ tx.commit(); // Top level commit
+ else
+ tx.abort(); // Top level rollback
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/DummyPerfTestImplementation.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/DummyPerfTestImplementation.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/DummyPerfTestImplementation.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
+ *
+ * HP Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DummyPerfTestImplementation.java,v 1.1.1.1 2002/08/13 12:27:15 rbegg Exp $
+ */
+
+package org.jboss.jbossts.qa.performance.implementations.perftestwork;
+
+import org.jboss.jbossts.qa.performance.PerfTestInterfacePOA;
+import org.jboss.jbossts.qa.performance.PerfTestException;
+
+public class DummyPerfTestImplementation extends PerfTestInterfacePOA
+{
+ public void work() throws PerfTestException
+ {
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleResourceRegistration.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleResourceRegistration.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleResourceRegistration.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.perftestwork;
+
+/*
+ * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
+ *
+ * HP Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: SingleResourceRegistration.java,v 1.2 2003/06/20 15:36:14 nmcl Exp $
+ */
+
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.Coordinator;
+import org.omg.CosTransactions.Resource;
+import org.omg.CosTransactions.ResourceHelper;
+
+import org.jboss.jbossts.qa.performance.*;
+import org.jboss.jbossts.qa.performance.resources.DemoResource;
+
+import com.arjuna.ats.jts.*;
+import com.arjuna.orbportability.OA;
+import com.arjuna.orbportability.ORB;
+
+public class SingleResourceRegistration extends PerfTestInterfacePOA
+{
+ public void work() throws PerfTestException
+ {
+ try
+ {
+ /**
+ * Retrieve ORB and OA references
+ */
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA( orb );
+
+ Control control = OTSManager.get_current().get_control();
+ Coordinator coordinator = control.get_coordinator();
+
+ DemoResource resource = new DemoResource();
+
+ oa.objectIsReady(resource);
+ Resource res = ResourceHelper.narrow(oa.corbaReference(resource));
+
+ coordinator.register_resource(res);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ throw new PerfTestException();
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleSubtranAwareResourceRegistration.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleSubtranAwareResourceRegistration.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/perftestwork/SingleSubtranAwareResourceRegistration.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.perftestwork;
+
+import org.jboss.jbossts.qa.performance.PerfTestInterfacePOA;
+import org.jboss.jbossts.qa.performance.PerfTestException;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.resources.DemoSubTranResource;
+import com.arjuna.ats.jts.OTSManager;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import org.omg.CosTransactions.SubtransactionAwareResourceHelper;
+import org.omg.CosTransactions.SubtransactionAwareResource;
+import org.omg.CosTransactions.Control;
+import org.omg.CosTransactions.Coordinator;
+
+public class SingleSubtranAwareResourceRegistration extends PerfTestInterfacePOA
+{
+ public void work() throws PerfTestException
+ {
+ try
+ {
+ /**
+ * Retrieve ORB and OA references
+ */
+ ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
+ OA oa = OA.getRootOA(orb);
+
+ Control control = OTSManager.get_current().get_control();
+ Coordinator coordinator = control.get_coordinator();
+
+ DemoSubTranResource resource = new DemoSubTranResource();
+
+ oa.objectIsReady(resource);
+ SubtransactionAwareResource res = SubtransactionAwareResourceHelper.narrow(oa.corbaReference(resource));
+ coordinator.register_resource(res);
+ }
+ catch (Exception e)
+ {
+ throw new PerfTestException();
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nested/NestedTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nested/NestedTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nested/NestedTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.remote.nested;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+
+public class NestedTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA(orb);
+
+ String ref1 = getServiceConfig(0);
+ String ref2 = getServiceConfig(1);
+
+ org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
+ PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
+
+ OTSManager.get_current().begin();
+ d1.work();
+
+ org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
+ PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
+
+ OTSManager.get_current().begin();
+ d2.work();
+
+ // nested commit
+ OTSManager.get_current().commit(true);
+
+ if (isParameterDefined("-commit"))
+ {
+ // top level commit
+ OTSManager.get_current().commit(true);
+ }
+ else
+ {
+ // top level rollback
+ OTSManager.get_current().rollback();
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected exception: "+e);
+
+ e.printStackTrace();
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedonephase/NestedOnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedonephase/NestedOnePhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedonephase/NestedOnePhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.remote.nestedonephase;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import com.arjuna.ats.jts.OTSManager;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+
+public class NestedOnePhaseTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA(orb);
+
+ String ref1 = getServiceConfig(0);
+ String ref2 = getServiceConfig(1);
+
+ org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
+ PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
+
+ OTSManager.get_current().begin();
+ d1.work();
+
+ org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
+ PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
+
+ OTSManager.get_current().begin();
+ d2.work();
+
+ // nested commit
+ OTSManager.get_current().commit(true);
+
+ if ( true )
+ {
+ // top level commit
+ OTSManager.get_current().commit(true);
+ }
+ else
+ {
+ // top level rollback
+ OTSManager.get_current().rollback();
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedtwophase/NestedTwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedtwophase/NestedTwoPhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/nestedtwophase/NestedTwoPhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.remote.nestedtwophase;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+
+public class NestedTwoPhaseTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA(orb);
+
+ String ref1 = getServiceConfig(0);
+ String ref2 = getServiceConfig(1);
+
+ org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
+ PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
+
+ OTSManager.get_current().begin();
+ d1.work();
+
+ org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
+ PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
+
+ OTSManager.get_current().begin();
+ d2.work();
+
+
+ if (isParameterDefined("-commit"))
+ {
+ // nested commit
+ OTSManager.get_current().commit(true);
+ // top level commit
+ OTSManager.get_current().commit(true);
+ }
+ else
+ {
+ // nested rollback
+ OTSManager.get_current().rollback();
+ // top level rollback
+ OTSManager.get_current().rollback();
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/onephase/OnePhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/onephase/OnePhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/onephase/OnePhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.remote.onephase;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+
+public class OnePhaseTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA(orb);
+
+ String ref1 = getServiceConfig(0);
+
+ org.omg.CORBA.Object obj = orb.orb().string_to_object(ref1);
+ PerfTestInterface d = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj);
+
+ OTSManager.get_current().begin();
+ d.work();
+
+ if (isParameterDefined("-commit"))
+ OTSManager.get_current().commit(true);
+ else
+ OTSManager.get_current().rollback();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected exception: "+e);
+ e.printStackTrace(System.err);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/twophase/TwoPhaseTrx.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/twophase/TwoPhaseTrx.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/implementations/remote/twophase/TwoPhaseTrx.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.implementations.remote.twophase;
+
+import org.jboss.jbossts.qa.performance.PerformanceTest;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+
+public class TwoPhaseTrx extends PerformanceTest
+{
+ protected void work() throws Exception
+ {
+ try
+ {
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA(orb);
+
+ String ref1 = getServiceConfig(0);
+ String ref2 = getServiceConfig(1);
+
+ org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
+ PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
+
+ OTSManager.get_current().begin();
+ d1.work();
+
+ org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
+ PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
+ d2.work();
+
+
+ if (isParameterDefined("-commit"))
+ {
+ // top level commit
+ OTSManager.get_current().commit(true);
+ }
+ else
+ {
+ // top level rollback
+ OTSManager.get_current().rollback();
+ }
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected Exception: "+e);
+ e.printStackTrace(System.err);
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/AtomikosTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/AtomikosTxWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/AtomikosTxWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.products;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * To include this class in the Performance Test Suite (ie class PerformanceTestWrapper) simply include
+ * it as an argument the JVM:
+ * -DproductClass=com.hp.mwtests.performance.products.AtomikosTxWrapper
+ *
+ * Before running this wrapper remember to:
+ * - uncomment the lines marked with TODO;
+ * - include the product jars on the classpath
+ * - recompile (eg add them to jts.classpath qa/tests/build-jts.xml)
+ * - put javax.transaction jar on the classpath
+ * (http://mvnrepository.com/artifact/geronimo-spec/geronimo-spec-jta)
+ * - set the location of the product properties file:
+ * -Dcom.atomikos.icatch.file=<path to atomikos property file>
+ */
+public class AtomikosTxWrapper extends BaseWrapper implements TxWrapper
+{
+
+ public TxWrapper createWrapper()
+ {
+ return new AtomikosTxWrapper();
+ }
+
+ public int begin()
+ {
+ throw new RuntimeException("Not supported - please uncomment Atomikos dependencies in class AtomikosTxWrapper");
+// setUserTransaction(new com.atomikos.icatch.jta.UserTransactionImp()); // TODO uncomment this line
+
+// return super.begin(); // TODO uncomment this line
+ }
+
+ public Transaction getTransaction() throws SystemException
+ {
+ throw new RuntimeException("Not supported - please uncomment Atomikos dependencies in class AtomikosTxWrapper");
+// return com.atomikos.icatch.jta.TransactionManagerImp.getTransactionManager().getTransaction(); // TODO uncomment this line
+ }
+
+ public boolean supportsNestedTx()
+ {
+ return true;
+ }
+
+ public String getName()
+ {
+ return "Atomikos";
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BaseWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BaseWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BaseWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.products;
+
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+import com.arjuna.ats.arjuna.coordinator.AddOutcome;
+
+import javax.transaction.*;
+import javax.transaction.xa.XAResource;
+
+/**
+ * TODO
+ */
+abstract public class BaseWrapper
+{
+ private UserTransaction tx;
+
+ protected void setUserTransaction(UserTransaction tx)
+ {
+ this.tx = tx;
+ }
+
+ abstract public Transaction getTransaction() throws SystemException;
+
+ public int begin()
+ {
+ try
+ {
+ tx.begin();
+ return ActionStatus.RUNNING;
+ }
+ catch (SystemException e)
+ {
+ return ActionStatus.INVALID;
+ }
+ catch (NotSupportedException e)
+ {
+ return ActionStatus.INVALID;
+ }
+ }
+
+ public int commit()
+ {
+ if (tx == null)
+ return ActionStatus.INVALID;
+
+ try
+ {
+ tx.commit();
+ return ActionStatus.COMMITTED;
+ }
+ catch (HeuristicMixedException e)
+ {
+ return ActionStatus.H_MIXED;
+ }
+ catch (HeuristicRollbackException e)
+ {
+ return ActionStatus.H_ROLLBACK;
+ }
+ catch (RollbackException e)
+ {
+ return ActionStatus.ABORTED;
+ }
+ catch (SystemException e)
+ {
+ return ActionStatus.INVALID;
+ }
+ }
+
+ public int abort()
+ {
+ if (tx == null)
+ return ActionStatus.INVALID;
+
+ try
+ {
+ tx.rollback();
+ return ActionStatus.ABORTED;
+ }
+ catch (SystemException e)
+ {
+ return ActionStatus.INVALID;
+ }
+ }
+
+ public int add(XAResource xares)
+ {
+ try
+ {
+ getTransaction().enlistResource(xares);
+ }
+ catch (Exception e) //RollbackException, IllegalStateException, SystemException
+ {
+ return AddOutcome.AR_REJECTED;
+ }
+
+ return AddOutcome.AR_ADDED;
+ }
+
+ protected XAResource toXAResource(AbstractRecord record, boolean verbose)
+ {
+// return new com.hp.mwtests.ts.jta.common.DummyXA(verbose);
+ return new org.jboss.jbossts.qa.CrashRecovery13Impls.RecoveryXAResource();
+ }
+
+ public int add(AbstractRecord record)
+ {
+ return add(toXAResource(record, false));
+ }
+
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BitronixTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BitronixTxWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/BitronixTxWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.products;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * To include this class in the Performance Test Suite (ie class PerformanceTestWrapper) simply include
+ * it as an argument the JVM:
+ * -DproductClass=com.hp.mwtests.performance.products.BitronixTxWrapper
+ *
+ * Before running this wrapper remember to:
+ * - uncomment the lines marked with TODO;
+ * - include the product jars on the classpath;
+ * - recompile (eg add them to jts.classpath qa/tests/build-jts.xml)
+ * - put javax.transaction jar on the classpath
+ * (http://mvnrepository.com/artifact/geronimo-spec/geronimo-spec-jta)
+ * - set the location of the product properties file:
+ * -Dbitronix.tm.configuration=<path to bitronix property file>
+ * JVMARGS="-Dbitronix.tm.configuration=$RESDIR/btm.properties -Dcom.atomikos.icatch.file=$RESDIR/atomikos.properties
+ */
+public class BitronixTxWrapper extends BaseWrapper implements TxWrapper
+{
+ public BitronixTxWrapper()
+ {
+ }
+
+ public TxWrapper createWrapper()
+ {
+ return new BitronixTxWrapper();
+ }
+
+ public Transaction getTransaction() throws SystemException
+ {
+ throw new RuntimeException("Not supported - please uncomment Bitronix dependencies in class BitronixTxWrapper");
+// return bitronix.tm.TransactionManagerServices.getTransactionManager().getCurrentTransaction(); //TODO
+ }
+
+ public int begin()
+ {
+ throw new RuntimeException("Not supported - please uncomment Bitronix dependencies in class BitronixTxWrapper");
+// setUserTransaction(bitronix.tm.TransactionManagerServices.getTransactionManager()); //TODO
+
+// return super.begin(); //TODO
+ }
+
+ public boolean supportsNestedTx()
+ {
+ return false;
+ }
+
+ public String getName()
+ {
+ return "Bitronix";
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/JBossTSTxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/JBossTSTxWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/JBossTSTxWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.products;
+
+import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * TODO
+ */
+public class JBossTSTxWrapper implements TxWrapper
+{
+ AtomicAction tx;
+
+ public JBossTSTxWrapper()
+ {
+ }
+
+ public TxWrapper createWrapper()
+ {
+ return new JBossTSTxWrapper();
+ }
+
+ public Transaction getTransaction() throws SystemException
+ {
+ return com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ }
+
+ public int begin()
+ {
+ this.tx = new AtomicAction();
+
+ return tx.begin();
+ }
+
+ public int commit()
+ {
+ return tx.commit();
+ }
+
+ public int abort()
+ {
+ return tx.abort();
+ }
+
+ public int add(AbstractRecord record)
+ {
+ return tx.add(record);
+ }
+
+ public boolean supportsNestedTx()
+ {
+ return true;
+ }
+
+ public String getName()
+ {
+ return "JBossTS";
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/TxWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/TxWrapper.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/products/TxWrapper.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.products;
+
+import com.arjuna.ats.arjuna.coordinator.AbstractRecord;
+
+import javax.transaction.Transaction;
+import javax.transaction.SystemException;
+
+/**
+ * Minimal interface that TM products should implement for controlling
+ * transactions.
+ * @see BaseWrapper for the default implementation of this interface from which
+ * other implementations may subclass
+ */
+public interface TxWrapper
+{
+ /**
+ * Objtain a new wrapper
+ * @return a wrapper arround a real transaction
+ */
+ TxWrapper createWrapper();
+
+ /**
+ * Start a new transaction
+ * @return one of the com.arjuna.ats.arjuna.coordinator.ActionStatus constants
+ */
+ int begin();
+
+ /**
+ * Commit the current transaction
+ * @return one of the com.arjuna.ats.arjuna.coordinator.ActionStatus constants
+ */
+ int commit();
+ int abort();
+
+ /**
+ * Enlist a resource within the current transaction. For JTA products other than JBossTS
+ * this record should be converted to an XAResource and enlisted with the transaction
+ * @param record
+ * @return one of the com.arjuna.ats.arjuna.coordinator.AddOutcome constants
+ */
+ int add(AbstractRecord record);
+ Transaction getTransaction() throws SystemException;
+ boolean supportsNestedTx();
+ String getName();
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/records/DummyResource.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/records/DummyResource.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/records/DummyResource.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.records;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+
+public class DummyResource extends AbstractRecord
+{
+ public DummyResource()
+ {
+ String debug = System.getProperty("DEBUG", null);
+
+ if (debug != null)
+ {
+ printDebug = true;
+ }
+
+ if (printDebug)
+ {
+ System.out.println("Creating new resource");
+ }
+ }
+
+ public static AbstractRecord create()
+ {
+ return new DummyResource();
+ }
+
+ public int nestedAbort()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedAbort");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedCommit()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedCommit");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedPrepare()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedPrepare");
+ }
+
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+
+ public int topLevelAbort()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelAbort");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int topLevelCommit()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelCommit");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int topLevelPrepare()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelPrepare");
+ }
+
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+
+ public void alter(AbstractRecord abstractRecord)
+ {
+ }
+
+ public void merge(AbstractRecord abstractRecord)
+ {
+ }
+
+ public boolean shouldAdd(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldAlter(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldMerge(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldReplace(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public void setValue(Object object)
+ {
+ }
+
+ public Object value()
+ {
+ return null;
+ }
+
+ public int typeIs()
+ {
+ return RecordType.USER_DEF_FIRST0;
+ }
+
+ private boolean printDebug = false;
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoResource.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoResource.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoResource.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.resources;
+
+/*
+ * Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
+ *
+ * HP Arjuna Labs,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoResource.java,v 1.1.1.1 2002/08/13 12:27:17 rbegg Exp $
+ */
+
+import org.omg.CosTransactions.*;
+import org.omg.CORBA.SystemException;
+
+public class DemoResource extends ResourcePOA
+{
+ public Vote prepare() throws HeuristicMixed, HeuristicHazard, SystemException
+ {
+ // System.out.println("prepare called");
+
+ return Vote.VoteCommit;
+ }
+
+ public void rollback() throws HeuristicCommit, HeuristicMixed,
+ HeuristicHazard, SystemException
+ {
+ // System.out.println("rollback called");
+ }
+
+ public void commit() throws NotPrepared, HeuristicRollback,
+ HeuristicMixed, HeuristicHazard, SystemException
+ {
+ // System.out.println("commit called");
+ }
+
+ public void commit_one_phase() throws HeuristicHazard, SystemException
+ {
+ // System.out.println("commit_one_phase called");
+ }
+
+ public void forget() throws SystemException
+ {
+ // System.out.println("forget called");
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoSubTranResource.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoSubTranResource.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DemoSubTranResource.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.resources;
+
+import org.omg.CosTransactions.*;
+
+public class DemoSubTranResource extends SubtransactionAwareResourcePOA
+{
+ /**
+ * @see org.omg.CosTransactions.SubtransactionAwareResourceOperations#rollback_subtransaction()
+ */
+ public void rollback_subtransaction()
+ {
+ System.out.println("Sub Transaction: rollback subtransaction called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.SubtransactionAwareResourceOperations#commit_subtransaction(Coordinator)
+ */
+ public void commit_subtransaction(Coordinator arg0)
+ {
+ System.out.println("Sub Transaction: commit subtransaction called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.ResourceOperations#forget()
+ */
+ public void forget()
+ {
+ System.out.println("Sub Transaction: forget called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.ResourceOperations#commit_one_phase()
+ */
+ public void commit_one_phase() throws HeuristicHazard
+ {
+ System.out.println("Sub Transaction: commit one phase called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.ResourceOperations#commit()
+ */
+ public void commit() throws NotPrepared, HeuristicRollback, HeuristicMixed, HeuristicHazard
+ {
+ System.out.println("Sub Transaction: commit called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.ResourceOperations#rollback()
+ */
+ public void rollback() throws HeuristicCommit, HeuristicMixed, HeuristicHazard
+ {
+ System.out.println("Sub Transaction: rollback called");
+ }
+
+ /**
+ * @see org.omg.CosTransactions.ResourceOperations#prepare()
+ */
+ public Vote prepare() throws HeuristicMixed, HeuristicHazard
+ {
+ System.out.println("Sub Transaction: prepare called");
+ return Vote.VoteCommit;
+ }
+}
+
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DummyResource.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DummyResource.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/resources/DummyResource.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.resources;
+
+import com.arjuna.ats.arjuna.coordinator.*;
+
+public class DummyResource extends AbstractRecord
+{
+ public DummyResource()
+ {
+ String debug = System.getProperty("DEBUG", null);
+
+ if (debug != null)
+ {
+ printDebug = true;
+ }
+
+ if (printDebug)
+ {
+ System.out.println("Creating new resource");
+ }
+ }
+
+ public static AbstractRecord create()
+ {
+ return new DummyResource();
+ }
+
+ public int nestedAbort()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedAbort");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedCommit()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedCommit");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int nestedPrepare()
+ {
+ if (printDebug)
+ {
+ System.out.println("nestedPrepare");
+ }
+
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+
+ public int topLevelAbort()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelAbort");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int topLevelCommit()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelCommit");
+ }
+
+ return TwoPhaseOutcome.FINISH_OK;
+ }
+
+ public int topLevelPrepare()
+ {
+ if (printDebug)
+ {
+ System.out.println("topLevelPrepare");
+ }
+
+ return TwoPhaseOutcome.PREPARE_OK;
+ }
+
+ public void alter(AbstractRecord abstractRecord)
+ {
+ }
+
+ public void merge(AbstractRecord abstractRecord)
+ {
+ }
+
+ public boolean shouldAdd(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldAlter(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldMerge(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public boolean shouldReplace(AbstractRecord abstractRecord)
+ {
+ return false;
+ }
+
+ public void setValue(Object object)
+ {
+ }
+
+ public Object value()
+ {
+ return null;
+ }
+
+ public int typeIs()
+ {
+ return RecordType.USER_DEF_FIRST0;
+ }
+
+ private boolean printDebug = false;
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/DummyImplServer.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/DummyImplServer.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/DummyImplServer.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.servers;
+
+import org.jboss.jbossts.qa.Utils.ServerIORStore;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import org.jboss.jbossts.qa.performance.implementations.perftestwork.DummyPerfTestImplementation;
+
+public class DummyImplServer
+{
+ /**
+ * The main test method which must assert either a pass or a fail.
+ */
+ public void run(String[] args)
+ {
+ try
+ {
+ String serviceName = args[ args.length - 2 ];
+ String serviceName2 = args[ args.length - 1 ];
+
+ /**
+ * Retrieve ORB and OA references, intialise them
+ * and then set the OTSManager ORB and OA properties
+ */
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA( orb );
+
+ orb.initORB(args, null);
+ oa.initOA(args);
+
+ OTSManager.setORB(orb);
+ OTSManager.setPOA(oa);
+
+ DummyPerfTestImplementation obj1 = new DummyPerfTestImplementation();
+ oa.objectIsReady(obj1);
+ PerfTestInterface objRef1 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj1));
+
+ ServerIORStore.storeIOR(serviceName, orb.orb().object_to_string(objRef1));
+
+ DummyPerfTestImplementation obj2 = new DummyPerfTestImplementation();
+ oa.objectIsReady(obj2);
+ PerfTestInterface objRef2 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj2));
+
+ ServerIORStore.storeIOR(serviceName2, orb.orb().object_to_string(objRef2));
+
+ System.out.println("Ready");
+
+ orb.orb().run();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.out.println("Failed");
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedOnePhaseServer.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedOnePhaseServer.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedOnePhaseServer.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.servers;
+
+import org.jboss.jbossts.qa.Utils.ServerIORStore;
+
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import com.arjuna.ats.jts.OTSManager;
+
+import org.jboss.jbossts.qa.performance.*;
+
+import org.jboss.jbossts.qa.performance.implementations.perftestwork.SingleResourceRegistration;
+import org.jboss.jbossts.qa.performance.implementations.perftestwork.DummyPerfTestImplementation;
+
+public class NestedOnePhaseServer
+{
+ /**
+ * The main test method which must assert either a pass or a fail.
+ */
+ public void run(String[] args)
+ {
+ try
+ {
+ String serviceName = args[ args.length - 2 ];
+ String serviceName2 = args[ args.length - 1 ];
+
+ /**
+ * Retrieve ORB and OA references, intialise them
+ * and then set the OTSManager ORB and OA properties
+ */
+ ORB orb = ORB.getInstance( PerformanceFramework.ORB_INSTANCE_NAME );
+ OA oa = OA.getRootOA( orb );
+
+ orb.initORB(args, null);
+ oa.initOA(args);
+
+ OTSManager.setORB(orb);
+ OTSManager.setPOA(oa);
+
+ SingleResourceRegistration obj1 = new SingleResourceRegistration();
+ oa.objectIsReady(obj1);
+ PerfTestInterface objRef1 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj1));
+
+ ServerIORStore.storeIOR(serviceName, orb.orb().object_to_string(objRef1));
+
+ DummyPerfTestImplementation obj2 = new DummyPerfTestImplementation();
+ oa.objectIsReady(obj2);
+ PerfTestInterface objRef2 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj2));
+
+ ServerIORStore.storeIOR(serviceName2, orb.orb().object_to_string(objRef2));
+
+ System.out.println("Ready");
+
+ orb.orb().run();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.out.println("Failed");
+ }
+ }
+}
Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedTwoPhaseServer.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedTwoPhaseServer.java (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/performance/servers/NestedTwoPhaseServer.java 2009-07-14 11:19:28 UTC (rev 27997)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.qa.performance.servers;
+
+import org.jboss.jbossts.qa.Utils.ServerIORStore;
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.OA;
+import org.jboss.jbossts.qa.performance.PerformanceFramework;
+import org.jboss.jbossts.qa.performance.PerfTestInterface;
+import org.jboss.jbossts.qa.performance.PerfTestInterfaceHelper;
+import org.jboss.jbossts.qa.performance.implementations.perftestwork.SingleResourceRegistration;
+import org.jboss.jbossts.qa.performance.implementations.perftestwork.SingleSubtranAwareResourceRegistration;
+
+public class NestedTwoPhaseServer
+{
+ /**
+ * The main test method which must assert either a pass or a fail.
+ */
+ public void run(String[] args)
+ {
+ try
+ {
+ String serviceName = args[args.length - 2];
+ String serviceName2 = args[args.length - 1];
+
+ /**
+ * Retrieve ORB and OA references, intialise them
+ * and then set the OTSManager ORB and OA properties
+ */
+ ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
+ OA oa = OA.getRootOA(orb);
+
+ orb.initORB(args, null);
+ oa.initOA(args);
+
+ SingleResourceRegistration obj1 = new SingleResourceRegistration();
+ oa.objectIsReady(obj1);
+ PerfTestInterface objRef1 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj1));
+
+ ServerIORStore.storeIOR(serviceName, orb.orb().object_to_string(objRef1));
+
+ SingleSubtranAwareResourceRegistration obj2 = new SingleSubtranAwareResourceRegistration();
+ oa.objectIsReady(obj2);
+ PerfTestInterface objRef2 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj2));
+
+ ServerIORStore.storeIOR(serviceName2, orb.orb().object_to_string(objRef2));
+
+ System.out.println("Object reference written to file");
+
+ System.out.println("Ready");
+
+ orb.orb().run();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unexpected exception: "+e);
+ e.printStackTrace(System.err);
+ System.out.println("Failed");
+ }
+ }
+}
More information about the jboss-svn-commits
mailing list