use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class ImpactProgagationRulesIT method testSimpleDownUpCase.
@Test
@DirtiesContext
public void testSimpleDownUpCase() throws Exception {
// 1. Assert empty workspace
resetFacts();
verifyFacts();
// 2. verify Impact on ComponentDownEvent
resetFacts();
resetEvents();
// component to request dependencies for
Component c = createComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)");
Event downEvent = createVpnPwDownEvent(17, m_pe2NodeId, "10.1.1.1", "5", "ge-3/1/4.50");
ComponentDownEvent cde = new ComponentDownEvent(c, downEvent);
anticipateFacts(cde, new ComponentImpacted(c, cde), new DependenciesNeeded(c, cde), new ImpactEventSent(c, cde));
anticipateEvent(createComponentImpactedEvent("ServiceElementComponent", "jnxVpnPw-vcid(50)", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)", 17));
// pretend to be a using rule that inserts the DependenciesNeeded fact
insertFactAndFireRules(cde);
verifyFacts();
verifyEvents();
// 3. Verify resolution and memory clean up on ComponentUpEvent
resetFacts();
resetEvents();
anticipateEvent(createComponentResolvedEvent("ServiceElementComponent", "jnxVpnPw-vcid(50)", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)", 17));
Event upEvent = createVpnPwUpEvent(17, m_pe2NodeId, "10.1.1.1", "5", "ge-3/1/4.50");
ComponentUpEvent cue = new ComponentUpEvent(c, upEvent);
anticipateFacts(cue);
insertFactAndFireRules(cue);
verifyFacts();
verifyEvents();
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class EventMappingRulesIT method testMapPwUp.
@Test
@DirtiesContext
public void testMapPwUp() throws Exception {
Event event = createVpnPwUpEvent(27, m_pe2NodeId, "10.1.1.1", "5", "ge-3/1/4.50");
testEventMapping(event, ComponentUpEvent.class, "ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)");
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class DependencyLoadingRulesIT method testSingleRequestToLoadDependenciesOfTypeAllAndWithdrawnTwice.
@Test
@DirtiesContext
public void testSingleRequestToLoadDependenciesOfTypeAllAndWithdrawnTwice() {
resetFacts();
// expect empty memory to start with
verifyFacts();
resetFacts();
// component to request dependencies for
Component b = createComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)");
DependenciesNeeded dependenciesNeeded = new DependenciesNeeded(b, "requestor1");
// this component depends on b
Component a = createComponent("ServiceElement", "NA-ServiceElement", "9876");
anticipateFacts(dependenciesNeeded, b, new DependsOn(a, b));
// pretend to be a using rule that inserts the DependenciesNeeded fact
FactHandle depsNeededHandle = insertFactAndFireRules(dependenciesNeeded);
verifyFacts();
resetFacts();
// simulate other rules retracting the dep
retractFactAndFireRules(depsNeededHandle);
// nothing anticipated... everything cleaned up
verifyFacts();
resetFacts();
anticipateFacts(dependenciesNeeded, b, new DependsOn(a, b));
depsNeededHandle = insertFactAndFireRules(dependenciesNeeded);
verifyFacts();
// Clean up facts
resetFacts();
// Expecting empty list
anticipateFacts();
// simulate retracting the dep
retractFactAndFireRules(depsNeededHandle);
verifyFacts();
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class DependencyLoadingRulesIT method testSingleRequestToLoadDependenciesOfTypeAllAndWithdrawn.
@Test
@DirtiesContext
public void testSingleRequestToLoadDependenciesOfTypeAllAndWithdrawn() {
resetFacts();
// expect empty memory to start with
verifyFacts();
resetFacts();
// component to request dependencies for
Component b = createComponent("ServiceElementComponent", "NA-SvcElemComp", "9876,jnxVpnPw-vcid(50)");
DependenciesNeeded dependenciesNeeded = new DependenciesNeeded(b, "requestor1");
// this component depends on b
Component a = createComponent("ServiceElement", "NA-ServiceElement", "9876");
anticipateFacts(dependenciesNeeded, b, new DependsOn(a, b));
// pretend to be a using rule that inserts the DependenciesNeeded fact
FactHandle depsNeededHandle = insertFactAndFireRules(dependenciesNeeded);
verifyFacts();
resetFacts();
// simulate other rules retracting the dep
retractFactAndFireRules(depsNeededHandle);
// nothing anticipated... everything cleaned up
verifyFacts();
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class EventMappingRulesIT method testMapMplsLspPathUp.
@Test
@DirtiesContext
public void testMapMplsLspPathUp() throws Exception {
Event event = createMplsLspPathUpEvent(37, m_pe2NodeId, "10.1.1.1", "lspA-PE2-PE1");
testEventMapping(event, ComponentUpEvent.class, "ServiceElementComponent", "NA-SvcElemComp", "9876,lspA-PE2-PE1");
}
Aggregations