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

io.quarkus.arc.runtime.ArcTestRequestScopeProvider Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package io.quarkus.arc.runtime;

import org.jboss.logging.Logger;

import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
import io.quarkus.runtime.test.TestScopeSetup;

public class ArcTestRequestScopeProvider implements TestScopeSetup {

    private static final Logger LOGGER = Logger.getLogger(ArcTestRequestScopeProvider.class);

    @Override
    public void setup(boolean isIntegrationTest) {
        if (isIntegrationTest) {
            return;
        }
        ArcContainer container = Arc.container();
        if (container == null) {
            LOGGER.warn("Container not available, ignoring setup");
        } else {
            container.requestContext().activate();
        }

    }

    @Override
    public void tearDown(boolean isIntegrationTest) {
        if (isIntegrationTest) {
            return;
        }
        ArcContainer container = Arc.container();
        if (container == null) {
            LOGGER.warn("Container not available, ignoring tearDown");
        } else {
            container.requestContext().terminate();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy