io.quarkus.artemis.test.ArtemisTestResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-test-artemis Show documentation
Show all versions of quarkus-test-artemis Show documentation
Module that will hold all tests resources that can will be usable by Quarkus developers and users of the framework
package io.quarkus.artemis.test;
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 ArtemisTestResource implements QuarkusTestResourceLifecycleManager {
private EmbeddedActiveMQ embedded;
@Override
public Map start() {
try {
FileUtils.deleteDirectory(Paths.get("./target/artemis").toFile());
embedded = new EmbeddedActiveMQ();
embedded.start();
} catch (Exception e) {
throw new RuntimeException("Could not start embedded ActiveMQ server", e);
}
return Collections.emptyMap();
}
@Override
public void stop() {
if (embedded == null) {
return;
}
try {
embedded.stop();
} catch (Exception e) {
throw new RuntimeException("Could not stop embedded ActiveMQ server", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy