Search in sources :

Example 1 with ContextManager

use of com.canoo.platform.core.context.ContextManager in project dolphin-platform by canoo.

the class ContextManagerImplTests method testRemoveGlobalContext.

@Test
public void testRemoveGlobalContext() {
    // given:
    final ContextManager manager = new ContextManagerImpl();
    // when:
    final Subscription subscription = manager.addGlobalContext("KEY", "VALUE");
    subscription.unsubscribe();
    // then:
    Assert.assertEquals(manager.getGlobalContexts().size(), 5);
    checkForGlobalContextMissing(manager, "KEY");
}
Also used : ContextManager(com.canoo.platform.core.context.ContextManager) ContextManagerImpl(com.canoo.dp.impl.platform.core.context.ContextManagerImpl) Subscription(com.canoo.platform.core.functional.Subscription) Test(org.testng.annotations.Test)

Example 2 with ContextManager

use of com.canoo.platform.core.context.ContextManager in project dolphin-platform by canoo.

the class ContextManagerImplTests method testOverrideGlobalContext.

@Test
public void testOverrideGlobalContext() {
    // given:
    final ContextManager manager = new ContextManagerImpl();
    // when:
    manager.addGlobalContext("KEY", "VALUE");
    manager.addGlobalContext("KEY", "VALUE-2");
    // then:
    Assert.assertEquals(manager.getGlobalContexts().size(), 6);
    checkForGlobalContext(manager, "KEY", "VALUE-2");
}
Also used : ContextManager(com.canoo.platform.core.context.ContextManager) ContextManagerImpl(com.canoo.dp.impl.platform.core.context.ContextManagerImpl) Test(org.testng.annotations.Test)

Example 3 with ContextManager

use of com.canoo.platform.core.context.ContextManager in project dolphin-platform by canoo.

the class ContextManagerImplTests method testGlobalContext.

@Test
public void testGlobalContext() {
    // given:
    final ContextManager manager = new ContextManagerImpl();
    // when:
    manager.addGlobalContext("KEY", "VALUE");
    // then:
    Assert.assertEquals(manager.getGlobalContexts().size(), 6);
    checkForGlobalContext(manager, "KEY", "VALUE");
}
Also used : ContextManager(com.canoo.platform.core.context.ContextManager) ContextManagerImpl(com.canoo.dp.impl.platform.core.context.ContextManagerImpl) Test(org.testng.annotations.Test)

Example 4 with ContextManager

use of com.canoo.platform.core.context.ContextManager in project dolphin-platform by canoo.

the class ContextManagerImplTests method testGlobalContextDefaults.

@Test
public void testGlobalContextDefaults() {
    // given:
    final ContextManager manager = new ContextManagerImpl();
    // then:
    Assert.assertEquals(manager.getGlobalContexts().size(), 5);
    checkForGlobalContext(manager, "hostName");
    checkForGlobalContext(manager, "platform.version");
    checkForGlobalContext(manager, "canonicalHostName");
    checkForGlobalContext(manager, "hostAddress");
    checkForGlobalContext(manager, "application.name");
}
Also used : ContextManager(com.canoo.platform.core.context.ContextManager) ContextManagerImpl(com.canoo.dp.impl.platform.core.context.ContextManagerImpl) Test(org.testng.annotations.Test)

Aggregations

ContextManagerImpl (com.canoo.dp.impl.platform.core.context.ContextManagerImpl)4 ContextManager (com.canoo.platform.core.context.ContextManager)4 Test (org.testng.annotations.Test)4 Subscription (com.canoo.platform.core.functional.Subscription)1