You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/03/19 04:55:35 UTC
svn commit: r519822 - in /incubator/cxf/trunk/rt/transports/http: ./
src/test/java/org/apache/cxf/transport/http/
src/test/java/org/apache/cxf/transport/http/spring/
src/test/java/org/apache/cxf/transport/https/
Author: ningjiang
Date: Sun Mar 18 20:55:34 2007
New Revision: 519822
URL: http://svn.apache.org/viewvc?view=rev&rev=519822
Log:
Changed the HTTP module's unit test to JUnit4 style
Modified:
incubator/cxf/trunk/rt/transports/http/pom.xml
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPServerEngineTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/ApplicationContextTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/BeanDefinitionParsersTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java
incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
Modified: incubator/cxf/trunk/rt/transports/http/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/pom.xml?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http/pom.xml Sun Mar 18 20:55:34 2007
@@ -22,7 +22,7 @@
<artifactId>cxf-rt-transports-http</artifactId>
<packaging>jar</packaging>
<version>2.0-incubator-RC-SNAPSHOT</version>
- <name>Apache CXF Runtime HTTP transport (version2)</name>
+ <name>Apache CXF Runtime HTTP transport</name>
<url>http://cwiki.apache.org/CXF</url>
<parent>
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Sun Mar 18 20:55:34 2007
@@ -36,8 +36,6 @@
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
-import junit.framework.TestCase;
-
import org.apache.cxf.bus.CXFBusImpl;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.helpers.CastUtils;
@@ -52,11 +50,15 @@
import org.apache.cxf.wsdl.EndpointReferenceUtils;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE;
-public class HTTPConduitTest extends TestCase {
+public class HTTPConduitTest extends Assert {
private static final String NOWHERE = "http://nada.nothing.nowhere.null/";
private static final String PAYLOAD = "message payload";
private EndpointReferenceType target;
@@ -70,10 +72,12 @@
private ServletInputStream is;
private IMocksControl control;
+ @Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
}
-
+
+ @After
public void tearDown() {
// avoid intermittent spurious failures on EasyMock detecting finalize
// calls by mocking up only class data members (no local variables)
@@ -88,6 +92,7 @@
is = null;
}
+ @Test
public void testGetTarget() throws Exception {
HTTPConduit conduit = setUpConduit(false);
EndpointReferenceType ref = conduit.getTarget();
@@ -100,6 +105,7 @@
"/bar/foo");
}
+ @Test
public void testSend() throws Exception {
HTTPConduit conduit = setUpConduit(true, false, false);
Message message = new MessageImpl();
@@ -107,6 +113,7 @@
verifySentMessage(conduit, message);
}
+ @Test
public void testSendWithHeaders() throws Exception {
HTTPConduit conduit = setUpConduit(true, false, false);
Message message = new MessageImpl();
@@ -115,6 +122,7 @@
verifySentMessage(conduit, message, true);
}
+ @Test
public void testSendHttpConnection() throws Exception {
HTTPConduit conduit = setUpConduit(true, true, false);
Message message = new MessageImpl();
@@ -122,6 +130,7 @@
verifySentMessage(conduit, message);
}
+ @Test
public void testSendHttpConnectionAutoRedirect() throws Exception {
HTTPConduit conduit = setUpConduit(true, true, true);
Message message = new MessageImpl();
@@ -129,12 +138,14 @@
verifySentMessage(conduit, message);
}
+ @Test
public void testSendDecoupled() throws Exception {
HTTPConduit conduit = setUpConduit(true, false, false, true);
Message message = new MessageImpl();
conduit.send(message);
verifySentMessage(conduit, message, false, true);
}
+
private void setUpHeaders(Message message) {
Map<String, List<String>> headers = new HashMap<String, List<String>>();
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java Sun Mar 18 20:55:34 2007
@@ -19,19 +19,20 @@
package org.apache.cxf.transport.http;
-import junit.framework.TestCase;
-
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mortbay.jetty.handler.ContextHandler;
-
-
-public class JettyContextInspectorTest extends TestCase {
+public class JettyContextInspectorTest extends Assert {
private static final String CONTEXT_PATH = "/foo/bar";
private ContextHandler context;
private IMocksControl control;
+ @Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
context = control.createMock(ContextHandler.class);
@@ -40,12 +41,14 @@
control.replay();
}
+ @After
public void tearDown() {
control.verify();
control = null;
context = null;
}
+ @Test
public void testGetAddress() throws Exception {
JettyContextInspector inspector = new JettyContextInspector();
assertEquals("unexpected address",
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java Sun Mar 18 20:55:34 2007
@@ -31,8 +31,6 @@
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
-import junit.framework.TestCase;
-
import org.apache.cxf.Bus;
import org.apache.cxf.bus.CXFBusImpl;
import org.apache.cxf.common.util.Base64Utility;
@@ -56,11 +54,14 @@
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.apache.cxf.wsdl.EndpointReferenceUtils;
import org.easymock.classextension.EasyMock;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
import org.mortbay.jetty.HttpFields;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Response;
-public class JettyHTTPDestinationTest extends TestCase {
+public class JettyHTTPDestinationTest extends Assert {
protected static final String AUTH_HEADER = "Authorization";
protected static final String USER = "copernicus";
protected static final String PASSWD = "epicycles";
@@ -93,11 +94,7 @@
private QueryHandlerRegistry queryHandlerRegistry;
private List<QueryHandler> queryHandlerList;
-
- public void setUp() throws Exception {
-
- }
-
+ @After
public void tearDown() {
bus = null;
@@ -114,6 +111,8 @@
os = null;
destination = null;
}
+
+ @Test
public void testGetAddress() throws Exception {
destination = setUpDestination();
EndpointReferenceType ref = destination.getAddress();
@@ -122,12 +121,15 @@
EndpointReferenceUtils.getAddress(ref),
StringUtils.addDefaultPortIfMissing(EndpointReferenceUtils.getAddress(address)));
}
+
+ @Test
public void testRemoveServant() throws Exception {
destination = setUpDestination();
setUpRemoveServant();
destination.setMessageObserver(null);
}
+ @Test
public void testDoServiceRedirectURL() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(true);
@@ -135,6 +137,7 @@
}
+ @Test
public void testDoService() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false);
@@ -142,6 +145,7 @@
verifyDoService();
}
+ @Test
public void testDoServiceWithHttpGET() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false,
@@ -165,6 +169,7 @@
}
+ @Test
public void testDoServiceWithHttpGETandQueryWSDL() throws Exception {
destination = setUpDestination(false, true);
setUpDoService(false,
@@ -180,6 +185,7 @@
}
+ @Test
public void testGetAnonBackChannel() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false);
@@ -195,6 +201,7 @@
backChannel.getTarget().getAddress().getValue());
}
+ @Test
public void testGetBackChannelSend() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true);
@@ -207,6 +214,7 @@
verifyBackChannelSend(backChannel, outMessage, 200);
}
+ @Test
public void testGetBackChannelSendFault() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, 500);
@@ -219,6 +227,7 @@
verifyBackChannelSend(backChannel, outMessage, 500);
}
+ @Test
public void testGetBackChannelSendOneway() throws Exception {
destination = setUpDestination(false, false);
setUpDoService(false, true, 500);
@@ -231,6 +240,7 @@
verifyBackChannelSend(backChannel, outMessage, 500, true);
}
+ @Test
public void testGetBackChannelSendDecoupled() throws Exception {
destination = setUpDestination(false, false);
replyTo = getEPR(NOWHERE + "response/foo");
@@ -256,6 +266,7 @@
fullBackChannel.send(outMessage);
}
+ @Test
public void testServerPolicyInServiceModel()
throws Exception {
policy = new HTTPServerPolicy();
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPServerEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPServerEngineTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPServerEngineTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPServerEngineTest.java Sun Mar 18 20:55:34 2007
@@ -19,7 +19,6 @@
package org.apache.cxf.transport.http;
-import junit.framework.TestCase;
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
@@ -27,17 +26,22 @@
import org.apache.cxf.configuration.spring.ConfigurerImpl;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class JettyHTTPServerEngineTest extends TestCase {
+public class JettyHTTPServerEngineTest extends Assert {
private Bus bus;
private IMocksControl control;
+ @Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
}
+ @Test
public void testEngineEquality() {
setUpConfigurer(null);
@@ -51,6 +55,7 @@
JettyHTTPServerEngine.destroyForPort(1235);
}
+ @Test
public void testNoSSLServerPolicySet() {
setUpConfigurer(null);
@@ -67,6 +72,7 @@
JettyHTTPServerEngine.destroyForPort(1235);
}
+ @Test
public void testDestinationSSLServerPolicy() {
setUpConfigurer(null);
@@ -85,6 +91,7 @@
JettyHTTPServerEngine.destroyForPort(1234);
}
+ @Test
public void testSSLServerPolicySetFromConfig() {
setUpConfigurer("/org/apache/cxf/transport/http/cxfcfg.xml");
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/ApplicationContextTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/ApplicationContextTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/ApplicationContextTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/ApplicationContextTest.java Sun Mar 18 20:55:34 2007
@@ -20,7 +20,6 @@
import javax.xml.namespace.QName;
-import junit.framework.TestCase;
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
@@ -33,9 +32,12 @@
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.JettyHTTPDestination;
+import org.junit.Assert;
+import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-public class ApplicationContextTest extends TestCase {
+public class ApplicationContextTest extends Assert {
+ @Test
public void testContext() throws Exception {
String s1 = getClass().getResource("/META-INF/cxf/cxf.xml").toString();
String s2 = getClass().getResource("/META-INF/cxf/cxf-extension-http.xml").toString();
@@ -63,7 +65,7 @@
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
ConduitInitiator ci = cim.getConduitInitiator("http://schemas.xmlsoap.org/soap/http");
HTTPConduit conduit = (HTTPConduit) ci.getConduit(info);
- assertEquals(97, conduit.getClient().getConnectionTimeout());
+ assertEquals(97, conduit.getClient().getConnectionTimeout(), 0);
}
}
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/BeanDefinitionParsersTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/BeanDefinitionParsersTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/BeanDefinitionParsersTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/BeanDefinitionParsersTest.java Sun Mar 18 20:55:34 2007
@@ -20,15 +20,16 @@
import org.w3c.dom.Document;
-import junit.framework.TestCase;
-
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.junit.Assert;
+import org.junit.Test;
import org.springframework.beans.PropertyValue;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-public class BeanDefinitionParsersTest extends TestCase {
+public class BeanDefinitionParsersTest extends Assert {
+ @Test
public void testDest()throws Exception {
BeanDefinitionBuilder bd = BeanDefinitionBuilder.childBeanDefinition("child");
@@ -43,6 +44,7 @@
assertEquals("exact", pvs[1].getValue());
}
+ @Test
public void testConduit()throws Exception {
BeanDefinitionBuilder bd = BeanDefinitionBuilder.childBeanDefinition("child");
@@ -53,6 +55,6 @@
PropertyValue[] pvs = bd.getRawBeanDefinition().getPropertyValues().getPropertyValues();
assertEquals(1, pvs.length);
- assertEquals(97, ((HTTPClientPolicy) pvs[0].getValue()).getConnectionTimeout());
+ assertEquals(97, ((HTTPClientPolicy) pvs[0].getValue()).getConnectionTimeout(), 0);
}
}
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java Sun Mar 18 20:55:34 2007
@@ -25,14 +25,16 @@
import javax.net.ssl.SSLSocketFactory;
-import junit.framework.TestCase;
-
import org.apache.cxf.configuration.security.FiltersType;
import org.apache.cxf.configuration.security.ObjectFactory;
import org.apache.cxf.configuration.security.SSLClientPolicy;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
-public class HttpsURLConnectionFactoryTest extends TestCase {
+public class HttpsURLConnectionFactoryTest extends Assert {
protected static final String DROP_BACK_SRC_DIR =
"../../../../../../../"
@@ -45,18 +47,13 @@
private TestHttpsURLConnection connection;
- public HttpsURLConnectionFactoryTest(String arg0) {
- super(arg0);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(HttpsURLConnectionFactoryTest.class);
- }
+ @Before
public void setUp() throws Exception {
connection = new TestHttpsURLConnection(null);
}
+ @After
public void tearDown() throws Exception {
Properties props = System.getProperties();
props.remove("javax.net.ssl.trustStore");
@@ -130,6 +127,7 @@
}
*/
+ @Test
public void testSetAllData() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -220,6 +218,7 @@
.checkLogContainsString("Unsupported SSLClientPolicy property : CertValidator"));
}
+ @Test
public void testDefaultedCipherSuiteFilters() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -262,6 +261,7 @@
}
+ @Test
public void testNonDefaultedCipherSuiteFilters() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -314,6 +314,7 @@
}
+ @Test
public void testAllValidDataJKS() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -342,6 +343,7 @@
}
+ @Test
public void testAllValidDataPKCS12() throws Exception {
String keyStoreStr = getPath("resources/celtix.p12");
@@ -368,6 +370,7 @@
}
+ @Test
public void testNonExistentKeystoreJKS() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystoredontexist");
@@ -392,6 +395,7 @@
}
+ @Test
public void testNonExistentKeystorePKCS12() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystoredontexist");
@@ -415,6 +419,7 @@
}
+ @Test
public void testWrongKeystorePasswordJKS() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -451,6 +456,7 @@
}
+ @Test
public void testWrongKeystorePasswordPKCS12() throws Exception {
String keyStoreStr = getPath("resources/celtix.p12");
@@ -487,6 +493,7 @@
}
+ @Test
public void testWrongKeyPasswordJKS() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
@@ -519,6 +526,7 @@
}
+ @Test
public void testWrongKeyPasswordPKCS12() throws Exception {
String keyStoreStr = getPath("resources/celtix.p12");
@@ -550,6 +558,7 @@
}
+ @Test
public void testAllElementsHaveSetupMethod() throws Exception {
SSLClientPolicy policy = new SSLClientPolicy();
TestLogHandler handler = new TestLogHandler();
Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java?view=diff&rev=519822&r1=519821&r2=519822
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java Sun Mar 18 20:55:34 2007
@@ -24,20 +24,20 @@
import java.net.URL;
import java.util.Properties;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
import org.apache.cxf.configuration.security.FiltersType;
import org.apache.cxf.configuration.security.ObjectFactory;
import org.apache.cxf.configuration.security.SSLServerPolicy;
//import org.mortbay.jetty.security.SslSelectChannelConnector;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import org.mortbay.jetty.security.SslSocketConnector;
-public class JettySslConnectorFactoryTest extends TestCase {
+public class JettySslConnectorFactoryTest extends Assert {
private static final String[] EXPORT_CIPHERS =
{"SSL_RSA_WITH_NULL_MD5", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_WITH_DES_CBC_SHA"};
@@ -46,23 +46,12 @@
private SslSocketConnector sslConnector;
- public JettySslConnectorFactoryTest(String arg0) {
- super(arg0);
- }
-
- public static Test suite() throws Exception {
- TestSuite suite = new TestSuite(JettySslConnectorFactoryTest.class);
- return new TestSetup(suite);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(JettySslConnectorFactoryTest.class);
- }
-
+ @Before
public void setUp() throws Exception {
sslConnector = new SslSocketConnector();
}
+ @After
public void tearDown() throws Exception {
Properties props = System.getProperties();
props.remove("javax.net.ssl.trustStore");
@@ -132,6 +121,7 @@
}
*/
+ @Test
public void testSetAllData() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -198,6 +188,7 @@
+ "CertValidator"));
}
+ @Test
public void testSetAllDataExceptKeystoreAndTrustStore() throws Exception {
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
sslServerPolicy.setKeystore(null);
@@ -261,7 +252,7 @@
handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
+ "CertValidator"));
}
-
+ @Test
public void testConfiguredCipherSuites() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -303,6 +294,7 @@
}
+ @Test
public void testDefaultedCipherSuiteFilters() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -346,6 +338,7 @@
handler.checkLogContainsString("The enabled cipher suites have been filtered down to"));
}
+ @Test
public void testNonDefaultedCipherSuiteFilters() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -399,6 +392,7 @@
handler.checkLogContainsString("The enabled cipher suites have been filtered down to"));
}
+ @Test
public void testAllValidDataJKS() throws Exception {
String keyStoreStr = getPath("resources/defaultkeystore");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -417,6 +411,7 @@
factory.decorate(sslConnector);
}
+ @Test
public void testAllValidDataPKCS12() throws Exception {
String keyStoreStr = getPath("resources/celtix.p12");
SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
@@ -435,6 +430,7 @@
factory.decorate(sslConnector);
}
+ @Test
public void testAllElementsHaveSetupMethod() throws Exception {
SSLServerPolicy policy = new SSLServerPolicy();
TestLogHandler handler = new TestLogHandler();