You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/10/02 19:30:40 UTC
svn commit: r1393054 - in /cxf/branches/2.6.x-fixes:
rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/
systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/
systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/
s...
Author: dkulp
Date: Tue Oct 2 17:30:39 2012
New Revision: 1393054
URL: http://svn.apache.org/viewvc?rev=1393054&view=rev
Log:
Merged revisions 1393052 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1393052 | dkulp | 2012-10-02 13:27:04 -0400 (Tue, 02 Oct 2012) | 3 lines
[CXF-4532] Better support for @Policy annotations refering to bean refs
Very slightly modified patch from Jason Pell applied
........
Added:
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceImpl.java
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml
cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
Modified:
cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
Modified: cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java?rev=1393054&r1=1393053&r2=1393054&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java (original)
+++ cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java Tue Oct 2 17:30:39 2012
@@ -34,9 +34,11 @@ import org.w3c.dom.Element;
import org.xml.sax.InputSource;
+import org.apache.cxf.Bus;
import org.apache.cxf.annotations.Policies;
import org.apache.cxf.annotations.Policy;
import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.helpers.CastUtils;
@@ -62,6 +64,12 @@ import org.apache.neethi.Constants;
public class PolicyAnnotationListener implements FactoryBeanListener {
private static final String EXTRA_POLICIES = PolicyAnnotationListener.class.getName() + ".EXTRA_POLICIES";
+ private Bus bus;
+
+ public PolicyAnnotationListener(Bus bus) {
+ this.bus = bus;
+ }
+
public void handleEvent(Event ev, AbstractServiceFactoryBean factory, Object... args) {
switch (ev) {
case INTERFACE_CREATED: {
@@ -337,59 +345,103 @@ public class PolicyAnnotationListener im
private Element addPolicy(ServiceInfo service, Policy p, Class<?> cls, String defName) {
String uri = p.uri();
String ns = Constants.URI_POLICY_NS;
+
if (p.includeInWSDL()) {
- ExtendedURIResolver resolver = new ExtendedURIResolver();
- InputSource src = resolver.resolve(uri, "classpath:");
- if (src != null) {
- try {
- Document doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src));
- if (service.getDescription() == null && cls != null) {
- service.setDescription(new DescriptionInfo());
- service.getDescription().setBaseURI(cls.getResource("/").toString());
- }
-
- uri = doc.getDocumentElement().getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
- PolicyConstants.WSU_ID_ATTR_NAME);
- if (StringUtils.isEmpty(uri)) {
- uri = defName;
- Attr att = doc.createAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
- "wsu:" + PolicyConstants.WSU_ID_ATTR_NAME);
- att.setNodeValue(defName);
- doc.getDocumentElement().setAttributeNodeNS(att);
- }
- ns = doc.getDocumentElement().getNamespaceURI();
- Object exts[] = service.getDescription().getExtensors().get();
- exts = exts == null ? new Object[0] : exts;
- for (Object o : exts) {
- if (o instanceof UnknownExtensibilityElement) {
- UnknownExtensibilityElement uee = (UnknownExtensibilityElement)o;
- String uri2 = uee.getElement()
- .getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
- PolicyConstants.WSU_ID_ATTR_NAME);
- if (uri.equals(uri2)) {
- return null;
- }
- }
- }
- UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
- uee.setElement(doc.getDocumentElement());
- uee.setRequired(true);
- uee.setElementType(DOMUtils.getElementQName(doc.getDocumentElement()));
- service.getDescription().addExtensor(uee);
-
- uri = "#" + uri;
- } catch (XMLStreamException e) {
- //ignore
- }
+ Element element = loadPolicy(uri, defName);
+ if (element == null) {
+ return null;
+ }
+
+ // might have been updated on load policy
+ uri = getPolicyId(element);
+ ns = element.getNamespaceURI();
+
+ if (service.getDescription() == null && cls != null) {
+ service.setDescription(new DescriptionInfo());
+ service.getDescription().setBaseURI(cls.getResource("/").toString());
+ }
+
+ // if not already added to service add it, otherwise ignore
+ // and just create the policy reference.
+ if (!isExistsPolicy(service, uri)) {
+ UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
+ uee.setElement(element);
+ uee.setRequired(true);
+ uee.setElementType(DOMUtils.getElementQName(element));
+ service.getDescription().addExtensor(uee);
}
+
+ uri = "#" + uri;
}
+
Document doc = DOMUtils.createDocument();
- Element el = doc.createElementNS(ns,
- "wsp:" + Constants.ELEM_POLICY_REF);
+ Element el = doc.createElementNS(ns, "wsp:" + Constants.ELEM_POLICY_REF);
Attr att = doc.createAttributeNS(null, "URI");
att.setValue(uri);
el.setAttributeNodeNS(att);
return el;
}
+ private String getPolicyId(Element element) {
+ return element.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
+ PolicyConstants.WSU_ID_ATTR_NAME);
+ }
+
+ private boolean isExistsPolicy(ServiceInfo service, String uri) {
+ Object exts[] = service.getDescription().getExtensors().get();
+ exts = exts == null ? new Object[0] : exts;
+ for (Object o : exts) {
+ if (o instanceof UnknownExtensibilityElement) {
+ UnknownExtensibilityElement uee = (UnknownExtensibilityElement)o;
+ String uri2 = getPolicyId(uee.getElement());
+ if (uri.equals(uri2)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private Element loadPolicy(String uri, String defName) {
+ if (!uri.startsWith("#")) {
+ return loadRemotePolicy(uri, defName);
+ } else {
+ return loadLocalPolicy(uri);
+ }
+ }
+
+ private Element loadRemotePolicy(String uri, String defName) {
+ ExtendedURIResolver resolver = new ExtendedURIResolver();
+ InputSource src = resolver.resolve(uri, "classpath:");
+
+ if (null == src) {
+ return null;
+ }
+
+ try {
+ Document doc = StaxUtils.read(StaxUtils.createXMLStreamReader(src));
+ uri = getPolicyId(doc.getDocumentElement());
+ if (StringUtils.isEmpty(uri)) {
+ uri = defName;
+ Attr att = doc.createAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
+ "wsu:" + PolicyConstants.WSU_ID_ATTR_NAME);
+ att.setNodeValue(defName);
+ doc.getDocumentElement().setAttributeNodeNS(att);
+ }
+
+ return doc.getDocumentElement();
+ } catch (XMLStreamException e) {
+ return null;
+ }
+ }
+
+ private Element loadLocalPolicy(String uri) {
+ PolicyBean pb = bus.getExtension(ConfiguredBeanLocator.class)
+ .getBeanOfType(uri.substring(1), PolicyBean.class);
+ if (null != pb) {
+ return pb.getElement();
+ } else {
+ return null;
+ }
+ }
}
Modified: cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1393054&r1=1393053&r2=1393054&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/branches/2.6.x-fixes/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Tue Oct 2 17:30:39 2012
@@ -111,7 +111,7 @@ public class PolicyEngineImpl implements
return;
}
}
- fblm.addListener(new PolicyAnnotationListener());
+ fblm.addListener(new PolicyAnnotationListener(bus));
}
}
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java Tue Oct 2 17:30:39 2012
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.policy;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.Policies;
+import org.apache.cxf.annotations.Policy;
+
+@WebService(name = "JavaFirstPolicyService",
+targetNamespace = "http://www.example.org/contract/JavaFirstPolicyService")
+public interface JavaFirstPolicyService {
+ @Policies({
+ @Policy(uri = "#InternalTransportAndUsernamePolicy",
+ placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
+ })
+ @WebMethod(operationName = "doOperationOne")
+ void doOperationOne();
+
+ @Policies({
+ @Policy(uri = "classpath:/java_first_policies/SslWithUsernamePasswordToken.xml",
+ placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
+ })
+ @WebMethod(operationName = "doOperationTwo")
+ void doOperationTwo();
+
+ @Policies({
+ @Policy(uri = "#InternalTransportAndUsernamePolicy",
+ placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
+ })
+ @WebMethod(operationName = "doOperationThree")
+ void doOperationThree();
+
+ @Policies({
+ @Policy(uri = "classpath:/java_first_policies/SslWithUsernamePasswordToken.xml",
+ placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT)
+ })
+ @WebMethod(operationName = "doOperationFour")
+ void doOperationFour();
+
+
+ @WebMethod(operationName = "doPing")
+ void doPing();
+}
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceImpl.java?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceImpl.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceImpl.java Tue Oct 2 17:30:39 2012
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.policy;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "org.apache.cxf.systest.ws.policy.JavaFirstPolicyService",
+serviceName = "JavaFirstPolicyService",
+targetNamespace = "http://www.example.org/contract/JavaFirstPolicyService")
+public class JavaFirstPolicyServiceImpl implements JavaFirstPolicyService {
+ public void doOperationOne() {
+ }
+
+ public void doOperationTwo() {
+ }
+
+ public void doOperationThree() {
+ }
+
+ public void doOperationFour() {
+ }
+
+ public void doPing() {
+ }
+}
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java Tue Oct 2 17:30:39 2012
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.policy;
+
+import java.io.InputStream;
+import java.io.StringReader;
+import java.net.HttpURLConnection;
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.systest.ws.policy.server.JavaFirstPolicyServer;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.neethi.Constants;
+
+import org.junit.BeforeClass;
+
+public class JavaFirstPolicyServiceTest extends AbstractBusClientServerTestBase {
+ static final String PORT = allocatePort(JavaFirstPolicyServer.class);
+ static final String PORT2 = allocatePort(JavaFirstPolicyServer.class, 2);
+
+ private static final String WSDL_NAMESPACE = "http://schemas.xmlsoap.org/wsdl/";
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(JavaFirstPolicyServer.class, true));
+ }
+
+ @org.junit.AfterClass
+ public static void cleanup() throws Exception {
+ SecurityTestUtil.cleanup();
+ stopAllServers();
+ }
+
+ @org.junit.Test
+ public void testJavaFirstWsdl() throws Exception {
+ HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT2
+ + "/JavaFirstPolicyService?wsdl");
+ InputStream is = connection.getInputStream();
+ String wsdlContents = IOUtils.toString(is);
+
+ Document doc = DOMUtils.readXml(new StringReader(wsdlContents));
+
+ Element portType = DOMUtils.getFirstChildWithName(doc.getDocumentElement(), WSDL_NAMESPACE, "portType");
+ assertNotNull(portType);
+
+ List<Element> operationMessages = DOMUtils.getChildrenWithName(portType, WSDL_NAMESPACE, "operation");
+ assertEquals(5, operationMessages.size());
+
+ Element operationOne = getOperationMessage("doOperationOne", operationMessages);
+ assertEquals("#InternalTransportAndUsernamePolicy", getPolicyReferenceId(operationOne));
+ Element operationTwo = getOperationMessage("doOperationTwo", operationMessages);
+ assertEquals("#TransportAndUsernamePolicy", getPolicyReferenceId(operationTwo));
+ Element operationThree = getOperationMessage("doOperationThree", operationMessages);
+ assertEquals("#InternalTransportAndUsernamePolicy", getPolicyReferenceId(operationThree));
+ Element operationFour = getOperationMessage("doOperationFour", operationMessages);
+ assertEquals("#TransportAndUsernamePolicy", getPolicyReferenceId(operationFour));
+ Element operationPing = getOperationMessage("doPing", operationMessages);
+ assertNull(getPolicyReferenceId(operationPing));
+
+ List<Element> policyMessages = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
+ Constants.URI_POLICY_NS, "Policy");
+ assertEquals(2, policyMessages.size());
+
+ // validate that both the internal and external policies are included
+ assertEquals("TransportAndUsernamePolicy", getPolicyId(policyMessages.get(0)));
+ assertEquals("InternalTransportAndUsernamePolicy", getPolicyId(policyMessages.get(1)));
+ }
+
+ private String getPolicyId(Element element) {
+ return element.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
+ PolicyConstants.WSU_ID_ATTR_NAME);
+ }
+
+ private Element getOperationMessage(String operationName, List<Element> operationMessages) {
+ Element operationElement = null;
+ for (Element operation : operationMessages) {
+ if (operationName.equals(operation.getAttribute("name"))) {
+ operationElement = operation;
+ break;
+ }
+ }
+ assertNotNull(operationElement);
+ return operationElement;
+ }
+
+ private String getPolicyReferenceId(Element operationMessage) {
+ Element inputMessage = DOMUtils.getFirstChildWithName(operationMessage, WSDL_NAMESPACE, "input");
+ assertNotNull(inputMessage);
+ Element policyReference = DOMUtils.getFirstChildWithName(inputMessage, Constants.URI_POLICY_NS,
+ "PolicyReference");
+ if (policyReference != null) {
+ return policyReference.getAttribute("URI");
+ } else {
+ return null;
+ }
+ }
+}
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/server/JavaFirstPolicyServer.java Tue Oct 2 17:30:39 2012
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.policy.server;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+import org.junit.Assert;
+
+public class JavaFirstPolicyServer extends AbstractBusTestServerBase {
+
+ public JavaFirstPolicyServer() {
+
+ }
+
+ protected void run() {
+ URL busFile = JavaFirstPolicyServer.class.getResource("javafirstserver.xml");
+ Bus busLocal = new SpringBusFactory().createBus(busFile);
+ BusFactory.setDefaultBus(busLocal);
+ Assert.assertNotNull(busLocal);
+ setBus(busLocal);
+
+ try {
+ new JavaFirstPolicyServer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/java_first_policies/SslWithUsernamePasswordToken.xml Tue Oct 2 17:30:39 2012
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<wsp:Policy wsu:Id="TransportAndUsernamePolicy"
+ xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SupportingTokens>
+ <wsp:Policy>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <sp:WssUsernameToken10 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SupportingTokens>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
\ No newline at end of file
Added: cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml?rev=1393054&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml (added)
+++ cxf/branches/2.6.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/policy/server/javafirstserver.xml Tue Oct 2 17:30:39 2012
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+ xmlns:sec="http://cxf.apache.org/configuration/security"
+ xmlns:cxf="http://cxf.apache.org/core"
+ xmlns:p="http://cxf.apache.org/policy"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+ http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+ http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+ http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+ http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
+ http://www.w3.org/ns/ws-policy http://www.w3.org/2007/02/ws-policy.xsd
+ ">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <cxf:bus>
+ <cxf:features>
+ <p:policies/>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+
+ <bean id="org.apache.cxf.systest.ws.policy.JavaFirstPolicyService"
+ class="org.apache.cxf.systest.ws.policy.JavaFirstPolicyServiceImpl" />
+
+ <jaxws:endpoint
+ id="JavaFirstPolicyService"
+ address="http://localhost:${testutil.ports.JavaFirstPolicyServer.2}/JavaFirstPolicyService"
+ implementor="#org.apache.cxf.systest.ws.policy.JavaFirstPolicyService">
+
+ <jaxws:properties>
+ <entry key="ws-security.callback-handler"
+ value="org.apache.cxf.systest.ws.wssec10.client.UTPasswordCallback" />
+ </jaxws:properties>
+ </jaxws:endpoint>
+
+ <wsp:Policy wsu:Id="InternalTransportAndUsernamePolicy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+ xmlns:wsp="http://www.w3.org/ns/ws-policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SupportingTokens>
+ <wsp:Policy>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <sp:WssUsernameToken10 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SupportingTokens>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+</beans>