1 package org.objectweb.celtix.systest.securebasic; 2 3 import java.lang.reflect.UndeclaredThrowableException ; 4 import java.net.URL ; 5 6 import javax.xml.namespace.QName ; 7 8 import junit.framework.Test; 9 import junit.framework.TestSuite; 10 11 import org.objectweb.celtix.systest.common.ClientServerSetupBase; 12 import org.objectweb.celtix.systest.common.ClientServerTestBase; 13 import org.objectweb.hello_world_soap_http_secure.Greeter; 14 import org.objectweb.hello_world_soap_http_secure.SecureSOAPService; 15 import org.objectweb.hello_world_soap_http_secure.types.Result; 16 17 public class ClientPropertiesNotSetServerTest extends ClientServerTestBase { 18 19 private static ClientServerSetupBase cssb; 20 21 private final QName portName = new QName ("http://objectweb.org/hello_world_soap_http_secure", 22 "SoapPortClientPropertiesNotSet"); 23 private final QName secureServiceName = new QName ("http://objectweb.org/hello_world_soap_http_secure", 24 "SecureSOAPServiceClientPropertiesNotSet"); 25 26 27 28 public static Test suite() throws Exception { 29 30 TestSuite suite = new TestSuite(ClientPropertiesNotSetServerTest.class); 31 cssb = new ClientServerSetupBase(suite) { 32 public void startServers() throws Exception { 33 System.setProperty("java.util.logging.config.file", 34 getClass().getResource(".") + "ClientPropertiesNotSetServerTestLog.txt"); 35 SecureBasicUtils.startServer(getClass().getResource(".") 36 + "WantAndNeedClientAuthServerClientPropertiesNotSet.xml", 37 "celtix.security.configurer.http-listener.9015", 38 null, 39 cssb, 40 WantAndNeedClientAuthServerClientPropertiesNotSet.class); 41 } 42 }; 43 44 return cssb; 45 } 46 47 48 public void testBasicConnectionClientNoPropertiesSet() throws Exception { 49 System.setProperty("java.util.logging.config.file", 50 SecureBasicUtils.getTestDir(this) + "clientlog.txt"); 51 System.setProperty("celtix.config.file", 52 getClass().getResource(".") + "client.xml"); 53 54 URL wsdl = getClass().getResource("/wsdl/hello_world_secure.wsdl"); 55 assertNotNull(wsdl); 56 57 SecureSOAPService service = new SecureSOAPService(wsdl, secureServiceName); 58 assertNotNull(service); 59 60 Greeter greeter = service.getPort(portName, Greeter.class); 61 62 invoke(greeter); 63 64 } 65 66 private void invoke(Greeter greeter) throws Exception { 67 68 try { 69 Result ret = greeter.greetMeTwoTier("Milestone", 0); 70 if (ret.isDidPass()) { 71 fail("Should not have succeeded, client properties not setup"); 72 } 73 } catch (UndeclaredThrowableException ex) { 74 assertTrue("Failed to catch expected exception, instead caught ex.getClass() = " 75 + ex.getClass(), ex != null); 76 } 77 78 79 } 80 81 public static void main(String [] args) { 82 junit.textui.TestRunner.run(ClientPropertiesNotSetServerTest.class); 83 } 84 85 86 87 } 88 | Popular Tags |