Skip to content

Commit

Permalink
simplify test dep, just trivially use artemis directly
Browse files Browse the repository at this point in the history
(cherry picked from commit ed62e5e) with fixups
  • Loading branch information
gemmellr committed Apr 26, 2023
1 parent 37f5a4c commit cae606c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 14 deletions.
21 changes: 11 additions & 10 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<description>Quarkus Qpid JMS integration tests module</description>

<properties>
<quarkus-test-artemis-version>1.0.5</quarkus-test-artemis-version>
<artemis-version>2.28.0</artemis-version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -58,14 +58,20 @@

<!-- Test Dependencies -->
<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-test-artemis</artifactId>
<version>${quarkus-test-artemis-version}</version>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${artemis-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-amqp-protocol</artifactId>
<version>${artemis-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jackson</artifactId>
<artifactId>quarkus-test-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -78,11 +84,6 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import static org.amqphub.quarkus.qpid.jms.it.QpidJmsTestSupport.ENDPOINT_PATH;

import org.amqphub.quarkus.qpid.jms.it.artemis.BrokerTestResource;

import javax.jms.JMSContext;
import javax.jms.JMSProducer;
import javax.jms.Queue;
Expand All @@ -25,14 +27,13 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import io.quarkus.artemis.test.ArtemisTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.response.Response;

@QuarkusTest
@QuarkusTestResource(ArtemisTestResource.class)
@QuarkusTestResource(BrokerTestResource.class)
public class QpidJmsReceiveTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import static org.amqphub.quarkus.qpid.jms.it.QpidJmsTestSupport.ENDPOINT_PATH;

import org.amqphub.quarkus.qpid.jms.it.artemis.BrokerTestResource;

import javax.jms.JMSConsumer;
import javax.jms.JMSContext;
import javax.jms.Queue;
Expand All @@ -25,14 +27,13 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import io.quarkus.artemis.test.ArtemisTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.response.Response;

@QuarkusTest
@QuarkusTestResource(ArtemisTestResource.class)
@QuarkusTestResource(BrokerTestResource.class)
public class QpidJmsSendTest {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2023 the original author or authors.
*
* 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.amqphub.quarkus.qpid.jms.it.artemis;

import java.io.File;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.Map;

import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
import org.apache.commons.io.FileUtils;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class BrokerTestResource implements QuarkusTestResourceLifecycleManager {

private EmbeddedActiveMQ embeddedBroker;

@Override
public Map<String, String> start() {
try {
// Matches what is defined in the broker.xml file in-tree.
File parentDir = Paths.get("./target/artemis").toFile();
FileUtils.deleteDirectory(parentDir);

embeddedBroker = new EmbeddedActiveMQ();
embeddedBroker.start();
} catch (Exception e) {
throw new RuntimeException("Problem starting embedded ActiveMQ Artemis broker", e);
}

return Collections.emptyMap();
}

@Override
public void stop() {
if (embeddedBroker == null) {
return;
}

try {
embeddedBroker.stop();
} catch (Exception e) {
throw new RuntimeException("Problem stopping embedded ActiveMQ Artemis broker", e);
}
}
}

0 comments on commit cae606c

Please sign in to comment.