You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2011/07/21 12:27:36 UTC

svn commit: r1149100 - in /openejb/branches/openejb-3.2.x/container/openejb-activemq4: pom.xml src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java

Author: jlmonteiro
Date: Thu Jul 21 10:27:35 2011
New Revision: 1149100

URL: http://svn.apache.org/viewvc?rev=1149100&view=rev
Log:
Also apply ActiveMQ and MDB changes to activemq4 module. We should remove the duplicate code in that module. --> merge in openejb-activemq4 module

Modified:
    openejb/branches/openejb-3.2.x/container/openejb-activemq4/pom.xml
    openejb/branches/openejb-3.2.x/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java

Modified: openejb/branches/openejb-3.2.x/container/openejb-activemq4/pom.xml
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.2.x/container/openejb-activemq4/pom.xml?rev=1149100&r1=1149099&r2=1149100&view=diff
==============================================================================
--- openejb/branches/openejb-3.2.x/container/openejb-activemq4/pom.xml (original)
+++ openejb/branches/openejb-3.2.x/container/openejb-activemq4/pom.xml Thu Jul 21 10:27:35 2011
@@ -22,212 +22,228 @@
 
 <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/maven-v4_0_0.xsd">
-	<parent>
-		<artifactId>container</artifactId>
-		<groupId>org.apache.openejb</groupId>
-		<version>3.2.0-SNAPSHOT</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
-	<artifactId>openejb-activemq4</artifactId>
-	<packaging>jar</packaging>
-	<name>OpenEJB :: Container :: ActiveMQ4</name>
-	<properties>
-		<openejb.osgi.import.pkg>
-			org.apache.activemq.ra;resolution:=optional
-		</openejb.osgi.import.pkg>
-		<openejb.osgi.export/>
-	</properties>
-	<build>
-		<resources>
-			<resource>
-				<directory>src/main/resources</directory>
-				<filtering>true</filtering>
-			</resource>
-		</resources>
-		<testResources>
-			<testResource>
-				<directory>src/test/resources</directory>
-				<filtering>true</filtering>
-			</testResource>
-		</testResources>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>copy</id>
-						<phase>process-resources</phase>
-						<goals>
-							<goal>copy-dependencies</goal>
-						</goals>
-						<configuration>
-							<includeGroupIds>org.apache.openejb</includeGroupIds>
-							<includeArtifactIds>openejb-javaagent</includeArtifactIds>
-							<includeTypes>jar</includeTypes>
-							<excludeTransitive>true</excludeTransitive>
-							<outputDirectory>${project.build.directory}</outputDirectory>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<configuration>
-					<forkMode>pertest</forkMode>
-					<argLine>-Xmx256m "-javaagent:${basedir}/target/openejb-javaagent-${project.version}.jar" -enableassertions</argLine>
-					<workingDirectory>${basedir}/target</workingDirectory>
-					<systemProperties>
-						<property>
-							<name>openejb.home</name>
-							<value>${basedir}/target/test-classes</value>
-						</property>
-						<property>
-							<name>log4j.configuration</name>
-							<value>file:///${basedir}/target/classes/embedded.logging.properties</value>
-						</property>
-					</systemProperties>
-					<excludes>
-						<exclude>**/TestHandler.java</exclude>
-					</excludes>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-antrun-plugin</artifactId>
-				<executions>
-					<execution>
-						<phase>process-classes</phase>
-						<goals>
-							<goal>run</goal>
-						</goals>
-						<configuration>
-							<tasks>
-								<tstamp>
-									<format property="TSTAMP" pattern="hh:mm"/>
-								</tstamp>
-								<replace file="target/classes/openejb-version.properties" token="@DATE-REPLACED-BY-MAVEN@" value="${DSTAMP}"/>
-								<replace file="target/classes/openejb-version.properties" token="@TIME-REPLACED-BY-MAVEN@" value="${TSTAMP}"/>
-								<property name="compile_classpath" refid="maven.compile.classpath"/>
-								<java classname="org.apache.openejb.util.MakeTxLookup">
-									<arg value="${project.build.directory}"/>
-									<classpath>
-										<pathelement path="${compile_classpath}"/>
-									</classpath>
-								</java>
-							</tasks>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-jar-plugin</artifactId>
-				<configuration>
-					<archive>
-						<manifest>
-							<mainClass/>
-							<!--<addClasspath>true</addClasspath>-->
-						</manifest>
-						<manifestEntries/>
-					</archive>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.codehaus.mojo</groupId>
-				<artifactId>rat-maven-plugin</artifactId>
-				<configuration>
-					<excludes/>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-javaagent</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-			<groupId>org.apache.openejb</groupId>
-			<artifactId>openejb-core</artifactId>
-			<version>${project.version}</version>
-			<exclusions>
-				<!-- Ignore ActiveMQ 5.x-->
-				<exclusion>
-					<groupId>org.apache.activemq</groupId>
-					<artifactId>activemq-ra</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.apache.activemq</groupId>
-					<artifactId>activemq-core</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<!-- ActiveMQ -->
-		<dependency>
-			<groupId>org.apache.activemq</groupId>
-			<artifactId>activemq-ra</artifactId>
-			<version>4.1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.activemq</groupId>
-			<artifactId>activemq-core</artifactId>
-			<version>4.1.1</version>
-		</dependency>
-		<!-- End ActiveMQ -->
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring</artifactId>
-			<version>2.5.5</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xbean</groupId>
-			<artifactId>xbean-spring</artifactId>
-			<version>3.4.3</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>hsqldb</groupId>
-			<artifactId>hsqldb</artifactId>
-		</dependency>
-	</dependencies>
-	<profiles>
-		<profile>
-			<id>openejb.debug</id>
-			<build>
-				<plugins>
-					<plugin>
-						<groupId>org.apache.maven.plugins</groupId>
-						<artifactId>maven-surefire-plugin</artifactId>
-						<configuration>
-							<forkMode>pertest</forkMode>
-							<argLine>"-javaagent:${basedir}/target/openejb-javaagent-${project.version}.jar" -Xdebug -Xnoagent -Djava.compiler=NONE
-								-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
-							</argLine>
-							<workingDirectory>${basedir}/target</workingDirectory>
-							<systemProperties>
-								<property>
-									<name>openejb.home</name>
-									<value>${basedir}/target/test-classes</value>
-								</property>
-								<property>
-									<name>log4j.configuration</name>
-									<value>file:///${basedir}/target/classes/embedded.logging.properties</value>
-								</property>
-							</systemProperties>
-						</configuration>
-					</plugin>
-				</plugins>
-			</build>
-		</profile>
-	</profiles>
+  <parent>
+    <artifactId>container</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>3.2.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>openejb-activemq4</artifactId>
+  <packaging>jar</packaging>
+  <name>OpenEJB :: Container :: ActiveMQ4</name>
+  <properties>
+    <openejb.osgi.import.pkg>
+      org.apache.activemq.ra;resolution:=optional
+    </openejb.osgi.import.pkg>
+    <openejb.osgi.export/>
+  </properties>
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <includeGroupIds>org.apache.openejb</includeGroupIds>
+              <includeArtifactIds>openejb-javaagent</includeArtifactIds>
+              <includeTypes>jar</includeTypes>
+              <excludeTransitive>true</excludeTransitive>
+              <outputDirectory>${project.build.directory}</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+          <argLine>-Xmx256m "-javaagent:${basedir}/target/openejb-javaagent-${project.version}.jar" -enableassertions
+          </argLine>
+          <workingDirectory>${basedir}/target</workingDirectory>
+          <systemProperties>
+            <property>
+              <name>openejb.home</name>
+              <value>${basedir}/target/test-classes</value>
+            </property>
+            <property>
+              <name>log4j.configuration</name>
+              <value>file:///${basedir}/target/classes/embedded.logging.properties</value>
+            </property>
+          </systemProperties>
+          <excludes>
+            <exclude>**/TestHandler.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <tstamp>
+                  <format property="TSTAMP" pattern="hh:mm"/>
+                </tstamp>
+                <replace file="target/classes/openejb-version.properties" token="@DATE-REPLACED-BY-MAVEN@"
+                         value="${DSTAMP}"/>
+                <replace file="target/classes/openejb-version.properties" token="@TIME-REPLACED-BY-MAVEN@"
+                         value="${TSTAMP}"/>
+                <property name="compile_classpath" refid="maven.compile.classpath"/>
+                <java classname="org.apache.openejb.util.MakeTxLookup">
+                  <arg value="${project.build.directory}"/>
+                  <classpath>
+                    <pathelement path="${compile_classpath}"/>
+                  </classpath>
+                </java>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass/>
+              <!--<addClasspath>true</addClasspath>-->
+            </manifest>
+            <manifestEntries/>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <configuration>
+          <excludes/>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <!-- we do not use SFL4J internally but some dependencies come
+    with a bad version of slf4j-api that can produce a CNFE -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <!-- defined in scope test in parent, but it's useful -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-javaagent</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-core</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <!-- Ignore ActiveMQ 5.x-->
+        <exclusion>
+          <groupId>org.apache.activemq</groupId>
+          <artifactId>activemq-ra</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.activemq</groupId>
+          <artifactId>activemq-core</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- ActiveMQ -->
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-ra</artifactId>
+      <version>4.1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-core</artifactId>
+      <version>4.1.1</version>
+    </dependency>
+    <!-- End ActiveMQ -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>2.5.5</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-spring</artifactId>
+      <version>3.4.3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+    </dependency>
+  </dependencies>
+  <profiles>
+    <profile>
+      <id>openejb.debug</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <forkMode>pertest</forkMode>
+              <argLine>"-javaagent:${basedir}/target/openejb-javaagent-${project.version}.jar" -Xdebug -Xnoagent
+                -Djava.compiler=NONE
+                -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
+              </argLine>
+              <workingDirectory>${basedir}/target</workingDirectory>
+              <systemProperties>
+                <property>
+                  <name>openejb.home</name>
+                  <value>${basedir}/target/test-classes</value>
+                </property>
+                <property>
+                  <name>log4j.configuration</name>
+                  <value>file:///${basedir}/target/classes/embedded.logging.properties</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>
 

Modified: openejb/branches/openejb-3.2.x/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.2.x/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java?rev=1149100&r1=1149099&r2=1149100&view=diff
==============================================================================
--- openejb/branches/openejb-3.2.x/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java (original)
+++ openejb/branches/openejb-3.2.x/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsMdbContainerTest.java Thu Jul 21 10:27:35 2011
@@ -18,13 +18,14 @@ package org.apache.openejb.core.mdb;
 
 import junit.framework.TestCase;
 import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.ResourceInfo;
 import org.apache.openejb.assembler.classic.SecurityServiceInfo;
 import org.apache.openejb.assembler.classic.TransactionServiceInfo;
 import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.core.ivm.naming.InitContextFactory;
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.MessageDrivenBean;
-import static org.apache.openejb.util.Join.join;
+import org.apache.openejb.util.NetworkUtil;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
@@ -39,15 +40,19 @@ import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.naming.InitialContext;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Properties;
 import java.util.Stack;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import static org.apache.openejb.util.Join.join;
+
 /**
- * @version $Rev: 710022 $ $Date: 2008-11-03 09:40:14 +0100 (Mo, 03 Nov 2008) $
+ * @version $Rev: 710022 $ $Date: 2008-11-03 09:40:14 +0100 (lun., 03 nov. 2008) $
  */
 public class JmsMdbContainerTest extends TestCase {
     public void test() throws Exception {
@@ -56,8 +61,16 @@ public class JmsMdbContainerTest extends
         ConfigurationFactory config = new ConfigurationFactory();
         Assembler assembler = new Assembler();
 
+        // define props for RA in order to change the default activeMQ port
+        Properties props = new Properties();
+        String brokerAddress = NetworkUtil.getLocalAddress("tcp://", "");
+        String brokerXmlConfig = "broker:(" + brokerAddress + ")?useJmx=false";
+        props.put("BrokerXmlConfig", brokerXmlConfig);
+
         assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
         assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
+        assembler.createResource(config.configureService(ResourceInfo.class, "Default JMS Resource Adapter",
+                props, "Default JMS Resource Adapter", "ActiveMQResourceAdapter"));
 
         // Setup the descriptor information