tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1296895 - in /openejb/trunk/colossus/big-webapp-with-few-annotations: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/openejb/ src/main/java/org/apache/openejb/colossus/ src/main/java/...
Date Sun, 04 Mar 2012 23:15:55 GMT
Author: rmannibucau
Date: Sun Mar  4 23:15:54 2012
New Revision: 1296895

URL: http://svn.apache.org/viewvc?rev=1296895&view=rev
Log:
first big webapp with few annotations

Added:
    openejb/trunk/colossus/big-webapp-with-few-annotations/
    openejb/trunk/colossus/big-webapp-with-few-annotations/pom.xml
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/Main.java
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/web.xml
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/
    openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/MoveClassesTest.java

Added: openejb/trunk/colossus/big-webapp-with-few-annotations/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/colossus/big-webapp-with-few-annotations/pom.xml?rev=1296895&view=auto
==============================================================================
--- openejb/trunk/colossus/big-webapp-with-few-annotations/pom.xml (added)
+++ openejb/trunk/colossus/big-webapp-with-few-annotations/pom.xml Sun Mar  4 23:15:54 2012
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.openejb.colossus</groupId>
+  <artifactId>big-webapp-with-few-annotations</artifactId>
+  <version>1.0</version>
+  <packaging>war</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>6.0-2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.10</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.0.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.1.1</version>
+        <configuration>
+          <packagingExcludes>WEB-INF/classes/org/apache/openejb/colossus/generator/ejb/Main.class</packagingExcludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2.1</version>
+        <executions>
+          <execution>
+            <phase>compile</phase>
+            <goals>
+              <goal>java</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <mainClass>org.apache.openejb.colossus.generator.ejb.Main</mainClass>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Added: openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/Main.java
URL: http://svn.apache.org/viewvc/openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/Main.java?rev=1296895&view=auto
==============================================================================
--- openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/Main.java
(added)
+++ openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/java/org/apache/openejb/colossus/generator/ejb/Main.java
Sun Mar  4 23:15:54 2012
@@ -0,0 +1,84 @@
+package org.apache.openejb.colossus.generator.ejb;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class Main {
+    public static final String BASE_PACKAGE = "generated";
+    public static final String PACKAGE = BASE_PACKAGE + "/foo/bar";
+    public static final String GENERATED_FOLDER = "src/test/java/";
+    public static final String GENERATED_PACKAGE = GENERATED_FOLDER + PACKAGE;
+
+    public static void main(String[] args) {
+        generateEjbs(1000, 200, 5, 10);
+    }
+
+    private static void generateEjbs(int classNb, int mtdNb, int rsNb, int rsMtdNb) {
+        final File packageFile = new File(GENERATED_PACKAGE);
+        if (!packageFile.exists()) {
+            packageFile.mkdirs();
+        }
+
+        // pojo
+        for (int i = 0; i < classNb; i++) {
+            final StringBuilder s = new StringBuilder("package ").append(PACKAGE.replace("/",
"."))
+                    .append(";\n\n")
+                    .append("public class Foo").append(i).append(" {\n");
+
+            for (int i2 = 0; i2 < (i * Math.random()) % 100; i2++) {
+                s.append("  private final Foo").append(i2).append(" foo").append(i2)
+                        .append(" = new Foo").append(i2).append("();\n");
+            }
+
+            s.append("\n");
+
+            for (int k = 0; k < mtdNb; k++) {
+                s.append("    public String foo").append(k).append("() {\n")
+                        .append("        return getClass().getSimpleName();\n")
+                        .append("    }\n");
+            }
+            s.append("}\n");
+
+            try {
+                FileWriter writer = new FileWriter(GENERATED_PACKAGE + "/Foo" + i + ".java");
+                writer.write(s.toString());
+                writer.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        // annotated
+        for (int i = 0; i < rsNb; i++) {
+            final StringBuilder s = new StringBuilder("package ").append(PACKAGE.replace("/",
"."))
+                    .append(";\n\nimport javax.ws.rs.GET;\n")
+                    .append("import javax.ws.rs.Path;\n\n")
+                    .append("@Path(\"/foo-").append(i).append("\")\n")
+                    .append("public class RestFoo").append(i).append(" {\n");
+
+            for (int i2 = 0; i2 < Math.max(rsMtdNb, (classNb * Math.random()) % 100);
i2++) {
+                s.append("  private final Foo").append(i2).append(" foo").append(i2)
+                        .append(" = new Foo").append(i2).append("();\n");
+            }
+
+            s.append("\n");
+
+            for (int k = 0; k < rsMtdNb; k++) {
+                s.append("@Path(\"/mtd-").append(k).append("\") @GET\n")
+                        .append("    public String foo").append(k).append("() {\n")
+                        .append("        return foo").append(k).append(".getClass().getSimpleName();\n")
+                        .append("    }\n");
+            }
+            s.append("}\n");
+
+            try {
+                FileWriter writer = new FileWriter(GENERATED_PACKAGE + "/RestFoo" + i + ".java");
+                writer.write(s.toString());
+                writer.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}

Added: openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/web.xml?rev=1296895&view=auto
==============================================================================
--- openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/web.xml
(added)
+++ openejb/trunk/colossus/big-webapp-with-few-annotations/src/main/webapp/WEB-INF/web.xml
Sun Mar  4 23:15:54 2012
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+     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.
+  -->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         metadata-complete="false"
+         version="2.5">
+
+  <display-name>Example</display-name>
+</web-app>
\ No newline at end of file

Added: openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/MoveClassesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/MoveClassesTest.java?rev=1296895&view=auto
==============================================================================
--- openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/MoveClassesTest.java
(added)
+++ openejb/trunk/colossus/big-webapp-with-few-annotations/src/test/java/org/apache/openejb/colossus/generator/ejb/MoveClassesTest.java
Sun Mar  4 23:15:54 2012
@@ -0,0 +1,15 @@
+package org.apache.openejb.colossus.generator.ejb;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+public class MoveClassesTest {
+    @Test
+    public void moveGeneratedCompiledClassesToPackageClasses() throws IOException {
+        FileUtils.copyDirectory(new File("target/test-classes/" + Main.BASE_PACKAGE), new
File("target/classes/" + Main.BASE_PACKAGE));
+        FileUtils.deleteDirectory(new File("src/test/java/generated"));
+    }
+}



Mime
View raw message