diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-08 12:00:38 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-08 12:00:38 +0000 |
commit | fa12862cdde921c4893204a0dc28cf7d80e2cebf (patch) | |
tree | 5310fd403d54e2d277047e8980838c674dc05a9c /sca-java-2.x/trunk/itest | |
parent | df6bd28390b0cd99119934763a4a664b6aa5347d (diff) |
Switch binder interface over to throwing exceptions rather than returning booleans. Allows the full details of a missmatch to be retrieved in the runtime case as well as the build time case. Update the matching test case to take advantage of the extra information.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@920287 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest')
-rw-r--r-- | sca-java-2.x/trunk/itest/policy/matching/src/test/java/org/apache/tuscany/sca/policy/matching/MatchingTestCase.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/itest/policy/matching/src/test/java/org/apache/tuscany/sca/policy/matching/MatchingTestCase.java b/sca-java-2.x/trunk/itest/policy/matching/src/test/java/org/apache/tuscany/sca/policy/matching/MatchingTestCase.java index d4ae722318..beadbec397 100644 --- a/sca-java-2.x/trunk/itest/policy/matching/src/test/java/org/apache/tuscany/sca/policy/matching/MatchingTestCase.java +++ b/sca-java-2.x/trunk/itest/policy/matching/src/test/java/org/apache/tuscany/sca/policy/matching/MatchingTestCase.java @@ -20,6 +20,8 @@ package org.apache.tuscany.sca.policy.matching; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import org.apache.tuscany.sca.node.Contribution; import org.apache.tuscany.sca.node.Node; @@ -56,8 +58,9 @@ public class MatchingTestCase { HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientMutuallyExclusiveIntents"); try { helloWorld.getGreetings("petra"); + fail("Exception expected"); } catch (Exception ex) { - assertEquals("Unable to bind", ex.getMessage().substring(0, 14)); + assertTrue(ex.getMessage().indexOf("No match because the following intents are mutually exclusive {http://tuscany.apache.org/xmlns/sca/1.1}testIntent3 {http://tuscany.apache.org/xmlns/sca/1.1}testIntent1") > -1); } } @@ -72,8 +75,9 @@ public class MatchingTestCase { HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloUnresolvedIntentsOnReference"); try { helloWorld.getGreetings("petra"); + fail("Exception expected"); } catch (Exception ex) { - assertEquals("Unable to bind", ex.getMessage().substring(0, 14)); + assertTrue(ex.getMessage().indexOf("No match because there are unresolved intents [{http://tuscany.apache.org/xmlns/sca/1.1}testIntent2]") > -1); } } @@ -90,9 +94,10 @@ public class MatchingTestCase { public void testSomePoliciesOnOneSideButNoneOnTheOther() throws Exception { try { HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientSomePoliciesOnOneSideButNoneOnTheOther"); - assertEquals("Hello petra", helloWorld.getGreetings("petra")); + helloWorld.getGreetings("petra"); + fail("Exception expected"); } catch (Exception ex) { - assertEquals("Unable to bind", ex.getMessage().substring(0, 14)); + assertTrue(ex.getMessage().indexOf("No match because there are policy sets at the endpoint but not at the endpoint reference") > -1); } } @@ -106,9 +111,10 @@ public class MatchingTestCase { public void testDifferentPolicyLanguage() throws Exception { try { HelloWorld helloWorld = node.getService(HelloWorld.class, "HelloWorldClientDifferentPolicyLanguage"); - assertEquals("Hello petra", helloWorld.getGreetings("petra")); + helloWorld.getGreetings("petra"); + fail("Exception expected"); } catch (Exception ex) { - assertEquals("Unable to bind", ex.getMessage().substring(0, 14)); + assertTrue(ex.getMessage().indexOf("No match because the policy sets on either side have policies in differnt languages {http://schemas.xmlsoap.org/ws/2004/09/policy}ExactlyOne and {http://tuscany.apache.org/xmlns/sca/1.1}jdkLogger") > -1); } } |