-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f272eac
commit fe00501
Showing
30 changed files
with
522 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM node:16.19.0 as base | ||
FROM atools/jdk-maven-node:mvn3-jdk11-node16 as base | ||
|
||
WORKDIR /code | ||
|
||
COPY package.json package.json | ||
COPY run-amqp10-roundtriptest run-amqp10-roundtriptest | ||
|
||
FROM base as test | ||
RUN npm install | ||
RUN mkdir -p /code/amqp10-roundtriptest | ||
COPY amqp10-roundtriptest /code/amqp10-roundtriptest | ||
RUN mvn -f /code/amqp10-roundtriptest package | ||
|
||
ENTRYPOINT [ "npm" ] | ||
CMD [ "" ] |
103 changes: 103 additions & 0 deletions
103
deps/rabbitmq_management/selenium/amqp10-roundtriptest/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<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 https://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.rabbitmq.amqp1_0</groupId> | ||
<artifactId>amqp10-roundtriptest</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>amqp10-roundtriptest</name> | ||
<url>https://www.rabbitmq.com</url> | ||
<properties> | ||
<junit.jupiter.version>5.9.3</junit.jupiter.version> | ||
<qpid-jms-client.version>2.3.0</qpid-jms-client.version> | ||
<logback.version>1.2.11</logback.version> | ||
<spotless.version>2.24.0</spotless.version> | ||
<google-java-format.version>1.17.0</google-java-format.version> | ||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> | ||
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
|
||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.qpid</groupId> | ||
<artifactId>qpid-jms-client</artifactId> | ||
<version>${qpid-jms-client.version}</version> | ||
|
||
</dependency> | ||
|
||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback.version}</version> | ||
|
||
</dependency> | ||
|
||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven-compiler-plugin.version}</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.rabbitmq.amqp1_0.RoundTripTest</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.rabbitmq.amqp1_0.RoundTripTest</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>com.diffplug.spotless</groupId> | ||
<artifactId>spotless-maven-plugin</artifactId> | ||
<version>${spotless.version}</version> | ||
<configuration> | ||
<java> | ||
<googleJavaFormat> | ||
<version>${google-java-format.version}</version> | ||
<style>GOOGLE</style> | ||
</googleJavaFormat> | ||
</java> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
</project> |
58 changes: 58 additions & 0 deletions
58
...ement/selenium/amqp10-roundtriptest/src/main/java/com/rabbitmq/amqp1_0/RoundTripTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// vim:sw=4:et: | ||
|
||
package com.rabbitmq.amqp1_0; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import jakarta.jms.*; | ||
import java.util.*; | ||
import javax.naming.Context; | ||
|
||
/** Unit test for simple App. */ | ||
public class RoundTripTest { | ||
|
||
public static String getEnv(String property, String defaultValue) { | ||
return System.getenv(property) == null ? defaultValue : System.getenv(property); | ||
} | ||
public static void main(String args[]) throws Exception { | ||
String hostname = getEnv("RABBITMQ_HOSTNAME", "localhost"); | ||
String port = getEnv("RABBITMQ_AMQP_PORT", "5672"); | ||
String scheme = getEnv("RABBITMQ_AMQP_SCHEME", "amqp"); | ||
String username = getEnv("RABBITMQ_AMQP_USERNAME", "guest"); | ||
String password = getEnv("RABBITMQ_AMQP_PASSWORD", "guest"); | ||
String uri = scheme + "://" + hostname + ":" + port; | ||
|
||
Hashtable<Object, Object> env = new Hashtable<>(); | ||
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory"); | ||
env.put("connectionfactory.myFactoryLookup", uri); | ||
env.put("queue.myQueueLookup", "my-queue"); | ||
env.put("jms.sendTimeout", 5); | ||
env.put("jms.requestTimeout", 5); | ||
javax.naming.Context context = new javax.naming.InitialContext(env); | ||
|
||
assertNotNull(uri); | ||
|
||
ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup"); | ||
Destination queue = (Destination) context.lookup("myQueueLookup"); | ||
|
||
try (Connection connection = factory.createConnection(username, password)) { | ||
connection.start(); | ||
|
||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); | ||
|
||
MessageProducer messageProducer = session.createProducer(queue); | ||
MessageConsumer messageConsumer = session.createConsumer(queue); | ||
|
||
TextMessage message = session.createTextMessage("Hello world!"); | ||
messageProducer.send( | ||
message, | ||
DeliveryMode.NON_PERSISTENT, | ||
Message.DEFAULT_PRIORITY, | ||
Message.DEFAULT_TIME_TO_LIVE); | ||
TextMessage receivedMessage = (TextMessage) messageConsumer.receive(2000L); | ||
|
||
assertEquals(message.getText(), receivedMessage.getText()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
#set -x | ||
|
||
TEST_PATH=${1:?First parameter is the directory env and config files are relative to} | ||
ENV_FILE=${2:?Second parameter is a comma-separated list of .env file which has exported template variables} | ||
FINAL_CONFIG_FILE=${3:?Forth parameter is the name of the final config file. It is relative to where this script is run from} | ||
|
||
source $ENV_FILE | ||
|
||
parentdir="$(dirname "$FINAL_CONFIG_FILE")" | ||
mkdir -p $parentdir | ||
|
||
echo "" > $FINAL_CONFIG_FILE | ||
|
||
FOUND_TEMPLATES_COUNT=0 | ||
for f in $($SCRIPT/find-template-files $TEST_PATH "advanced" "config") | ||
do | ||
envsubst < $f >> $FINAL_CONFIG_FILE | ||
FOUND_TEMPLATES_COUNT+=1 | ||
done | ||
|
||
if [ "$FOUND_TEMPLATES_COUNT" -gt 1 ] | ||
then | ||
echo "Matched $FOUND_TEMPLATES_COUNT advanced.config files. There should only match one" | ||
exit -1 | ||
fi | ||
if [ "$FOUND_TEMPLATES_COUNT" -lt 1 ] | ||
then | ||
exit -1 | ||
fi |
Oops, something went wrong.