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/11 22:04:16 UTC

svn commit: r1397273 - in /cxf/trunk/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/policy/ resources/java_first_policies/

Author: dkulp
Date: Thu Oct 11 20:04:16 2012
New Revision: 1397273

URL: http://svn.apache.org/viewvc?rev=1397273&view=rev
Log:
Add missing files

Added:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
    cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java?rev=1397273&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java (added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyService.java Thu Oct 11 20:04:16 2012
@@ -0,0 +1,40 @@
+/**
+ * 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;
+
+@WebService(name = "JavaFirstAttachmentPolicyService", 
+targetNamespace = "http://www.example.org/contract/JavaFirstAttachmentPolicyService")
+public interface JavaFirstAttachmentPolicyService {
+    @WebMethod(operationName = "doOperationLevelPolicy")
+    void doOperationLevelPolicy();
+
+    @WebMethod(operationName = "doInputMessagePolicy")
+    void doInputMessagePolicy();
+
+    @WebMethod(operationName = "doOutputMessagePolicy")
+    void doOutputMessagePolicy();
+    
+    @WebMethod(operationName = "doNoPolicy")
+    void doNoPolicy();
+    
+}

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java?rev=1397273&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java (added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstAttachmentPolicyServiceImpl.java Thu Oct 11 20:04:16 2012
@@ -0,0 +1,39 @@
+/**
+ * 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.JavaFirstAttachmentPolicyService", 
+serviceName = "JavaFirstAttachmentPolicyService", 
+targetNamespace = "http://www.example.org/contract/JavaFirstAttachmentPolicyService")
+public class JavaFirstAttachmentPolicyServiceImpl implements JavaFirstAttachmentPolicyService {
+    public void doOperationLevelPolicy() {
+    }
+
+    public void doInputMessagePolicy() {
+    }
+
+    public void doOutputMessagePolicy() {
+    }
+
+    public void doNoPolicy() {
+    }
+}

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java?rev=1397273&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java (added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/URIDomainExpressionBuilder.java Thu Oct 11 20:04:16 2012
@@ -0,0 +1,45 @@
+/**
+ * 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.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilder;
+
+public class URIDomainExpressionBuilder implements DomainExpressionBuilder {
+    private static final Collection<QName> SUPPORTED_TYPES = Collections.unmodifiableList(
+             Arrays.asList(new QName[] {
+                 new QName("http://www.w3.org/ns/ws-policy", "URI"),
+                 new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "URI")}));
+
+    @Override
+    public DomainExpression build(Element paramElement) {
+        return new UriDomainExpression();
+    }
+
+    @Override
+    public Collection<QName> getDomainExpressionTypes() {
+        return SUPPORTED_TYPES;
+    }
+}

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java?rev=1397273&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java (added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/UriDomainExpression.java Thu Oct 11 20:04:16 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 org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.ws.policy.attachment.external.DomainExpression;
+
+public class UriDomainExpression implements DomainExpression {
+    public UriDomainExpression() {
+    }
+
+    @Override
+    public boolean appliesTo(BindingFaultInfo paramBindingFaultInfo) {
+        return false;
+    }
+
+    @Override
+    public boolean appliesTo(BindingMessageInfo paramBindingMessageInfo) {
+        return ("doInputMessagePolicy".equals(paramBindingMessageInfo.getBindingOperation().getName().getLocalPart()) 
+            && MessageInfo.Type.INPUT.equals(paramBindingMessageInfo.getMessageInfo().getType()))
+            || ("doOutputMessagePolicy".equals(paramBindingMessageInfo.getBindingOperation().getName().getLocalPart()) 
+            && MessageInfo.Type.OUTPUT.equals(paramBindingMessageInfo.getMessageInfo().getType()));
+    }
+
+    @Override
+    public boolean appliesTo(BindingOperationInfo paramBindingOperationInfo) {
+        return "doOperationLevelPolicy".equals(paramBindingOperationInfo.getName().getLocalPart());
+    }
+
+    @Override
+    public boolean appliesTo(EndpointInfo paramEndpointInfo) {
+        return false;
+    }
+
+    @Override
+    public boolean appliesTo(ServiceInfo paramServiceInfo) {
+        return false;
+    }
+
+}

Added: cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml?rev=1397273&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml (added)
+++ cxf/trunk/systests/ws-security/src/test/resources/java_first_policies/AttachmentPolicy.xml Thu Oct 11 20:04:16 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+	xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+	
+	<wsp:AppliesTo>
+		<wsp:URI>myurl</wsp:URI>
+	</wsp:AppliesTo>
+	
+	<wsp:Policy wsu:Id="UsernameToken" 
+	    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<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>
+</wsp:PolicyAttachment>
\ No newline at end of file