diff options
4 files changed, 22 insertions, 18 deletions
diff --git a/branches/sca-java-1.x/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite b/branches/sca-java-1.x/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite index b74682e1bd..3077c328b6 100644 --- a/branches/sca-java-1.x/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite +++ b/branches/sca-java-1.x/itest/validation/src/main/resources/bindingjms/UnexpectedElement/service.composite @@ -18,6 +18,7 @@ * under the License. --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://test" name="RPCComposite"> <component name="HelloWorldService"> @@ -31,6 +32,7 @@ <resourceAdapter name="resource"> <property name="resourceName" type="jms"/> </resourceAdapter> + <UnexpectedElement/> </binding.jms> </service> </component> diff --git a/branches/sca-java-1.x/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java b/branches/sca-java-1.x/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java index 38bb190af6..94e11f9590 100644 --- a/branches/sca-java-1.x/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java +++ b/branches/sca-java-1.x/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java @@ -33,6 +33,7 @@ import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode; import org.apache.tuscany.sca.node.SCANodeFactory; import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.osoa.sca.ServiceRuntimeException; /** * This shows how to test the Calculator service component. @@ -41,31 +42,32 @@ public class DuplicateReferenceNameTestCase extends TestCase { private CalculatorService calculatorService; private SCANode node; + private boolean duplicateReferenceException = false; @Override protected void setUp() throws Exception { - SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); - node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateReferenceName/Calculator.composite").toURL().toString(), - new SCAContribution("TestContribution", - new File("src/main/resources/DuplicateReferenceName").toURL().toString())); - node.start(); - calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + try { + SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); + node = nodeFactory.createSCANode(new File("src/main/resources/DuplicateReferenceName/Calculator.composite").toURL().toString(), + new SCAContribution("TestContribution", + new File("src/main/resources/DuplicateReferenceName").toURL().toString())); + node.start(); + calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + } catch (ServiceRuntimeException ex) { + if (ex.getMessage().equals("org.osoa.sca.ServiceRuntimeException: Duplicate component reference name: Component = CalculatorServiceComponent Reference = addService")){ + duplicateReferenceException = true; + } + } } @Override protected void tearDown() throws Exception { - node.stop(); + if (node != null){ + node.stop(); + } } public void testCalculator() throws Exception { - ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry(); - UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); - - assertNotNull(problem); - assertEquals("DuplicateComponentReferenceName", problem.getMessageId()); - + assertTrue(duplicateReferenceException); } } diff --git a/branches/sca-java-1.x/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java b/branches/sca-java-1.x/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java index f244ca7ec6..ecd2e0a760 100644 --- a/branches/sca-java-1.x/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java +++ b/branches/sca-java-1.x/itest/validation/src/test/java/interfacewsdl/xml/InvalidWSDLInterfaceAttrTestCase.java @@ -52,7 +52,7 @@ public class InvalidWSDLInterfaceAttrTestCase extends TestCase { public void testCalculator() { Monitor monitor = customDomain.getMonitorInstance(); - Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); + Problem problem = ((DefaultMonitorImpl)monitor).getProblems().get(0); assertNotNull(problem); assertEquals("InvalidWSDLInterfaceAttr", problem.getMessageId()); diff --git a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index 8dacc5522b..c4528e0bf2 100644 --- a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -575,7 +575,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } catch (XMLStreamException e) { ContributionReadException ex = new ContributionReadException(e); - error("XMLStreamException", reader, ex); + error("ContributionReadException", reader, ex); } return composite; |