Search in sources :

Example 1 with DummyProviderContext

use of com.att.cdp.zones.test.DummyProviderContext in project AJSC by att.

the class TestContextFactory method testMultipleContexts.

/**
 * This test ensures that we can create multiple contexts from the same provider
 */
@Test
public void testMultipleContexts() {
    try {
        Context context1 = ContextFactory.getContext(ProviderName, null);
        assertNotNull(context1);
        assertTrue(context1 instanceof DummyProviderContext);
        Provider provider = context1.getProvider();
        assertNotNull(provider);
        assertEquals(ProviderName, provider.getName());
        Context context2 = ContextFactory.getContext(ProviderName, null);
        assertNotNull(context2);
        assertFalse(context1 == context2);
        assertFalse(context1.equals(context2));
    } catch (NoProviderFoundException e) {
        fail("We were supposed to find the TestProvider!");
    }
}
Also used : DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) NoProviderFoundException(com.att.cdp.exceptions.NoProviderFoundException) DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) Test(org.junit.Test)

Example 2 with DummyProviderContext

use of com.att.cdp.zones.test.DummyProviderContext in project AJSC by att.

the class TestContextFactory method testNotLoggedIn.

/**
 * Validate that the provider is initially not logged in
 */
@Test
public void testNotLoggedIn() {
    try {
        Context context = ContextFactory.getContext(ProviderName, null);
        assertNotNull(context);
        assertTrue(context instanceof DummyProviderContext);
        assertFalse(context.isLoggedIn());
        IdentityService identity = context.getIdentityService();
        assertNotNull(identity);
    } catch (NoProviderFoundException e) {
        fail("We were supposed to find the TestProvider!");
    }
}
Also used : DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) NoProviderFoundException(com.att.cdp.exceptions.NoProviderFoundException) DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) Test(org.junit.Test)

Example 3 with DummyProviderContext

use of com.att.cdp.zones.test.DummyProviderContext in project AJSC by att.

the class TestContextFactory method testTestProvider.

/**
 * This test ensures that we can load the test provider and that we get a valid context object from it.
 */
@Test
public void testTestProvider() {
    try {
        Context context = ContextFactory.getContext(ProviderName, null);
        assertNotNull(context);
        assertTrue(context instanceof DummyProviderContext);
        Provider provider = context.getProvider();
        assertNotNull(provider);
        assertEquals(ProviderName, provider.getName());
    } catch (NoProviderFoundException e) {
        fail("We were supposed to find the TestProvider!");
    }
}
Also used : DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) NoProviderFoundException(com.att.cdp.exceptions.NoProviderFoundException) DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) Test(org.junit.Test)

Example 4 with DummyProviderContext

use of com.att.cdp.zones.test.DummyProviderContext in project AJSC by att.

the class TestContextFactory method testWithPropertiesConfiguration.

/**
 * Tests that we can use a properties object to configure the context.
 */
@Test
public void testWithPropertiesConfiguration() {
    String dummyPropertyName = "dummyPropertyName";
    String dummyPropertyValue = "dummyPropertyValue";
    try {
        Properties properties = new Properties();
        properties.setProperty(dummyPropertyName, dummyPropertyValue);
        Context context = ContextFactory.getContext(ProviderName, properties);
        assertNotNull(context);
        assertTrue(context instanceof DummyProviderContext);
        assertNotNull(context.getProperties());
        assertTrue(context.getProperties().containsKey(dummyPropertyName));
        assertEquals(dummyPropertyValue, context.getProperties().getProperty(dummyPropertyName));
    } catch (NoProviderFoundException e) {
        fail("We were supposed to find the TestProvider!");
    }
}
Also used : DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) NoProviderFoundException(com.att.cdp.exceptions.NoProviderFoundException) Properties(java.util.Properties) DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) Test(org.junit.Test)

Aggregations

NoProviderFoundException (com.att.cdp.exceptions.NoProviderFoundException)4 DummyProviderContext (com.att.cdp.zones.test.DummyProviderContext)4 Test (org.junit.Test)4 Properties (java.util.Properties)1