Search in sources :

Example 1 with JoynrJeeMessageContext

use of io.joynr.jeeintegration.context.JoynrJeeMessageContext in project joynr by bmwcarit.

the class JoynrJeeMessageContextTest method testContextRegistered.

@Test
public void testContextRegistered() {
    JoynrJeeMessageContext.getInstance().activate();
    Context result = beanManager.getContext(JoynrJeeMessageScoped.class);
    assertNotNull(result);
    assertTrue(result instanceof JoynrJeeMessageContext);
    JoynrJeeMessageContext.getInstance().deactivate();
    try {
        result = beanManager.getContext(JoynrJeeMessageScoped.class);
        fail("Shouldn't get it after deactivation.");
    } catch (ContextNotActiveException e) {
        logger.trace("Context not available after deactivation as expected.");
    }
}
Also used : Context(javax.enterprise.context.spi.Context) JoynrJeeMessageContext(io.joynr.jeeintegration.context.JoynrJeeMessageContext) ContextNotActiveException(javax.enterprise.context.ContextNotActiveException) JoynrJeeMessageContext(io.joynr.jeeintegration.context.JoynrJeeMessageContext) JoynrJeeMessageScoped(io.joynr.jeeintegration.api.JoynrJeeMessageScoped) Test(org.junit.Test)

Aggregations

JoynrJeeMessageScoped (io.joynr.jeeintegration.api.JoynrJeeMessageScoped)1 JoynrJeeMessageContext (io.joynr.jeeintegration.context.JoynrJeeMessageContext)1 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 Context (javax.enterprise.context.spi.Context)1 Test (org.junit.Test)1