From 2f3c1011e6029fa969c584709454063498c6d8d7 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 21 Sep 2009 16:00:10 +0000 Subject: Check for a few null cases that happen in assembly-xml unit tests. I don't think we should be testing the builders in assembly-xml. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@817304 13f79535-47bb-0310-9956-ffa450edef68 --- .../builder/impl/ComponentBuilderImpl.java | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'java/sca/modules/assembly') diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentBuilderImpl.java index 09e9d95724..760d5b7885 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentBuilderImpl.java @@ -187,7 +187,13 @@ public class ComponentBuilderImpl { // configuration based on OASIS rules for (ComponentService componentService : component.getServices()) { Service componentTypeService = componentService.getService(); - + + if (componentTypeService == null){ + // raise error? + // can be null in some of the assembly-xml unit tests + continue; + } + // interface contracts calculateInterfaceContract(componentService, componentTypeService); @@ -233,7 +239,13 @@ public class ComponentBuilderImpl { // configuration based on OASIS rules for (ComponentReference componentReference : component.getReferences()) { Reference componentTypeReference = componentReference.getReference(); - + + if (componentTypeReference == null){ + // raise error? + // can be null in some of the assembly-xml unit tests + continue; + } + // reference multiplicity reconcileReferenceMultiplicity(component, componentReference, @@ -385,6 +397,11 @@ public class ComponentBuilderImpl { continue; } + if (component.getImplementation() == null){ + // is null in some of our basic unit tests + continue; + } + Service service = component.getImplementation().getService(componentService.getName()); if (service != null) { @@ -408,6 +425,11 @@ public class ComponentBuilderImpl { continue; } + if (component.getImplementation() == null){ + // is null in some of our basic unit tests + continue; + } + Reference reference = component.getImplementation().getReference(componentReference.getName()); if (reference != null) { -- cgit v1.2.3