public void testSecurityConfigurer() {
try {
System.setProperty("celtix.security.configurer.celtix.null",
"org.objectweb.celtix.bus.transports.https.SetAllDataSecurityDataProvider");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
TestHandler handler = new TestHandler();
JettySslListenerConfigurer jettySslListenerConfigurer =
createJettySslListenerConfigurer(sslServerPolicy,
"https://dummyurl",
handler);
jettySslListenerConfigurer.configure();
SslListener sslListener = jettySslListenerConfigurer.getSslListener();
assertTrue("Keystore not set properly",
sslListener.getKeystore().contains("resources/defaultkeystore"));
String trustStr = System.getProperty("javax.net.ssl.trustStore");
assertTrue("Trust store loaded success message not present",
trustStr.contains("resources/defaulttruststore"));
assertTrue("Keystore type not being read",
sslListener.getKeystoreType().equals("JKS"));
assertTrue("Keystore password not being read",
sslServerPolicy.getKeystorePassword().equals("defaultkeypass"));
assertTrue("Key password not being read",
sslServerPolicy.getKeyPassword().equals("defaultkeypass"));
assertTrue("Ciphersuites is not being read from the config provider",
sslListener.getCipherSuites()[0].equals("MyCipher"));
assertTrue("Truststore type not being read",
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "TrustStoreType"));
assertTrue("Secure socket protocol not being read",
handler.checkLogContainsString("The secure socket protocol has been set to TLSv1."));
assertTrue("Session caching set but no warning about not supported",
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "SessionCaching"));
assertTrue("SessionCacheKey caching set but no warning about not supported",
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "SessionCacheKey"));
assertTrue("MaxChainLength caching set but no warning about not supported",
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "MaxChainLength"));
assertTrue("CertValidator caching set but no warning about not supported",
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "CertValidator"));
System.setProperty("celtix.security.configurer.celtix.null",
"org.objectweb.celtix.bus.transports.https.DoesNotExistSetAllDataSecurityDataProvider");
SSLServerPolicy sslServerPolicy2 = new SSLServerPolicy();
TestHandler handler2 = new TestHandler();
EasyMock.reset(configuration);
configuration = EasyMock.createMock(Configuration.class);
JettySslListenerConfigurer jettySslListenerConfigurer2 =
createJettySslListenerConfigurer(sslServerPolicy2,
"https://dummyurl",
handler2);
sslServerPolicy2.setKeyPassword("test");
sslServerPolicy2.setKeystorePassword("test1");
jettySslListenerConfigurer2.configure();
assertTrue("Keystore not set properly",
handler2.checkLogContainsString("Failure invoking on custom security configurer "
+ "org.objectweb.celtix.bus.transports.https."