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"));
}
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"));
}
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());
}
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());
}
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();
}
Aggregations