Add -P integration profile for tests involving broker
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.amqp</groupId>
|
||||
<artifactId>spring-amqp-parent</artifactId>
|
||||
@@ -35,6 +36,39 @@
|
||||
<maven.javadoc.skip>true</maven.javadoc.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>integration</id>
|
||||
<properties>
|
||||
<integration.test>true</integration.test>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>BROKER_INTEGRATION_TEST</name>
|
||||
<value>${integration.test}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
<useFile>false</useFile>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/Abstract*.java</exclude>
|
||||
</excludes>
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.springsource.bundlor</groupId>
|
||||
<artifactId>com.springsource.bundlor.maven</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>staging</id>
|
||||
<distributionManagement>
|
||||
@@ -78,10 +112,9 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<dependencyManagement>
|
||||
<!-- inheritable <dependency> declarations for child poms. children still
|
||||
must explicitly declare the groupId/artifactId of these dependencies in order
|
||||
for them to show up on the classpath, but metadata like <version> and <scope>
|
||||
are inherited, which cuts down on verbosity. see http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-dep-manage.html -->
|
||||
<!-- inheritable <dependency> declarations for child poms. children still must explicitly declare the groupId/artifactId
|
||||
of these dependencies in order for them to show up on the classpath, but metadata like <version> and <scope> are inherited,
|
||||
which cuts down on verbosity. see http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-dep-manage.html -->
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
@@ -248,10 +281,9 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- dependency definitions to be inherited by child poms. any <dependency>
|
||||
declarations here will automatically show up on child project classpaths.
|
||||
only items that are truly common across all projects (modules and samples)
|
||||
should go here. otherwise, consider <dependencyManagement> above -->
|
||||
<!-- dependency definitions to be inherited by child poms. any <dependency> declarations here will automatically show up
|
||||
on child project classpaths. only items that are truly common across all projects (modules and samples) should go here. otherwise,
|
||||
consider <dependencyManagement> above -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
@@ -262,8 +294,7 @@
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<!-- available only in the springframework maven repository. see <repositories>
|
||||
section below -->
|
||||
<!-- available only in the springframework maven repository. see <repositories> section below -->
|
||||
<groupId>org.springframework.build.aws</groupId>
|
||||
<artifactId>org.springframework.build.aws.maven</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
@@ -356,14 +387,11 @@
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- configures the springsource bundlor plugin, which generates OSGI-compatible
|
||||
MANIFEST.MF files during the 'compile' phase of the maven build. this plugin
|
||||
is declared within the pluginManagement section because not every module
|
||||
that inherits from this pom needs bundlor's services, e.g.: spring-integration-samples
|
||||
and all its children. for this reason, all modules that wish to use bundlor
|
||||
must declare it explicitly. it is not necessary to specify the <version>
|
||||
or <configuration> sections, but groupId and artifactId are required. see
|
||||
http://static.springsource.org/s2-bundlor/1.0.x/user-guide/html/ch04s03.html
|
||||
<!-- configures the springsource bundlor plugin, which generates OSGI-compatible MANIFEST.MF files during the 'compile'
|
||||
phase of the maven build. this plugin is declared within the pluginManagement section because not every module that inherits
|
||||
from this pom needs bundlor's services, e.g.: spring-integration-samples and all its children. for this reason, all modules
|
||||
that wish to use bundlor must declare it explicitly. it is not necessary to specify the <version> or <configuration> sections,
|
||||
but groupId and artifactId are required. see http://static.springsource.org/s2-bundlor/1.0.x/user-guide/html/ch04s03.html
|
||||
for more info -->
|
||||
<groupId>com.springsource.bundlor</groupId>
|
||||
<artifactId>com.springsource.bundlor.maven</artifactId>
|
||||
@@ -407,8 +435,7 @@
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- significantly speeds up the 'Dependencies' report during site creation
|
||||
see http://old.nabble.com/Skipping-dependency-report-during-Maven2-site-generation-td20116761.html -->
|
||||
<!-- significantly speeds up the 'Dependencies' report during site creation see http://old.nabble.com/Skipping-dependency-report-during-Maven2-site-generation-td20116761.html -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.amqp</groupId>
|
||||
@@ -25,7 +26,7 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring -->
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
@@ -114,12 +115,4 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.springsource.bundlor</groupId>
|
||||
<artifactId>com.springsource.bundlor.maven</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
@@ -12,12 +11,13 @@ import junit.framework.Assert;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.springframework.amqp.rabbit.test.BrokerTestUtils;
|
||||
import org.springframework.amqp.rabbit.test.EnvironmentAvailable;
|
||||
import org.springframework.erlang.connection.SingleConnectionFactory;
|
||||
import org.springframework.erlang.core.ErlangTemplate;
|
||||
import org.springframework.util.exec.Os;
|
||||
|
||||
import com.ericsson.otp.erlang.OtpConnection;
|
||||
import com.ericsson.otp.erlang.OtpErlangBinary;
|
||||
@@ -32,16 +32,32 @@ public class JInterfaceIntegrationTests {
|
||||
|
||||
private static int counter;
|
||||
|
||||
private static final String NODE_NAME = "spring@localhost";
|
||||
|
||||
private OtpConnection connection = null;
|
||||
|
||||
private RabbitBrokerAdmin brokerAdmin;
|
||||
|
||||
@Rule
|
||||
public static EnvironmentAvailable environment = new EnvironmentAvailable("BROKER_INTEGRATION_TEST");
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
brokerAdmin = BrokerTestUtils.getRabbitBrokerAdmin(NODE_NAME);
|
||||
RabbitStatus status = brokerAdmin.getStatus();
|
||||
if (!status.isRunning()) {
|
||||
brokerAdmin.startBrokerApplication();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void close() {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
if (brokerAdmin != null) {
|
||||
brokerAdmin.stopNode();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,7 +65,7 @@ public class JInterfaceIntegrationTests {
|
||||
|
||||
OtpSelf self = new OtpSelf("rabbit-monitor");
|
||||
|
||||
String hostName = "rabbit@" + getHostName();
|
||||
String hostName = NODE_NAME;
|
||||
OtpPeer peer = new OtpPeer(hostName);
|
||||
connection = self.connect(peer);
|
||||
|
||||
@@ -67,7 +83,7 @@ public class JInterfaceIntegrationTests {
|
||||
public void otpTemplate() throws UnknownHostException {
|
||||
|
||||
String selfNodeName = "rabbit-monitor";
|
||||
String peerNodeName = "rabbit@" + getHostName();
|
||||
String peerNodeName = NODE_NAME;
|
||||
|
||||
SingleConnectionFactory cf = new SingleConnectionFactory(selfNodeName, peerNodeName);
|
||||
|
||||
@@ -82,14 +98,6 @@ public class JInterfaceIntegrationTests {
|
||||
|
||||
}
|
||||
|
||||
private String getHostName() throws UnknownHostException {
|
||||
String hostName = InetAddress.getLocalHost().getHostName();
|
||||
if (Os.isFamily("windows")) {
|
||||
hostName = hostName.toUpperCase();
|
||||
}
|
||||
return hostName;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRawOtpConnect() throws Exception {
|
||||
createConnection();
|
||||
@@ -98,7 +106,7 @@ public class JInterfaceIntegrationTests {
|
||||
@Test
|
||||
public void stressTest() throws Exception {
|
||||
String cookie = readCookie();
|
||||
logger.info("Cookie: "+cookie);
|
||||
logger.info("Cookie: " + cookie);
|
||||
OtpConnection con = createConnection();
|
||||
boolean recycleConnection = false;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
@@ -115,7 +123,7 @@ public class JInterfaceIntegrationTests {
|
||||
|
||||
public OtpConnection createConnection() throws Exception {
|
||||
OtpSelf self = new OtpSelf("rabbit-monitor-" + counter++);
|
||||
OtpPeer peer = new OtpPeer("rabbit@" + getHostName());
|
||||
OtpPeer peer = new OtpPeer(NODE_NAME);
|
||||
return self.connect(peer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user