You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/03/04 14:27:23 UTC

svn commit: r514396 - in /incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src: main/java/org/apache/tuscany/spi/model/ServiceContract.java test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java

Author: antelder
Date: Sun Mar  4 05:27:23 2007
New Revision: 514396

URL: http://svn.apache.org/viewvc?view=rev&rev=514396
Log:
Change to get ServiceContract Operation by name instead of getting all operations and looking for the named one 

Modified:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java?view=diff&rev=514396&r1=514395&r2=514396
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java Sun Mar  4 05:27:23 2007
@@ -133,6 +133,10 @@
         this.callbackClass = callbackClass;
     }
 
+    public Operation getOperation(String name) {
+        return operations == null ? null : operations.get(name);
+    }
+
     public Map<String, Operation<T>> getOperations() {
         if (operations == null) {
             return Collections.emptyMap();

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java?view=diff&rev=514396&r1=514395&r2=514396
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java Sun Mar  4 05:27:23 2007
@@ -69,6 +69,15 @@
         assertEquals(contract, copy);
     }
 
+    public void testGetOperation() throws Exception {
+        ServiceContract<Type> contract = new TestContract();
+        Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+        Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+        ops.put("foo", operation);
+        contract.setOperations(ops);
+        assertEquals(operation, contract.getOperation("foo"));
+        assertNull(contract.getOperation("bla"));
+    }
 
     private class TestContract extends ServiceContract<Type> {
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org