cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r408096 - in /incubator/cayenne/main/trunk/cayenne-regression-profiler: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cayenne/ src/main/java/org/apache/cayenne/profile/ src/main/java/...
Date Sat, 20 May 2006 21:15:57 GMT
Author: aadamchik
Date: Sat May 20 14:15:55 2006
New Revision: 408096

URL: http://svn.apache.org/viewvc?rev=408096&view=rev
Log:
CAY-524 - initial check in

Added:
    incubator/cayenne/main/trunk/cayenne-regression-profiler/.classpath
    incubator/cayenne/main/trunk/cayenne-regression-profiler/.project
    incubator/cayenne/main/trunk/cayenne-regression-profiler/build.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/pom.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/DeleteCase.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/InsertCase.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/Entity1.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/_Entity1.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/AbstractCase.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileFilter.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileServlet.java
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/cayenne-profile.jmx
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/cayenne.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.driver.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.map.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/web.xml
    incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/index.htm
Modified:
    incubator/cayenne/main/trunk/cayenne-regression-profiler/   (props changed)

Propchange: incubator/cayenne/main/trunk/cayenne-regression-profiler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May 20 14:15:55 2006
@@ -0,0 +1,2 @@
+
+target

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/.classpath
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/.classpath?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/.classpath (added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/.classpath Sat May 20 14:15:55
2006
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/.project
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/.project?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/.project (added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/.project Sat May 20 14:15:55
2006
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>cayenne-regression-profiler</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/build.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/build.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/build.xml (added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/build.xml Sat May 20 14:15:55
2006
@@ -0,0 +1,14 @@
+<!-- 
+	This ant file is called from maven and is not a full standalone build script.
+	Properties are set in pom.xml
+-->
+<project>
+	
+	<target name="generate-classes">
+		<typedef resource="org/objectstyle/cayenne/tools/antlib.xml"
+			classpathref="maven.compile.classpath"/>
+		
+		<cgen map="src/main/resources/regression-profile.map.xml" destDir="src/main/java"
+			superpkg="org.apache.cayenne.profile.entity.auto"/>
+	</target>
+</project>
\ No newline at end of file

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/pom.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/pom.xml (added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/pom.xml Sat May 20 14:15:55 2006
@@ -0,0 +1,80 @@
+<?xml version="1.0"?><project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.cayenne</groupId>
+  <artifactId>cayenne-regression-profiler</artifactId>
+  <packaging>war</packaging>
+  <name>Cayenne Regression Profiler Web Application</name>
+  <version>1.2-SNAPSHOT</version>
+  <url>http://incubator.apache.org/cayenne/</url>
+  <build>
+    <finalName>cayenne-regression-profiler</finalName>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <ant target="generate-classes" inheritrefs="true"></ant>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- before running , do this:
+           export MAVEN_OPTS="-Xms128M -Xmx128M"
+      -->
+      <plugin>
+        <groupId>org.mortbay.jetty</groupId>
+        <artifactId>maven-jetty6-plugin</artifactId>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee_1.4_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <scanIntervalSeconds>20</scanIntervalSeconds>
+         <!-- <jettyConfig>etc/jetty.xml</jettyConfig> -->
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.objectstyle.cayenne</groupId>
+      <artifactId>cayenne-nodeps</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.8.0.1</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/DeleteCase.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/DeleteCase.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/DeleteCase.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/DeleteCase.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+package org.apache.cayenne.profile.cases;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cayenne.profile.entity.Entity1;
+import org.apache.cayenne.profile.servlet.AbstractCase;
+import org.objectstyle.cayenne.access.DataContext;
+import org.objectstyle.cayenne.query.SQLTemplate;
+
+public class DeleteCase extends AbstractCase {
+
+    protected void doRequest(
+            DataContext context,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+
+        context
+                .performGenericQuery(new SQLTemplate(Entity1.class, "delete from ENTITY1"));
+    }
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/InsertCase.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/InsertCase.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/InsertCase.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/cases/InsertCase.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,41 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+package org.apache.cayenne.profile.cases;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cayenne.profile.entity.Entity1;
+import org.apache.cayenne.profile.servlet.AbstractCase;
+import org.objectstyle.cayenne.access.DataContext;
+
+public class InsertCase extends AbstractCase {
+
+    protected void doRequest(
+            DataContext context,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+
+        for (int i = 0; i < 500; i++) {
+            Entity1 e = (Entity1) context.newObject(Entity1.class);
+            e.setName("Name_" + i);
+            e.setDescription("Desc_" + i);
+        }
+
+        context.commitChanges();
+    }
+
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/Entity1.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/Entity1.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/Entity1.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/Entity1.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,10 @@
+package org.apache.cayenne.profile.entity;
+
+import org.apache.cayenne.profile.entity.auto._Entity1;
+
+public class Entity1 extends _Entity1 {
+
+}
+
+
+

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/_Entity1.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/_Entity1.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/_Entity1.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/entity/auto/_Entity1.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,31 @@
+package org.apache.cayenne.profile.entity.auto;
+
+/** Class _Entity1 was generated by Cayenne.
+  * It is probably a good idea to avoid changing this class manually, 
+  * since it may be overwritten next time code is regenerated. 
+  * If you need to make any customizations, please use subclass. 
+  */
+public class _Entity1 extends org.objectstyle.cayenne.CayenneDataObject {
+
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String NAME_PROPERTY = "name";
+
+    public static final String ID_PK_COLUMN = "ID";
+
+    public void setDescription(String description) {
+        writeProperty("description", description);
+    }
+    public String getDescription() {
+        return (String)readProperty("description");
+    }
+    
+    
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+    
+    
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/AbstractCase.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/AbstractCase.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/AbstractCase.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/AbstractCase.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+package org.apache.cayenne.profile.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.objectstyle.cayenne.access.DataContext;
+
+/**
+ * An noop profiling case.
+ * 
+ * @author Andrus Adamchik
+ */
+public class AbstractCase {
+
+    public void doGet(
+            DataContext context,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+
+        doRequest(context, request, response);
+    }
+
+    public void doPost(
+            DataContext context,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+        doRequest(context, request, response);
+    }
+
+    protected void doRequest(
+            DataContext context,
+            HttpServletRequest request,
+            HttpServletResponse response) {
+
+    }
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileFilter.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileFilter.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileFilter.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileFilter.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,56 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+package org.apache.cayenne.profile.servlet;
+
+import java.io.File;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+
+import org.objectstyle.cayenne.access.DataDomain;
+import org.objectstyle.cayenne.access.DataNode;
+import org.objectstyle.cayenne.access.DbGenerator;
+import org.objectstyle.cayenne.conf.Configuration;
+import org.objectstyle.cayenne.conf.WebApplicationContextFilter;
+import org.objectstyle.cayenne.util.Util;
+
+/**
+ * A filter that sets up DB schema.
+ */
+public class ProfileFilter extends WebApplicationContextFilter {
+
+    public synchronized void init(FilterConfig config) throws ServletException {
+        // remove old database
+
+        File dbDir = new File("target/regression-db");
+        if (dbDir.isDirectory()) {
+            Util.delete(dbDir.getAbsolutePath(), true);
+        }
+
+        super.init(config);
+
+        DataDomain domain = Configuration.getSharedConfiguration().getDomain();
+        DataNode node = domain.getNode("regression-profile");
+        DbGenerator generator = new DbGenerator(node.getAdapter(), domain
+                .getMap("regression-profile"));
+        try {
+            generator.runGenerator(node.getDataSource());
+        }
+        catch (Exception e) {
+            throw new ServletException("Error generating schema", e);
+        }
+    }
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileServlet.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileServlet.java?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileServlet.java
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/java/org/apache/cayenne/profile/servlet/ProfileServlet.java
Sat May 20 14:15:55 2006
@@ -0,0 +1,88 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.
+ */
+package org.apache.cayenne.profile.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.objectstyle.cayenne.access.DataContext;
+
+/**
+ * A main servlet of the profiler web app. Accepts URLs like
+ * "/servlet-path/nosession/CaseClass" and "/servlet-path/session/CaseClass".
+ * 
+ * @author Andrus Adamchik
+ */
+public class ProfileServlet extends HttpServlet {
+
+    public static final String CASE_PACKAGE = "org.apache.cayenne.profile.cases.";
+
+    public void init() throws ServletException {
+        super.init();
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
+        DataContext context = contextForRequest(request);
+        caseForRequest(request).doGet(context, request, response);
+    }
+
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        DataContext context = contextForRequest(request);
+        caseForRequest(request).doPost(context, request, response);
+    }
+
+    protected DataContext contextForRequest(HttpServletRequest request) {
+
+        // rely on Cayenne filter to bind DC to the request thread when the path
+        // matches...
+        try {
+            return DataContext.getThreadDataContext();
+        }
+        catch (IllegalStateException e) {
+            return DataContext.createDataContext();
+        }
+    }
+
+    protected AbstractCase caseForRequest(HttpServletRequest request)
+            throws ServletException {
+
+        // everything after the first path component is the case class...
+        String path = request.getPathInfo();
+        int slash = path.indexOf('/', 1);
+
+        if (slash < 0 || slash + 1 == path.length()) {
+            throw new ServletException("Invalid case path: " + path);
+        }
+
+        String caseName = CASE_PACKAGE + path.substring(slash + 1);
+        try {
+            return (AbstractCase) Class.forName(
+                    caseName,
+                    true,
+                    Thread.currentThread().getContextClassLoader()).newInstance();
+        }
+        catch (Exception e) {
+            throw new ServletException("Error instantiating case '" + caseName + "'", e);
+        }
+    }
+}

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/cayenne-profile.jmx
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/cayenne-profile.jmx?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/cayenne-profile.jmx
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/jmeter/cayenne-profile.jmx
Sat May 20 14:15:55 2006
@@ -0,0 +1,173 @@
+<jmeterTestPlan version="1.1" properties="1.7">
+  <hashTree>
+    <TestPlan>
+      <elementProp name="TestPlan.user_defined_variables" elementType="org.apache.jmeter.config.Arguments">
+        <stringProp name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsPanel</stringProp>
+        <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>
+        <collectionProp name="Arguments.arguments"/>
+        <stringProp name="TestElement.name">User Defined Variables</stringProp>
+        <boolProp name="TestElement.enabled">true</boolProp>
+      </elementProp>
+      <stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanGui</stringProp>
+      <stringProp name="TestPlan.user_define_classpath"></stringProp>
+      <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
+      <stringProp name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan</stringProp>
+      <stringProp name="TestElement.name">CayenneTest</stringProp>
+      <boolProp name="TestPlan.functional_mode">false</boolProp>
+      <boolProp name="TestElement.enabled">true</boolProp>
+      <stringProp name="TestPlan.comments"></stringProp>
+    </TestPlan>
+    <hashTree>
+      <ThreadGroup>
+        <longProp name="ThreadGroup.start_time">1148151181000</longProp>
+        <stringProp name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup</stringProp>
+        <stringProp name="ThreadGroup.delay"></stringProp>
+        <stringProp name="ThreadGroup.duration"></stringProp>
+        <boolProp name="TestElement.enabled">true</boolProp>
+        <stringProp name="ThreadGroup.num_threads">6</stringProp>
+        <boolProp name="ThreadGroup.scheduler">false</boolProp>
+        <stringProp name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGroupGui</stringProp>
+        <elementProp name="ThreadGroup.main_controller" elementType="org.apache.jmeter.control.LoopController">
+          <stringProp name="TestElement.gui_class">org.apache.jmeter.control.gui.LoopControlPanel</stringProp>
+          <stringProp name="LoopController.loops">20</stringProp>
+          <stringProp name="TestElement.test_class">org.apache.jmeter.control.LoopController</stringProp>
+          <stringProp name="TestElement.name">Loop Controller</stringProp>
+          <boolProp name="TestElement.enabled">true</boolProp>
+          <boolProp name="LoopController.continue_forever">false</boolProp>
+        </elementProp>
+        <stringProp name="TestElement.name">Main</stringProp>
+        <longProp name="ThreadGroup.end_time">1148151181000</longProp>
+        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
+        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
+      </ThreadGroup>
+      <hashTree>
+        <HTTPSampler>
+          <stringProp name="HTTPSampler.path">/cayenne-regression-profiler/profile/session/DeleteCase</stringProp>
+          <stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>
+          <stringProp name="HTTPSampler.method">GET</stringProp>
+          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+          <stringProp name="HTTPSampler.protocol"></stringProp>
+          <boolProp name="TestElement.enabled">true</boolProp>
+          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+          <stringProp name="HTTPSampler.port">8080</stringProp>
+          <elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments">
+            <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>
+            <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>
+            <collectionProp name="Arguments.arguments"/>
+            <stringProp name="TestElement.name">User Defined Variables</stringProp>
+            <boolProp name="TestElement.enabled">true</boolProp>
+          </elementProp>
+          <stringProp name="HTTPSampler.mimetype"></stringProp>
+          <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>
+          <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
+          <stringProp name="TestElement.name">Delete</stringProp>
+          <stringProp name="HTTPSampler.monitor">false</stringProp>
+          <stringProp name="HTTPSampler.domain">localhost</stringProp>
+          <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
+          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
+        </HTTPSampler>
+        <hashTree/>
+        <HTTPSampler>
+          <stringProp name="HTTPSampler.path">/cayenne-regression-profiler/profile/session/InsertCase</stringProp>
+          <stringProp name="TestElement.test_class">org.apache.jmeter.protocol.http.sampler.HTTPSampler</stringProp>
+          <stringProp name="HTTPSampler.method">GET</stringProp>
+          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
+          <stringProp name="HTTPSampler.protocol"></stringProp>
+          <boolProp name="TestElement.enabled">true</boolProp>
+          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
+          <stringProp name="HTTPSampler.port">8080</stringProp>
+          <elementProp name="HTTPsampler.Arguments" elementType="org.apache.jmeter.config.Arguments">
+            <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel</stringProp>
+            <stringProp name="TestElement.test_class">org.apache.jmeter.config.Arguments</stringProp>
+            <collectionProp name="Arguments.arguments"/>
+            <stringProp name="TestElement.name">User Defined Variables</stringProp>
+            <boolProp name="TestElement.enabled">true</boolProp>
+          </elementProp>
+          <stringProp name="HTTPSampler.mimetype"></stringProp>
+          <stringProp name="TestElement.gui_class">org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui</stringProp>
+          <stringProp name="HTTPSampler.FILE_FIELD"></stringProp>
+          <stringProp name="TestElement.name">Insert</stringProp>
+          <stringProp name="HTTPSampler.monitor">false</stringProp>
+          <stringProp name="HTTPSampler.domain">localhost</stringProp>
+          <stringProp name="HTTPSampler.FILE_NAME"></stringProp>
+          <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
+        </HTTPSampler>
+        <hashTree/>
+        <ResultCollector>
+          <stringProp name="TestElement.gui_class">org.apache.jmeter.visualizers.TableVisualizer</stringProp>
+          <stringProp name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</stringProp>
+          <stringProp name="TestElement.name">View Results in Table</stringProp>
+          <objProp>
+            <value class="org.apache.jmeter.samplers.SampleSaveConfiguration">
+              <time>true</time>
+              <latency>true</latency>
+              <timestamp>true</timestamp>
+              <success>true</success>
+              <label>true</label>
+              <code>true</code>
+              <message>true</message>
+              <threadName>true</threadName>
+              <dataType>true</dataType>
+              <encoding>false</encoding>
+              <assertions>true</assertions>
+              <subresults>true</subresults>
+              <responseData>false</responseData>
+              <samplerData>false</samplerData>
+              <xml>true</xml>
+              <fieldNames>false</fieldNames>
+              <responseHeaders>true</responseHeaders>
+              <requestHeaders>false</requestHeaders>
+              <responseDataOnError>false</responseDataOnError>
+              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+              <assertionsResultsToSave>0</assertionsResultsToSave>
+              <delimiter>,</delimiter>
+              <printMilliseconds>true</printMilliseconds>
+            </value>
+            <name>saveConfig</name>
+          </objProp>
+          <boolProp name="TestElement.enabled">true</boolProp>
+          <stringProp name="filename">/Users/andrus/Desktop/test.txt</stringProp>
+          <boolProp name="ResultCollector.error_logging">false</boolProp>
+        </ResultCollector>
+        <hashTree/>
+        <ResultCollector>
+          <stringProp name="TestElement.gui_class">org.apache.jmeter.visualizers.GraphVisualizer</stringProp>
+          <stringProp name="TestElement.test_class">org.apache.jmeter.reporters.ResultCollector</stringProp>
+          <stringProp name="TestElement.name">Graph Results</stringProp>
+          <objProp>
+            <value class="org.apache.jmeter.samplers.SampleSaveConfiguration">
+              <time>true</time>
+              <latency>true</latency>
+              <timestamp>true</timestamp>
+              <success>true</success>
+              <label>true</label>
+              <code>true</code>
+              <message>true</message>
+              <threadName>true</threadName>
+              <dataType>true</dataType>
+              <encoding>false</encoding>
+              <assertions>true</assertions>
+              <subresults>true</subresults>
+              <responseData>false</responseData>
+              <samplerData>false</samplerData>
+              <xml>true</xml>
+              <fieldNames>false</fieldNames>
+              <responseHeaders>false</responseHeaders>
+              <requestHeaders>false</requestHeaders>
+              <responseDataOnError>false</responseDataOnError>
+              <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+              <assertionsResultsToSave>0</assertionsResultsToSave>
+              <delimiter>,</delimiter>
+              <printMilliseconds>true</printMilliseconds>
+            </value>
+            <name>saveConfig</name>
+          </objProp>
+          <boolProp name="TestElement.enabled">true</boolProp>
+          <stringProp name="filename"></stringProp>
+          <boolProp name="ResultCollector.error_logging">false</boolProp>
+        </ResultCollector>
+        <hashTree/>
+      </hashTree>
+    </hashTree>
+  </hashTree>
+</jmeterTestPlan>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/cayenne.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/cayenne.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/cayenne.xml
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/cayenne.xml
Sat May 20 14:15:55 2006
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<domains project-version="1.1">
+<domain name="regression-profile">
+	<map name="regression-profile" location="regression-profile.map.xml"/>
+
+	<node name="regression-profile"
+		 datasource="regression-profile.driver.xml"
+		 factory="org.objectstyle.cayenne.conf.DriverDataSourceFactory">
+			<map-ref name="regression-profile"/>
+	 </node>
+</domain>
+</domains>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.driver.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.driver.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.driver.xml
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.driver.xml
Sat May 20 14:15:55 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<driver project-version="1.1" class="org.hsqldb.jdbcDriver">
+	<url value="jdbc:hsqldb:file:target/regression-db/db"/>
+	<connectionPool min="2" max="5" />
+	<login userName="sa"/>
+</driver>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.map.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.map.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.map.xml
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/resources/regression-profile.map.xml
Sat May 20 14:15:55 2006
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map project-version="1.1">
+	<property name="defaultPackage" value="org.apache.cayenne.profile.entity"/>
+	<db-entity name="ENTITY1">
+		<db-attribute name="DESCRIPTION" type="VARCHAR" length="1000"/>
+		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="NAME" type="VARCHAR" length="200"/>
+	</db-entity>
+	<obj-entity name="Entity1" className="org.apache.cayenne.profile.entity.Entity1" dbEntityName="ENTITY1">
+		<obj-attribute name="description" type="java.lang.String" db-attribute-path="DESCRIPTION"/>
+		<obj-attribute name="name" type="java.lang.String" db-attribute-path="NAME"/>
+	</obj-entity>
+</data-map>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/web.xml?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/web.xml
(added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/WEB-INF/web.xml
Sat May 20 14:15:55 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+    <display-name>Cayenne Regression Profiler</display-name>
+    
+    <filter>
+        <filter-name>CayenneFilter</filter-name>
+        <description>A filter that sets up Cayenne and intercepts requests that require
a web session</description>
+        <filter-class>org.apache.cayenne.profile.servlet.ProfileFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>CayenneFilter</filter-name>
+        <url-pattern>/profile/session/*</url-pattern>
+    </filter-mapping>
+    <servlet>
+        <servlet-name>ProfileServlet</servlet-name>
+        <description>Main profiler servlet that dispatches request to individual tests.</description>
+        <servlet-class>org.apache.cayenne.profile.servlet.ProfileServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>ProfileServlet</servlet-name>
+        <url-pattern>/profile/*</url-pattern>
+    </servlet-mapping>
+</web-app>

Added: incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/index.htm
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/index.htm?rev=408096&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/index.htm (added)
+++ incubator/cayenne/main/trunk/cayenne-regression-profiler/src/main/webapp/index.htm Sat
May 20 14:15:55 2006
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Nothing to see here</h2>
+</body>
+</html>



Mime
View raw message