You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/05/29 21:50:37 UTC
svn commit: r661451 - in /incubator/tuscany/java/sca/itest:
recursive-ws/src/main/java/policy/ recursive-ws/src/main/resources/policy/
recursive-ws/src/test/java/policy/ recursive/src/main/java/policy/
recursive/src/main/resources/policy/ recursive/src...
Author: slaws
Date: Thu May 29 12:50:36 2008
New Revision: 661451
URL: http://svn.apache.org/viewvc?rev=661451&view=rev
Log:
Test the limit of propagation of intents and policies in recursive composition
Added:
incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/
incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/
incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml (with props)
incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/
incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/
incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/
incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite (with props)
incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml (with props)
incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/
incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java (with props)
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java Thu May 29 12:50:36 2008
@@ -0,0 +1,26 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Target {
+ String hello(String arg);
+}
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/Target.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java Thu May 29 12:50:36 2008
@@ -0,0 +1,33 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetClientImpl implements Target {
+
+ @Reference
+ protected Target targetService;
+
+ public String hello(String arg) {
+ return "Target: Hello " + targetService.hello(arg) + "!";
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetClientImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java Thu May 29 12:50:36 2008
@@ -0,0 +1,29 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetServiceImpl implements Target {
+
+ public String hello(String arg) {
+ return "Target: Hello " + arg + "!";
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/java/policy/TargetServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite Thu May 29 12:50:36 2008
@@ -0,0 +1,37 @@
+<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ name="PolicyInnerComposite">
+
+ <service name="TargetService" promote="TargetServiceComponent">
+ <interface.java interface="policy.Target"/>
+ </service>
+
+ <component name="TargetServiceComponent">
+ <implementation.java class="policy.TargetServiceImpl"/>
+ <service name="Target">
+ <interface.java interface="policy.Target"/>
+ <binding.ws uri="http://localhost:8085/TargetServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyInnerComposite.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite Thu May 29 12:50:36 2008
@@ -0,0 +1,41 @@
+<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ name="PolicyOuterComposite"
+ requires="policy:TestIntent_1">
+
+ <component name="TargetClientComponent">
+ <implementation.java class="policy.TargetClientImpl"/>
+ <reference name="targetService" target="OuterTargetServiceComponent">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OuterTargetServiceComponent">
+ <implementation.composite name="policy:PolicyInnerComposite"/>
+ <service name="TargetService">
+ <interface.java interface="policy.Target"/>
+ <binding.ws uri="http://localhost:8085/OuterTargetServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml Thu May 29 12:50:36 2008
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:binding.ws">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <!-- Policy Sets -->
+ <sca:policySet name="TestPolicySet_1_binding"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:binding.ws"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+</definitions>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java Thu May 29 12:50:36 2008
@@ -0,0 +1,74 @@
+/*
+ * 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 policy;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.annotations.EndsConversation;
+
+public class PolicyTestCase{
+
+ private SCADomain domain;
+ private Target targetClient;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("policy/PolicyOuterComposite.composite");
+ targetClient = domain.getService(Target.class, "TargetClientComponent");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void test() throws Exception {
+ try {
+ //Check that the binding policy sets do flow down to the component but not down to the
+ //component inside implementation.composite
+ Component outerComponent = ((DefaultSCADomain)domain).getComponent("OuterTargetServiceComponent");
+
+ // The outer component service bindings should have policy sets attached
+ Assert.assertEquals(1, ((PolicySetAttachPoint)outerComponent.getServices().get(0).getBindings().get(0)).getPolicySets().size());
+
+ Component component =((CompositeImpl)outerComponent.getImplementation()).getComponents().get(0);
+
+ // The original inner component service binding should not have policy sets attached
+ Assert.assertEquals(0, ((PolicySetAttachPoint)component.getServices().get(0).getBindings().get(0)).getPolicySets().size());
+
+ // The promoted inner component service binding should have policy sets attached
+ Assert.assertEquals(1, ((PolicySetAttachPoint)component.getServices().get(1).getBindings().get(0)).getPolicySets().size());
+
+ String result = targetClient.hello("Fred");
+
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive-ws/src/test/java/policy/PolicyTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java Thu May 29 12:50:36 2008
@@ -0,0 +1,26 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Target {
+ String hello(String arg);
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/Target.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java Thu May 29 12:50:36 2008
@@ -0,0 +1,33 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetClientImpl implements Target {
+
+ @Reference
+ protected Target targetService;
+
+ public String hello(String arg) {
+ return "Target: Hello " + targetService.hello(arg) + "!";
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetClientImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java Thu May 29 12:50:36 2008
@@ -0,0 +1,29 @@
+/*
+ * 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 policy;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetServiceImpl implements Target {
+
+ public String hello(String arg) {
+ return "Target: Hello " + arg + "!";
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/policy/TargetServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite Thu May 29 12:50:36 2008
@@ -0,0 +1,32 @@
+<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ name="PolicyInnerComposite">
+
+ <service name="TargetService" promote="TargetServiceComponent">
+ </service>
+
+ <component name="TargetServiceComponent">
+ <implementation.java class="policy.TargetServiceImpl"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite Thu May 29 12:50:36 2008
@@ -0,0 +1,35 @@
+<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:policy="http://policy"
+ requires="policy:TestIntent_1"
+ name="PolicyOuterComposite">
+
+ <component name="TargetClientComponent">
+ <implementation.java class="policy.TargetClientImpl"/>
+ <reference name="targetService" target="OuterTargetServiceComponent"/>
+ </component>
+
+ <component name="OuterTargetServiceComponent">
+ <implementation.composite name="policy:PolicyInnerComposite"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml Thu May 29 12:50:36 2008
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:implementation">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <!-- Policy Sets -->
+ <sca:policySet name="TestPolicySet_1_composite"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.composite"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_java"
+ provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+</definitions>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/resources/policy/definitions.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java?rev=661451&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java Thu May 29 12:50:36 2008
@@ -0,0 +1,68 @@
+/*
+ * 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 policy;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PolicyTestCase {
+
+ private SCADomain domain;
+ private Target targetClient;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("policy/PolicyOuterComposite.composite");
+ targetClient = domain.getService(Target.class, "TargetClientComponent");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void test() throws Exception {
+ try {
+ //Check that the implementation policy sets don't flow down to the components
+ //implementations that are themselves composites (implementation.composite)
+ Component outerComponent = ((DefaultSCADomain)domain).getComponent("OuterTargetServiceComponent");
+
+ Assert.assertEquals(0, outerComponent.getPolicySets().size());
+
+ for (Component component :((CompositeImpl)outerComponent.getImplementation()).getComponents()){
+ Assert.assertEquals(0, component.getPolicySets().size());
+ }
+
+ // debugging
+ String result = targetClient.hello("Fred");
+
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/recursive/src/test/java/policy/PolicyTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date