You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2008/02/21 18:48:42 UTC
svn commit: r629890 - in /incubator/tuscany/java/sca/itest/policy: ./ src/
src/main/ src/main/java/ src/main/java/calculator/
src/main/java/calculator/policy/ src/main/resources/
src/main/resources/META-INF/ src/main/resources/META-INF/services/ src/te...
Author: svkrish
Date: Thu Feb 21 09:48:37 2008
New Revision: 629890
URL: http://svn.apache.org/viewvc?rev=629890&view=rev
Log:
adding itest for policy
Added:
incubator/tuscany/java/sca/itest/policy/
incubator/tuscany/java/sca/itest/policy/pom.xml (with props)
incubator/tuscany/java/sca/itest/policy/src/
incubator/tuscany/java/sca/itest/policy/src/main/
incubator/tuscany/java/sca/itest/policy/src/main/java/
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java (with props)
incubator/tuscany/java/sca/itest/policy/src/main/resources/
incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite (with props)
incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/
incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/
incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml (with props)
incubator/tuscany/java/sca/itest/policy/src/test/
incubator/tuscany/java/sca/itest/policy/src/test/java/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/
incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java (with props)
Added: incubator/tuscany/java/sca/itest/policy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/pom.xml?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/pom.xml (added)
+++ incubator/tuscany/java/sca/itest/policy/pom.xml Thu Feb 21 09:48:37 2008
@@ -0,0 +1,68 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy</artifactId>
+ <name>Apache Tuscany SCA Policy Framework Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
Propchange: incubator/tuscany/java/sca/itest/policy/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/policy/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+@Service
+//@Requires(PolicyQNames.TEST_INTENT_FIVE)
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,69 @@
+/*
+ * 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 calculator;
+
+import javax.security.auth.login.Configuration;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ try {
+ Configuration secConf = Configuration.getConfiguration();
+ } catch ( java.lang.SecurityException e ) {
+ if ( e.getMessage().equals("Unable to locate a login configuration") ) {
+ System.setProperty("java.security.auth.login.config", "target/classes/CalculatorJass.config");
+ } else {
+ throw e;
+ }
+ }
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "policy for subtract and divide operations...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ calculatorService =
+ scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "for all operations in the implementation...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorClient.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java Thu Feb 21 09:48:37 2008
@@ -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 calculator;
+
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The Calculator service interface.
+ */
+
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,76 @@
+/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Requires;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Requires(PolicyQNames.TEST_INTENT_ONE)
+public class CalculatorServiceImpl implements CalculatorService, PolicyQNames {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ //@Requires({TEST_INTENT_TWO, TEST_INTENT_THREE})
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Requires(TEST_INTENT_TWO)
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ @Requires(PolicyQNames.QUALIFIED_TEST_INTENT_ONE)
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ //@Requires(QUALIFIED_TEST_INTENT_FOUR)
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,43 @@
+/*
+ * 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 calculator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyQNames {
+ public static final String QUALIFIER = ".";
+
+ public static final String TUSCANY_PREFIX="{http://tuscany.apache.org/xmlns/sca/1.0}";
+ public static final String TEST_INTENT_ONE = TUSCANY_PREFIX + "TestIntent_1";
+ public static final String TEST_INTENT_TWO = TUSCANY_PREFIX + "TestIntent_2";
+ public static final String TEST_INTENT_THREE = TUSCANY_PREFIX + "TestIntent_3";
+ public static final String TEST_INTENT_FOUR = TUSCANY_PREFIX + "TestIntent_4";
+ public static final String TEST_INTENT_FIVE = TUSCANY_PREFIX + "TestIntent_5";
+
+ public static final String QUALIFIER_ONE = "Qualifier_1";
+
+ public static final String QUALIFIED_TEST_INTENT_FOUR =
+ TEST_INTENT_FOUR + QUALIFIER + QUALIFIER_ONE;
+
+ public static final String QUALIFIED_TEST_INTENT_ONE =
+ TEST_INTENT_ONE + QUALIFIER + QUALIFIER_ONE;
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/PolicyQNames.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,28 @@
+/*
+ * 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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,35 @@
+/*
+ * 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 calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,78 @@
+/*
+ * 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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestImplPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ if ( op.getName().equals("add") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_2_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_Qualified_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_3_implementation") ;
+ Assert.assertTrue(match);
+ } else if ( op.getName().equals("subtract") ) {
+ Assert.assertEquals(applicablePolicySet.getName().getLocalPart(),
+ "TestPolicySet_1_Qualified_implementation");
+ } else if ( op.getName().equals("multiply") || op.getName().equals("divide")) {
+ Assert.assertEquals(applicablePolicySet.getName().getLocalPart(),
+ "TestPolicySet_1_implementation");
+ } else {
+ Assert.fail();
+ }
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestImplPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java Thu Feb 21 09:48:37 2008
@@ -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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestRefPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestReflPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestRefPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java Thu Feb 21 09:48:37 2008
@@ -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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestSvcPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite Thu Feb 21 09:48:37 2008
@@ -0,0 +1,68 @@
+<?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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy"
+ xmlns:sample="http://itest/policy"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl">
+ </implementation.java>
+ <!-- reference name="addService" target="AddServiceComponent" /-->
+ <reference name="addService" >
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8080/AddServiceComponent"/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl" requires="tuscany:TestIntent_3"/>
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws/>
+ </service>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+ <component name="AnotherCalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl" />
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/Calculator.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler Thu Feb 21 09:48:37 2008
@@ -0,0 +1,27 @@
+# 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.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+calculator.policy.TestImplPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_1.Qualifier_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestImplPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#TestIntent_3,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
\ No newline at end of file
Added: incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml (added)
+++ incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml Thu Feb 21 09:48:37 2008
@@ -0,0 +1,196 @@
+<?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://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator">
+
+<!-- Policy Intents -->
+<sca:intent name="tuscany:TestIntent_1"
+ constrains="sca:implementation.java sca:binding.ws">
+ <description>
+ Test Intent One
+ </description>
+</sca:intent>
+
+<sca:intent name="tuscany:TestIntent_2"
+ constrains="sca:implementation.java sca:binding.ws">
+ <description>
+ Test Intent Two
+ </description>
+</sca:intent>
+
+<sca:intent name="tuscany:TestIntent_3"
+ constrains="sca:implementation.java sca:binding.ws">
+ <description>
+ Test Intent Three
+ </description>
+</sca:intent>
+
+<sca:intent name="tuscany:TestIntent_4"
+ constrains="sca:implementation.java sca:binding.ws">
+ <description>
+ Test Intent Four
+ </description>
+</sca:intent>
+
+<sca:intent name="tuscany:TestIntent_5"
+ constrains="sca:implementation.java sca:binding.ws">
+ <description>
+ Test Intent Five
+ </description>
+</sca:intent>
+
+<sca:intent name="tuscany:TestIntent_1.Qualifier_1" />
+
+
+<!-- PolicySets -->
+<sca:policySet name="tuscany:TestPolicySet_1_implementation"
+ provides="tuscany:TestIntent_1"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <intentMap provides="tuscany:TestIntent_1" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy/>
+ </qualifier>
+ </intentMap>
+ <wsp:Policy/>
+ </sca:policySet>
+
+<sca:policySet name="tuscany:TestPolicySet_1_Qualified_implementation"
+ provides="tuscany:TestIntent_1.Qualifier_1"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_1_reference"
+ provides="tuscany:TestIntent_1"
+ appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_1_service"
+ provides="tuscany:TestIntent_1"
+ appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+
+ <sca:policySet name="tuscany:TestPolicySet_2_implementation"
+ provides="tuscany:TestIntent_2"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_2_reference"
+ provides="tuscany:TestIntent_2"
+ appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_2_service"
+ provides="tuscany:TestIntent_2"
+ appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+
+ <sca:policySet name="tuscany:TestPolicySet_3_implementation"
+ provides="tuscany:TestIntent_3"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_4_implementation"
+ provides="tuscany:TestIntent_4"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_4_service"
+ provides="tuscany:TestIntent_4"
+ appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_4_reference"
+ provides="tuscany:TestIntent_4"
+ appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_5_implementation"
+ provides="tuscany:TestIntent_5"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_5_service"
+ provides="tuscany:TestIntent_5"
+ appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_5_reference"
+ provides="tuscany:TestIntent_5"
+ appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <wsp:Policy/>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:TestPolicySet_4_qualified_1_implementation"
+ provides="tuscany:TestIntent_4"
+ appliesTo="sca:implementation.java"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ >
+ <intentMap provides="tuscany:TestIntent_4" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy/>
+ </qualifier>
+ </intentMap>
+ </sca:policySet>
+</definitions>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/itest/policy/src/main/resources/definitions.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java?rev=629890&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java Thu Feb 21 09:48:37 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.tuscany.sca.itest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+public class PoliciedCalculatorTestCase {
+ private static SCADomain domain;
+ private static CalculatorService calculatorService;
+
+
+ @Test
+ public void testPolicies() {
+ calculatorService.add(10, 10);
+ calculatorService.multiply(10, 10);
+ calculatorService.divide(10, 10);
+ calculatorService.subtract(10, 10);
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Calculator.composite");
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
Propchange: incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org