From 7e638d75169c353993547709aeae52c3d262465b Mon Sep 17 00:00:00 2001 From: ramkumar Date: Thu, 27 Aug 2009 10:34:14 +0000 Subject: Fixes to generate proper exception for ASM_6029 and ASM_6030 otests git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@808356 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/assembly/xml/CompositeProcessor.java | 14 ++++++++++++-- .../resources/assembly-xml-validation-messages.properties | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'java/sca/modules/assembly-xml/src') diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index b20a788027..8c7b4117f4 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -948,8 +948,18 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt for (int i = 0, n = composite.getIncludes().size(); i < n; i++) { Composite include = composite.getIncludes().get(i); if (include != null) { - include = resolver.resolveModel(Composite.class, include); - composite.getIncludes().set(i, include); + Composite resolved = resolver.resolveModel(Composite.class, include); + if (!resolved.isUnresolved()) { + if ((composite.isLocal() && resolved.isLocal()) || (!composite.isLocal() && !resolved.isLocal())) { + composite.getIncludes().set(i, resolved); + } else { + ContributionResolveException ce = new ContributionResolveException("Error: Composite "+ composite.getName() +" can only include another composite with the identical @local attribute value"); + error("ContributionResolveException", include, ce); + } + } else { + ContributionResolveException ce = new ContributionResolveException("Error: Composite "+ include.getName() +" is not a valid composite within the domain"); + error("ContributionResolveException", include, ce); + } } } diff --git a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties index 5a633ff22e..fe29a3be28 100644 --- a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties +++ b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties @@ -25,6 +25,7 @@ UnexpectedImplementationElement = Unexpected element found. It PolicyImplValidationException = PolicyValidation exception when processing implementation of component {0} due to {1}. PolicyServiceValidationException = PolicyValidation exceptions when processing service/reference {0} in {1}. Error is {2} ContributionReadException = ContributionReadException occured due to : {0} +ContributionResolveException = ContributionResolveException occured due to : {0} ContributionWriteException = ContributionWriteException occured due to : {0} XMLStreamException = XMLStreamException occured due to : {0} DuplicateCompositeName = [ASM_6001] More than one composite with the same name {0} found in contribution {1} -- cgit v1.2.3