All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.artemis.test.ArtemisTestResource Maven / Gradle / Ivy

Go to download

Module that will hold all tests resources that can will be usable by Quarkus developers and users of the framework

There is a newer version: 3.0.0.Beta1
Show newest version
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