01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.systest.ws.security;
19:
20: import org.apache.cxf.BusFactory;
21: import org.apache.cxf.bus.spring.SpringBusFactory;
22:
23: import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
24: import org.apache.hello_world_soap_http.Greeter;
25: import org.junit.BeforeClass;
26: import org.junit.Test;
27:
28: /**
29: *
30: */
31: public class WSSecurityClientTest extends
32: AbstractBusClientServerTestBase {
33:
34: private static final java.net.URL WSDL_LOC;
35: static {
36: java.net.URL tmp = null;
37: try {
38: tmp = WSSecurityClientTest.class
39: .getClassLoader()
40: .getResource(
41: "org/apache/cxf/systest/ws/security/hello_world.wsdl");
42: } catch (final Exception e) {
43: e.printStackTrace();
44: }
45: WSDL_LOC = tmp;
46: }
47:
48: @BeforeClass
49: public static void startServers() throws Exception {
50: assertTrue("Server failed to launch",
51: // run the server in the same process
52: // set this to false to fork
53: launchServer(Server.class, true));
54: }
55:
56: @Test
57: public void testTimestampSignEncrypt() {
58: BusFactory
59: .setDefaultBus(new SpringBusFactory()
60: .createBus("org/apache/cxf/systest/ws/security/client.xml"));
61: final javax.xml.ws.Service svc = javax.xml.ws.Service.create(
62: WSDL_LOC, new javax.xml.namespace.QName(
63: "http://apache.org/hello_world_soap_http",
64: "SOAPServiceWSSecurity"));
65: final Greeter greeter = svc.getPort(
66: new javax.xml.namespace.QName(
67: "http://apache.org/hello_world_soap_http",
68: "TimestampSignEncrypt"), Greeter.class);
69: greeter.sayHi();
70: }
71: }
|