Search in sources :

Example 71 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.

the class EventMappingRulesIT method testNodeUp.

@Test
@DirtiesContext
public void testNodeUp() throws Exception {
    Event event = createNodeUpEvent(17, m_pe1NodeId);
    testNodeEventMapping(event, ComponentUpEvent.class, findSubcomponentsOnNode(m_svc, "space", "1111-PE1"));
}
Also used : Event(org.opennms.netmgt.xml.event.Event) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 72 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.

the class EventMappingRulesIT method testNodeDown.

@Test
@DirtiesContext
public void testNodeDown() throws Exception {
    Event event = createNodeDownEvent(17, m_pe1NodeId);
    testNodeEventMapping(event, ComponentDownEvent.class, findSubcomponentsOnNode(m_svc, "space", "1111-PE1"));
}
Also used : Event(org.opennms.netmgt.xml.event.Event) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 73 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext 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 74 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext 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)

Example 75 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.

the class SpringSecurityUserDaoImplIT method testGetByUsernameTempUser.

@Test
@DirtiesContext
public void testGetByUsernameTempUser() throws Exception {
    final OnmsUser newUser = new OnmsUser("tempuser");
    newUser.setPassword("18126E7BD3F84B3F3E4DF094DEF5B7DE");
    m_userManager.save(newUser);
    final SpringSecurityUser user = ((SpringSecurityUserDao) m_springSecurityDao).getByUsername("tempuser");
    assertNotNull("user object should not be null", user);
    assertEquals("OnmsUser name", "tempuser", user.getUsername());
    assertEquals("Full name", null, user.getFullName());
    assertEquals("Comments", null, user.getComments());
    assertEquals("Password", "18126E7BD3F84B3F3E4DF094DEF5B7DE", user.getPassword());
    Collection<? extends GrantedAuthority> authorities = user.getAuthorities();
    assertNotNull("authorities should not be null", authorities);
    assertEquals("authorities size", 1, authorities.size());
    assertContainsAuthority(Authentication.ROLE_USER, authorities);
    assertNoWarningsOrGreater();
}
Also used : OnmsUser(org.opennms.netmgt.model.OnmsUser) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Aggregations

DirtiesContext (org.springframework.test.annotation.DirtiesContext)86 Test (org.junit.Test)83 Exchange (org.apache.camel.Exchange)21 Event (org.opennms.netmgt.xml.event.Event)19 Processor (org.apache.camel.Processor)11 DroolsCorrelationEngine (org.opennms.netmgt.correlation.drools.DroolsCorrelationEngine)10 IOException (java.io.IOException)9 NCSComponent (org.opennms.netmgt.model.ncs.NCSComponent)9 ProducerTemplate (org.apache.camel.ProducerTemplate)7 Ignore (org.junit.Ignore)7 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 LinkedHashMap (java.util.LinkedHashMap)5 CommonBindyTest (org.apache.camel.dataformat.bindy.CommonBindyTest)5 FactHandle (org.kie.api.runtime.rule.FactHandle)5 SnmpValueFactory (org.opennms.netmgt.snmp.SnmpValueFactory)5 Message (org.apache.camel.Message)4 BigDecimal (java.math.BigDecimal)3 Registration (org.opennms.core.soa.Registration)3