use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class EventMappingRulesIT method testMapMplsLspPathDown.
@Test
@DirtiesContext
public void testMapMplsLspPathDown() throws Exception {
Event event = createMplsLspPathDownEvent(37, m_pe2NodeId, "10.1.1.1", "lspA-PE2-PE1");
testEventMapping(event, ComponentDownEvent.class, "ServiceElementComponent", "NA-SvcElemComp", "9876,lspA-PE2-PE1");
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class EventMappingRulesIT method testMapPwDown.
@Test
@DirtiesContext
public void testMapPwDown() throws Exception {
Event event = createVpnPwDownEvent(17, m_pe2NodeId, "10.1.1.1", "5", "ge-3/1/4.50");
testEventMapping(event, ComponentDownEvent.class, "ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)");
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class DependencyRulesIT method testDependencyAnyRules.
@Test
@DirtiesContext
@Ignore("Non Deterministic!!!")
public void testDependencyAnyRules() throws Exception {
// Get engine
DroolsCorrelationEngine engine = findEngineByName("dependencyRules");
// Anticipate component lspA down event
getAnticipator().reset();
anticipate(createComponentImpactedEvent(findSubcomponent(m_svc, "NA-SvcElemComp", "8765,lspA-PE1-PE2"), 17));
// Generate down event
System.err.println("SENDING MplsLspPathDown on LspA EVENT!!");
engine.correlate(createMplsLspPathDownEvent(17, m_pe1NodeId, "10.1.1.1", "lspA-PE1-PE2"));
// Check lspA component impacted
getAnticipator().verifyAnticipated();
// Anticipate component lspB down event
// Parent should go down too
getAnticipator().reset();
anticipate(createComponentImpactedEvent(findSubcomponent(m_svc, "NA-SvcElemComp", "8765,lspB-PE1-PE2"), 18));
anticipate(createComponentImpactedEvent(findSubcomponent(m_svc, "NA-SvcElemComp", "8765,jnxVpnPw-vcid(50)"), 18));
anticipate(createComponentImpactedEvent(findSubcomponent(m_svc, "NA-ServiceElement", "8765"), 18));
anticipate(createComponentImpactedEvent(findSubcomponent(m_svc, "NA-Service", "123"), 18));
// Generate down event
System.err.println("SENDING MplsLspPathDown on LspB EVENT!!");
engine.correlate(createMplsLspPathDownEvent(18, m_pe1NodeId, "10.1.1.1", "lspB-PE1-PE2"));
// verify components were impacted
getAnticipator().verifyAnticipated();
// Anticipate impacted resolved when we send up event
getAnticipator().reset();
anticipate(createComponentResolvedEvent(findSubcomponent(m_svc, "NA-SvcElemComp", "8765,lspA-PE1-PE2"), 18));
anticipate(createComponentResolvedEvent(findSubcomponent(m_svc, "NA-SvcElemComp", "8765,jnxVpnPw-vcid(50)"), 18));
anticipate(createComponentResolvedEvent(findSubcomponent(m_svc, "NA-ServiceElement", "8765"), 18));
anticipate(createComponentResolvedEvent(findSubcomponent(m_svc, "NA-Service", "123"), 18));
// Generate up event
System.err.println("SENDING MplsLspPathUp on LspA EVENT!!");
engine.correlate(createMplsLspPathUpEvent(19, m_pe1NodeId, "10.1.1.1", "lspA-PE1-PE2"));
// verify components are resolved
getAnticipator().verifyAnticipated();
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class SpringSecurityUserDaoImplIT method testGetByUsernameDashboard.
@Test
@DirtiesContext
public void testGetByUsernameDashboard() throws Exception {
final OnmsUser newUser = new OnmsUser("dashboard");
newUser.setPassword("DC7161BE3DBF2250C8954E560CC35060");
newUser.getRoles().add(Authentication.ROLE_DASHBOARD);
m_userManager.save(newUser);
SpringSecurityUser user = ((SpringSecurityUserDao) m_springSecurityDao).getByUsername("dashboard");
assertNotNull("user object should not be null", user);
assertEquals("OnmsUser name", "dashboard", user.getUsername());
assertEquals("Full name", null, user.getFullName());
assertEquals("Comments", null, user.getComments());
assertEquals("Password", "DC7161BE3DBF2250C8954E560CC35060", user.getPassword());
Collection<? extends GrantedAuthority> authorities = user.getAuthorities();
assertNotNull("authorities should not be null", authorities);
assertEquals("authorities size", 1, authorities.size());
assertContainsAuthority(Authentication.ROLE_DASHBOARD, authorities);
assertNoWarningsOrGreater();
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class TrapHandlerITCase method testV2EnterpriseIdAndGenericAndSpecificAndMatchWithVarbinds.
@Test
@DirtiesContext
public void testV2EnterpriseIdAndGenericAndSpecificAndMatchWithVarbinds() throws Exception {
SnmpValueFactory valueFactory = SnmpUtils.getValueFactory();
LinkedHashMap<String, SnmpValue> varbinds = new LinkedHashMap<String, SnmpValue>();
varbinds.put(".1.3.6.1.4.1.11.2.14.11.1.7.2.1.4.2404", valueFactory.getInt32(3));
varbinds.put(".1.3.6.1.4.1.11.2.14.11.1.7.2.1.5.2404", valueFactory.getInt32(2));
varbinds.put(".1.3.6.1.4.1.11.2.14.11.1.7.2.1.6.2404", valueFactory.getInt32(5));
varbinds.put(".1.3.6.1.4.1.11.2.14.11.1.7.3.0.2404", valueFactory.getOctetString("http://a.b.c.d/cgi/fDetail?index=2404".getBytes()));
anticipateAndSend(false, true, "uei.opennms.org/vendor/HP/traps/hpicfFaultFinderTrap", "v2c", ".1.3.6.1.4.1.11.2.14.12.1", 6, 5, varbinds);
}
Aggregations