Search in sources :

Example 1 with MyProvider

use of org.opennms.core.soa.support.MyProvider in project opennms by OpenNMS.

the class NamespaceHandlerTest method testRegistrationListenerBeanDefinition.

@Test
@DirtiesContext
public void testRegistrationListenerBeanDefinition() {
    assertNotNull(m_helloListListener);
    MyProvider myProvider = new MyProvider();
    int expected = m_helloListListener.getTotalProviders() + 1;
    Registration registration = m_defaultServiceRegistry.register(myProvider, Hello.class);
    assertEquals(expected, m_helloListListener.getTotalProviders());
    expected = m_helloListListener.getTotalProviders() - 1;
    registration.unregister();
    assertEquals(expected, m_helloListListener.getTotalProviders());
}
Also used : MyProvider(org.opennms.core.soa.support.MyProvider) Registration(org.opennms.core.soa.Registration) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 2 with MyProvider

use of org.opennms.core.soa.support.MyProvider in project opennms by OpenNMS.

the class NamespaceHandlerTest method testFilteredReferenceListBeanDefinition.

@Test
@DirtiesContext
public void testFilteredReferenceListBeanDefinition() {
    assertNotNull(m_bigGoodbyeList);
    int expected = m_bigGoodbyeList.size() + 1;
    Map<String, String> bigProps = new HashMap<String, String>();
    bigProps.put("size", "big");
    Registration bigRegistration = m_defaultServiceRegistry.register(new MyProvider("alsoBig"), bigProps, Goodbye.class);
    Map<String, String> props = new HashMap<String, String>();
    props.put("size", "small");
    Registration smallRegistration = m_defaultServiceRegistry.register(new MyProvider("alsoSmall"), props, Goodbye.class);
    assertEquals(expected, m_bigGoodbyeList.size());
    expected = m_bigGoodbyeList.size() - 1;
    bigRegistration.unregister();
    smallRegistration.unregister();
    assertEquals(expected, m_bigGoodbyeList.size());
}
Also used : MyProvider(org.opennms.core.soa.support.MyProvider) HashMap(java.util.HashMap) Registration(org.opennms.core.soa.Registration) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 3 with MyProvider

use of org.opennms.core.soa.support.MyProvider in project opennms by OpenNMS.

the class NamespaceHandlerTest method testReferenceListBeanDefinition.

@Test
@DirtiesContext
public void testReferenceListBeanDefinition() {
    assertNotNull(m_helloList);
    int expected = m_helloList.size() + 1;
    Registration registration = m_defaultServiceRegistry.register(new MyProvider(), Hello.class);
    assertEquals(expected, m_helloList.size());
    expected = m_helloList.size() - 1;
    registration.unregister();
    assertEquals(expected, m_helloList.size());
}
Also used : MyProvider(org.opennms.core.soa.support.MyProvider) Registration(org.opennms.core.soa.Registration) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Aggregations

Test (org.junit.Test)3 Registration (org.opennms.core.soa.Registration)3 MyProvider (org.opennms.core.soa.support.MyProvider)3 DirtiesContext (org.springframework.test.annotation.DirtiesContext)3 HashMap (java.util.HashMap)1