From ed12e0e4a340896a5a9dbc1da8f8b3aa05e5ff9c Mon Sep 17 00:00:00 2001 From: rsivaram Date: Tue, 21 Oct 2008 11:57:26 +0000 Subject: Event prototype: Fix unit test failure git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@706587 13f79535-47bb-0310-9956-ffa450edef68 --- .../builder/impl/BaseConfigurationBuilderImpl.java | 71 +++++++++++----------- 1 file changed, 37 insertions(+), 34 deletions(-) (limited to 'sandbox') diff --git a/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java index 0a4bd1939e..49ad4cbde6 100644 --- a/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java +++ b/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java @@ -1347,24 +1347,43 @@ public abstract class BaseConfigurationBuilderImpl { for (Component component : composite.getComponents()) { Implementation impl = component.getImplementation(); - for (Producer producer : impl.getProducers()) { - Reference reference = assemblyFactory.createReference(); - reference.setName(producer.getName()); - reference.setInterfaceContract(producer.getInterfaceContract()); - if (producer.getInterfaceContract() != null && producer.getInterfaceContract().getInterface() != null) - producer.getInterfaceContract().getInterface().setRemotable(true); - reference.setType(producer.getType()); - reference.getApplicablePolicySets().addAll(producer.getApplicablePolicySets()); - reference.getPolicySets().addAll(producer.getPolicySets()); - reference.getRequiredIntents().addAll(producer.getRequiredIntents()); - for (Binding binding : producer.getBindings()) { - EventBinding eventBinding = eventBindingFactory.createEventBinding(); - eventBinding.setBaseBinding(binding); - reference.getBindings().add(binding);// FIXME: remove - reference.getBindings().add(eventBinding); - } - impl.getReferences().add(reference); - } + if (impl != null) { + for (Producer producer : impl.getProducers()) { + Reference reference = assemblyFactory.createReference(); + reference.setName(producer.getName()); + reference.setInterfaceContract(producer.getInterfaceContract()); + if (producer.getInterfaceContract() != null && producer.getInterfaceContract().getInterface() != null) + producer.getInterfaceContract().getInterface().setRemotable(true); + reference.setType(producer.getType()); + reference.getApplicablePolicySets().addAll(producer.getApplicablePolicySets()); + reference.getPolicySets().addAll(producer.getPolicySets()); + reference.getRequiredIntents().addAll(producer.getRequiredIntents()); + for (Binding binding : producer.getBindings()) { + EventBinding eventBinding = eventBindingFactory.createEventBinding(); + eventBinding.setBaseBinding(binding); + reference.getBindings().add(binding);// FIXME: remove + reference.getBindings().add(eventBinding); + } + impl.getReferences().add(reference); + } + + for (Consumer consumer : impl.getConsumers()) { + Service service = assemblyFactory.createService(); + service.setName(consumer.getName()); + service.setInterfaceContract(consumer.getInterfaceContract()); + service.setType(consumer.getType()); + service.getApplicablePolicySets().addAll(consumer.getApplicablePolicySets()); + service.getPolicySets().addAll(consumer.getPolicySets()); + service.getRequiredIntents().addAll(consumer.getRequiredIntents()); + for (Binding binding : consumer.getBindings()) { + EventBinding eventBinding = eventBindingFactory.createEventBinding(); + eventBinding.setBaseBinding(binding); + service.getBindings().add(binding);// FIXME: remove + service.getBindings().add(eventBinding); + } + impl.getServices().add(service); + } + } for (Producer producer : component.getProducers()) { ComponentReference reference = assemblyFactory.createComponentReference(); @@ -1385,22 +1404,6 @@ public abstract class BaseConfigurationBuilderImpl { component.getReferences().add(reference); } - for (Consumer consumer : impl.getConsumers()) { - Service service = assemblyFactory.createService(); - service.setName(consumer.getName()); - service.setInterfaceContract(consumer.getInterfaceContract()); - service.setType(consumer.getType()); - service.getApplicablePolicySets().addAll(consumer.getApplicablePolicySets()); - service.getPolicySets().addAll(consumer.getPolicySets()); - service.getRequiredIntents().addAll(consumer.getRequiredIntents()); - for (Binding binding : consumer.getBindings()) { - EventBinding eventBinding = eventBindingFactory.createEventBinding(); - eventBinding.setBaseBinding(binding); - service.getBindings().add(binding);// FIXME: remove - service.getBindings().add(eventBinding); - } - impl.getServices().add(service); - } for (Consumer consumer : component.getConsumers()) { ComponentService service = assemblyFactory.createComponentService(); -- cgit v1.2.3