[jboss-cvs] JBossAS SVN: r111849 - in projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark: cli and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 26 13:31:07 EDT 2011
Author: whitingjr
Date: 2011-07-26 13:31:07 -0400 (Tue, 26 Jul 2011)
New Revision: 111849
Added:
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLIBenchmark.java
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLITransactionDriver.java
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpBenchmark.java
projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpDriver.java
Log:
Added classes for cli benchmarks.
Added: projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLIBenchmark.java
===================================================================
--- projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLIBenchmark.java (rev 0)
+++ projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLIBenchmark.java 2011-07-26 17:31:07 UTC (rev 111849)
@@ -0,0 +1,74 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.perf.benchmark.cli;
+
+import com.sun.faban.harness.Configure;
+import com.sun.faban.harness.DefaultFabanBenchmark2;
+import com.sun.faban.harness.Validate;
+
+/**
+ * A CLIDriver.
+ *
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ * @version $Revision: 1.1 $
+ */
+public class CLIBenchmark extends DefaultFabanBenchmark2
+{
+ public static final String JNDI_NAME = "jndiName";
+ public static final String FQCN_TEST = "fqcn.test";
+ /**
+ * Create a new CLIBenchmark.
+ *
+ */
+ public CLIBenchmark()
+ {
+
+ }
+
+ @Configure
+ public void configure()
+ throws Exception
+ {
+ }
+
+ @Validate
+ public void validate()
+ throws Exception
+ {
+ super.validate();
+ String jndiName = params.getParameter(JNDI_NAME);
+ String fqcn = params.getParameter(FQCN_TEST);
+
+ if ("".equals(jndiName.trim()))
+ {
+ throw new Exception("enter a jndi name");
+ }
+
+ if ("".equals(fqcn.trim()))
+ {
+ throw new Exception("enter a valid test class");
+ }
+
+ }
+
+}
Added: projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLITransactionDriver.java
===================================================================
--- projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLITransactionDriver.java (rev 0)
+++ projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/CLITransactionDriver.java 2011-07-26 17:31:07 UTC (rev 111849)
@@ -0,0 +1,142 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.perf.benchmark.cli;
+
+import org.jboss.jca.perf.benchmark.container.test.CLITransactionTest;
+import org.jboss.jca.performance.perfenv.Activate;
+import org.jboss.jca.performance.perfenv.CLI;
+import org.jboss.jca.performance.perfenv.Deactivate;
+import org.jboss.jca.performance.perfenv.Deploy;
+import org.jboss.jca.performance.perfenv.TestRunner;
+import org.jboss.jca.performance.perfenv.TestSetUp;
+import org.jboss.jca.performance.perfenv.TestTearDown;
+import org.jboss.jca.performance.perfenv.Undeploy;
+
+import com.sun.faban.driver.BenchmarkDefinition;
+import com.sun.faban.driver.BenchmarkDriver;
+import com.sun.faban.driver.BenchmarkOperation;
+import com.sun.faban.driver.CycleType;
+import com.sun.faban.driver.DriverContext;
+import com.sun.faban.driver.FixedTime;
+import com.sun.faban.driver.FlatMix;
+import com.sun.faban.driver.OnceAfter;
+import com.sun.faban.driver.OnceBefore;
+import com.sun.faban.driver.Timing;
+
+/**
+ * A CLITransactionDriver. This calls the cli passing
+ * details of the test class to execute.
+ *
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ * @version $Revision: 1.1 $
+ */
+ at BenchmarkDefinition
+(
+ name="Transaction Driver using the perfenv CLI interface."
+ , version="1.0"
+)
+ at BenchmarkDriver
+(
+ name="CLI Driver"
+ , threadPerScale=1
+)
+ at FlatMix
+(
+ operations = {"callTransaction"}
+ , mix = 100
+ , deviation=2
+)
+ at FixedTime
+(
+ cycleTime=0
+ , cycleType=CycleType.THINKTIME
+ , cycleDeviation=2
+)
+
+public class CLITransactionDriver
+{
+ private DriverContext context;
+ private static final String[] activateArgs = {new Activate().getName(), "sjc", Boolean.FALSE.toString()}; // NoopTS
+ private static final String[] deployNoOpJDBCArgs = {new Deploy().getName(), "ironjacamar-performance-noopdb.jar"};
+ private static final String[] deployJDBCArgs = {new Deploy().getName(), "jdbc-local.rar"};
+ private static final String[] deployDSArgs = {new Deploy().getName(), "noopdb-ds.xml"};
+
+ private static final String[] undeployJDBCArgs = {new Undeploy().getName(), "ironjacamar-performance-noopdb.jar"};
+ private static final String[] undeployNoOpJDBCArgs = {new Undeploy().getName(), "jdbc-local.rar"};
+ private static final String[] undeployDSArgs = {new Undeploy().getName(), "noopdb-ds.xml"};
+ private static final String[] deactivateArgs = {new Deactivate().getName(), CLITransactionTest.class.getName()};
+
+ private String[] setupArgs;
+ private String[] transactionArgs;
+ private String[] teardownArgs;
+
+ @BenchmarkOperation
+ (
+ name="callTransaction"
+ , max90th=2
+ , timing = Timing.MANUAL
+ )
+ public void doCLIRequest()
+ throws Exception
+ {
+ context.recordTime();
+ CLI.main(transactionArgs);
+ context.recordTime();
+ }
+
+ @OnceBefore
+ public void before()
+ throws Exception
+ {
+ context.getLogger().info("Called test set-up on command line.");
+ CLI.main(activateArgs);
+ CLI.main(deployNoOpJDBCArgs);
+ CLI.main(deployJDBCArgs);
+ CLI.main(deployDSArgs);
+ CLI.main(setupArgs);
+ }
+
+ @OnceAfter
+ public void after()
+ throws Exception
+ {
+ CLI.main(teardownArgs);
+ CLI.main(undeployDSArgs);
+ CLI.main(undeployNoOpJDBCArgs);
+ CLI.main(undeployJDBCArgs);
+ CLI.main(deactivateArgs);
+ context.getLogger().info("Called test tear down on command line.");
+ }
+
+ /**
+ * Create a new CLITransactionDriver.
+ *
+ */
+ public CLITransactionDriver()
+ {
+ context = DriverContext.getContext();
+ setupArgs = new String[]{new TestSetUp().getName(), context.getProperty(CLIBenchmark.FQCN_TEST), context.getProperty(CLIBenchmark.JNDI_NAME)};
+ transactionArgs = new String[] {new TestRunner().getName(), context.getProperty(CLIBenchmark.FQCN_TEST), "1"};
+ teardownArgs = new String[]{new TestTearDown().getName(), context.getProperty(CLIBenchmark.FQCN_TEST)};
+ }
+}
Added: projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpBenchmark.java
===================================================================
--- projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpBenchmark.java (rev 0)
+++ projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpBenchmark.java 2011-07-26 17:31:07 UTC (rev 111849)
@@ -0,0 +1,60 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.perf.benchmark.cli.noop;
+
+import org.jboss.jca.perf.benchmark.cli.CLIBenchmark;
+
+/**
+ * A CLINoOpBenchmark.
+ *
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ * @version $Revision: 1.1 $
+ */
+public class CLINoOpBenchmark extends CLIBenchmark
+{
+ public static final String ITERATION_COUNT = "test.iteration.count";
+
+ @Override
+ public void validate() throws Exception
+ {
+ super.validate();
+ String iterations = params.getParameter(ITERATION_COUNT);
+
+ if (null != iterations && "".equals(iterations.trim()))
+ {
+ throw new Exception("enter a value for the number of iterations");
+ }
+ else
+ {
+ try
+ {
+ Integer.parseInt(iterations); //this may throw numberformatexception
+ }
+ catch (NumberFormatException nfe)
+ {// throw a meaningful exception
+ throw new Exception("enter a valid integer value for the number of iterations, " +
+ "the value entered was not recognised as an integer");
+ }
+ }
+ }
+}
Added: projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpDriver.java
===================================================================
--- projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpDriver.java (rev 0)
+++ projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/benchmark/cli/noop/CLINoOpDriver.java 2011-07-26 17:31:07 UTC (rev 111849)
@@ -0,0 +1,143 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.perf.benchmark.cli.noop;
+
+import org.jboss.jca.perf.benchmark.cli.CLIBenchmark;
+import org.jboss.jca.perf.benchmark.container.test.CLITransactionTest;
+import org.jboss.jca.performance.perfenv.Activate;
+import org.jboss.jca.performance.perfenv.CLI;
+import org.jboss.jca.performance.perfenv.Deactivate;
+import org.jboss.jca.performance.perfenv.Deploy;
+import org.jboss.jca.performance.perfenv.TestRunner;
+import org.jboss.jca.performance.perfenv.TestSetUp;
+import org.jboss.jca.performance.perfenv.TestTearDown;
+import org.jboss.jca.performance.perfenv.Undeploy;
+
+import com.sun.faban.driver.BenchmarkDefinition;
+import com.sun.faban.driver.BenchmarkDriver;
+import com.sun.faban.driver.BenchmarkOperation;
+import com.sun.faban.driver.CycleType;
+import com.sun.faban.driver.DriverContext;
+import com.sun.faban.driver.FixedTime;
+import com.sun.faban.driver.FlatMix;
+import com.sun.faban.driver.OnceAfter;
+import com.sun.faban.driver.OnceBefore;
+import com.sun.faban.driver.Timing;
+
+/**
+ * A CLINoOpDriver.
+ *
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ * @version $Revision: 1.1 $
+ */
+ at BenchmarkDefinition
+(
+ name="NoOp Driver using the perfenv CLI interface."
+ , version="1.0"
+)
+ at BenchmarkDriver
+(
+ name="CLI NoOp Driver"
+ , threadPerScale=1
+)
+ at FlatMix
+(
+ operations = {"callNoOp"}
+ , mix = 100
+ , deviation=2
+)
+ at FixedTime
+(
+ cycleTime=0
+ , cycleType=CycleType.THINKTIME
+ , cycleDeviation=2
+)
+
+public class CLINoOpDriver
+{
+ private DriverContext context;
+ private static final String[] activateArgs = {new Activate().getName(), "sjc", Boolean.FALSE.toString()}; // NoopTS
+ private static final String[] deployNoOpJDBCArgs = {new Deploy().getName(), "ironjacamar-performance-noopdb.jar"};
+ private static final String[] deployJDBCArgs = {new Deploy().getName(), "jdbc-local.rar"};
+ private static final String[] deployDSArgs = {new Deploy().getName(), "noopdb-ds.xml"};
+
+ private static final String[] undeployJDBCArgs = {new Undeploy().getName(), "ironjacamar-performance-noopdb.jar"};
+ private static final String[] undeployNoOpJDBCArgs = {new Undeploy().getName(), "jdbc-local.rar"};
+ private static final String[] undeployDSArgs = {new Undeploy().getName(), "noopdb-ds.xml"};
+ private static final String[] deactivateArgs = {new Deactivate().getName(), CLITransactionTest.class.getName()};
+
+ private String[] setupArgs;
+ private String[] transactionArgs;
+ private String[] teardownArgs;
+
+ @BenchmarkOperation
+ (
+ name="callTransaction"
+ , max90th=2
+ , timing = Timing.MANUAL
+ )
+ public void doCLIRequest()
+ throws Exception
+ {
+ context.recordTime();
+ CLI.main(transactionArgs);
+ context.recordTime();
+ }
+
+ @OnceBefore
+ public void before()
+ throws Exception
+ {
+ context.getLogger().info("Called test set-up on command line.");
+ CLI.main(activateArgs);
+ CLI.main(deployNoOpJDBCArgs);
+ CLI.main(deployJDBCArgs);
+ CLI.main(deployDSArgs);
+ CLI.main(setupArgs);
+ }
+
+ @OnceAfter
+ public void after()
+ throws Exception
+ {
+ CLI.main(teardownArgs);
+ CLI.main(undeployDSArgs);
+ CLI.main(undeployNoOpJDBCArgs);
+ CLI.main(undeployJDBCArgs);
+ CLI.main(deactivateArgs);
+ context.getLogger().info("Called test tear down on command line.");
+ }
+
+ /**
+ * Create a new CLITransactionDriver.
+ *
+ */
+ public CLINoOpDriver()
+ {
+ context = DriverContext.getContext();
+ setupArgs = new String[]{new TestSetUp().getName(), context.getProperty(CLIBenchmark.FQCN_TEST), context.getProperty(CLIBenchmark.JNDI_NAME)};
+ transactionArgs = new String[] {new TestRunner().getName(), context.getProperty(CLIBenchmark.FQCN_TEST), "1"};
+ teardownArgs = new String[]{new TestTearDown().getName(), context.getProperty(CLIBenchmark.FQCN_TEST)};
+ }
+}
+
More information about the jboss-cvs-commits
mailing list