incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosv...@apache.org
Subject svn commit: r956368 - in /incubator/bval/sandbox/jsr303-impl-bench: ./ src/main/java/org/apache/bval/bench/ src/test/java/org/apache/bval/bench/
Date Sun, 20 Jun 2010 14:46:42 GMT
Author: carlosvara
Date: Sun Jun 20 14:46:42 2010
New Revision: 956368

URL: http://svn.apache.org/viewvc?rev=956368&view=rev
Log:
Script to run the benchmarks, changed versions in pom and some little code changes

Added:
    incubator/bval/sandbox/jsr303-impl-bench/runner.sh   (with props)
Modified:
    incubator/bval/sandbox/jsr303-impl-bench/   (props changed)
    incubator/bval/sandbox/jsr303-impl-bench/pom.xml
    incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Config.java
    incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Generator.java
    incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/ApacheTest.java
    incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/HibernateTest.java

Propchange: incubator/bval/sandbox/jsr303-impl-bench/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jun 20 14:46:42 2010
@@ -2,3 +2,4 @@
 .project
 .classpath
 target
+scenario*

Modified: incubator/bval/sandbox/jsr303-impl-bench/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/pom.xml?rev=956368&r1=956367&r2=956368&view=diff
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/pom.xml (original)
+++ incubator/bval/sandbox/jsr303-impl-bench/pom.xml Sun Jun 20 14:46:42 2010
@@ -32,6 +32,11 @@
     <artifactId>jsr303-impl-bench</artifactId>
     <packaging>jar</packaging>
     <name>Apache Bean Validation :: jsr303-impl-bench (optional)</name>
+    
+    <properties>
+        <apache-bval.version>0.1-incubating</apache-bval.version>
+        <hibernate-val.version>4.1.0.CR1</hibernate-val.version>
+    </properties>
 
     <dependencies>
         <dependency>
@@ -52,11 +57,12 @@
         <dependency>
             <groupId>org.apache.bval</groupId>
             <artifactId>org.apache.bval.bundle</artifactId>
+            <version>${apache-bval.version}</version>
         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>
-            <version>4.1.0.Beta1</version>
+            <version>${hibernate-val.version}</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -129,16 +135,20 @@
 
     <repositories>
         <repository>
-            <id>repository.jboss.org</id>
-            <name>JBoss Repository</name>
-            <url>http://repository.jboss.org/maven2</url>
+            <id>jboss-public-repository-group</id>
+            <name>JBoss Public Maven Repository Group</name>
+            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
             <layout>default</layout>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
             <releases>
                 <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+                <checksumPolicy>fail</checksumPolicy>
             </releases>
+            <snapshots>
+                <enabled>false</enabled>
+                <updatePolicy>never</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </snapshots>
         </repository>
         <repository>
             <id>Java.net Maven 2 Repository</id>

Added: incubator/bval/sandbox/jsr303-impl-bench/runner.sh
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/runner.sh?rev=956368&view=auto
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/runner.sh (added)
+++ incubator/bval/sandbox/jsr303-impl-bench/runner.sh Sun Jun 20 14:46:42 2010
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#######################################################################
+#
+# Runs all the available test case scenarios defined in
+# scenarioX.properties files
+#
+# The JSR303 impl to test is passed as first param.
+# Possible values:
+#   - Apache
+#   - Hibernate
+#
+
+
+PROPERTIES_FILE="src/main/resources/generator.properties"
+
+# Will iterate 20 times for each scenario, using seeds from 1 to 20
+SEED_LOW=1
+SEED_HIGH=20
+
+## 
+# Benchmarks a given scenario
+#
+# params:
+#   $1 - file containing the scenario properties
+#   $2 - unit test to run
+bench_scenario() {
+    # set the scenario rules
+    cp $1 $PROPERTIES_FILE
+    mvn clean
+
+    # run the scenario ($SEED_HIGH - $SEED_LOW) times
+    for it in `seq $SEED_LOW $SEED_HIGH`
+    do
+        mvn -Dtest=$2 -DargLine="-Dgenerator.rnd.seed=$it -Dtester.repetitions=50" test
+    done
+
+    # copy the results back to the current dir
+    cp target/$2"-results.txt" $1"-"$2".txt"
+}
+
+
+
+#
+# Check that a valid impl has been specified
+#
+
+if [ "$1" != "Apache" ] && [ "$1" != "Hibernate" ];
+then
+    echo "Error"
+    echo "You must specify either Apache or Hibernate to test"
+    exit
+fi
+
+#
+# Runs all the scenario?.properties cases present in the current dir
+#
+
+tests_run=0
+shopt -s nullglob
+
+for test_props in scenario?.properties
+do
+    bench_scenario $test_props $1"Test"
+    let "tests_run += 1"
+done
+
+if [ $tests_run -eq 0 ]
+then
+    echo "No scenarios available to run."
+    echo
+    echo "You can create a scenario by placing a scenarioX.properties file in the "
+    echo "current directory."
+else
+    echo "Benchmarked $tests_run scenarios"
+fi

Propchange: incubator/bval/sandbox/jsr303-impl-bench/runner.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/sandbox/jsr303-impl-bench/runner.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Config.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Config.java?rev=956368&r1=956367&r2=956368&view=diff
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Config.java
(original)
+++ incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Config.java
Sun Jun 20 14:46:42 2010
@@ -53,6 +53,9 @@ public enum Config {
 
         // Init random generator
         r = new Random(new Long(p.getProperty("generator.rnd.seed")));
+        
+        // Extra info: print the properties which will be in use
+        printProperties();
     }
 
     /**

Modified: incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Generator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Generator.java?rev=956368&r1=956367&r2=956368&view=diff
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Generator.java
(original)
+++ incubator/bval/sandbox/jsr303-impl-bench/src/main/java/org/apache/bval/bench/Generator.java
Sun Jun 20 14:46:42 2010
@@ -250,7 +250,6 @@ public class Generator {
      */
     public static void main(String[] args) {
         System.out.println("Starting bean graph generation...");
-        Config.CFG.printProperties();
         new Generator().generateBeanGraph();
         System.out.println("Generated " + Config.CFG.getNumBeans() + " beans.");
     }

Modified: incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/ApacheTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/ApacheTest.java?rev=956368&r1=956367&r2=956368&view=diff
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/ApacheTest.java
(original)
+++ incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/ApacheTest.java
Sun Jun 20 14:46:42 2010
@@ -48,7 +48,7 @@ public class ApacheTest extends Abstract
     
     @AfterClass
     public static void printResultsToFile() throws IOException {
-        FileWriter fw = new FileWriter("target/apache-results.txt", true);
+        FileWriter fw = new FileWriter("target/"+ApacheTest.class.getSimpleName()+"-results.txt",
true);
         DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
         fw.write(dateFormat.format(new Date()));
         fw.write(" " + (rvTime / 1000000l));

Modified: incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/HibernateTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/HibernateTest.java?rev=956368&r1=956367&r2=956368&view=diff
==============================================================================
--- incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/HibernateTest.java
(original)
+++ incubator/bval/sandbox/jsr303-impl-bench/src/test/java/org/apache/bval/bench/HibernateTest.java
Sun Jun 20 14:46:42 2010
@@ -48,7 +48,7 @@ public class HibernateTest extends Abstr
     
     @AfterClass
     public static void printResultsToFile() throws IOException {
-        FileWriter fw = new FileWriter("target/hibernate-results.txt", true);
+        FileWriter fw = new FileWriter("target/"+HibernateTest.class.getSimpleName()+"-results.txt",
true);
         DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
         fw.write(dateFormat.format(new Date()));
         fw.write(" " + (rvTime / 1000000l));



Mime
View raw message