use of org.springframework.test.annotation.DirtiesContext in project spring-security by spring-projects.
the class DelegatingAuthenticationEntryPointContextTests method testDefaultAEP.
@Test
@DirtiesContext
public void testDefaultAEP() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRemoteAddr("192.168.1.10");
daep.commence(request, null, null);
verify(defaultAEP).commence(request, null, null);
verify(firstAEP, never()).commence(any(HttpServletRequest.class), any(HttpServletResponse.class), any(AuthenticationException.class));
}
use of org.springframework.test.annotation.DirtiesContext in project cas by apereo.
the class WsFederationHelperTests method verifyValidateSignatureBadKey.
@Test
@DirtiesContext
public void verifyValidateSignatureBadKey() throws Exception {
final List<Credential> signingWallet = new ArrayList<>();
final WsFederationConfiguration cfg = new WsFederationConfiguration();
cfg.setSigningCertificateResources(ctx.getResource("classpath:bad-signing.crt"));
signingWallet.addAll(cfg.getSigningCertificates());
final String wresult = testTokens.get(GOOD_TOKEN);
final Assertion assertion = wsFederationHelper.parseTokenFromString(wresult, wsFedConfig);
wsFedConfig.getSigningCertificates().clear();
wsFedConfig.getSigningCertificates().addAll(signingWallet);
final boolean result = wsFederationHelper.validateSignature(assertion, wsFedConfig);
assertFalse("testValidateSignatureModifiedKey() - False", result);
}
use of org.springframework.test.annotation.DirtiesContext 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());
}
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);
}
use of org.springframework.test.annotation.DirtiesContext in project opennms by OpenNMS.
the class TrapHandlerITCase method testV1TrapOIDWildCardMatch.
@Test
@DirtiesContext
public void testV1TrapOIDWildCardMatch() throws Exception {
SnmpValueFactory valueFactory = SnmpUtils.getValueFactory();
LinkedHashMap<String, SnmpValue> varbinds = new LinkedHashMap<String, SnmpValue>();
varbinds.put(".1.3.6.1.4.1.32473.42.42.42", valueFactory.getInt32(42));
anticipateAndSend(false, true, "uei.opennms.org/IANA/Example/traps/exampleEnterpriseTrap", "v1", ".1.3.6.1.4.1.32473.42", 6, 5, varbinds);
}
Aggregations