From eec6912ddff319e4992a19064c470a4fdad1542b Mon Sep 17 00:00:00 2001 From: ramkumar Date: Fri, 3 Jul 2009 10:48:57 +0000 Subject: Updated fixes for TUSCANY-3069 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@790853 13f79535-47bb-0310-9956-ffa450edef68 --- .../context/multiple/MultipleContextTestCase.java | 3 +- .../sca/itest/spring/AbstractSCATestCase.java | 1 - .../spring/runtime/context/SpringContextTie.java | 40 ++++++++++------------ 3 files changed, 19 insertions(+), 25 deletions(-) (limited to 'branches') diff --git a/branches/sca-java-1.x/itest/spring/src/test/java/context/multiple/MultipleContextTestCase.java b/branches/sca-java-1.x/itest/spring/src/test/java/context/multiple/MultipleContextTestCase.java index 3ea2d0c207..75b296bf32 100644 --- a/branches/sca-java-1.x/itest/spring/src/test/java/context/multiple/MultipleContextTestCase.java +++ b/branches/sca-java-1.x/itest/spring/src/test/java/context/multiple/MultipleContextTestCase.java @@ -19,12 +19,11 @@ package context.multiple; import junit.framework.TestCase; -import org.junit.Ignore; + /** * Tests out the big bank service * */ -@Ignore("TUSCANY-3069") public class MultipleContextTestCase extends TestCase { public void testServer() throws Exception { diff --git a/branches/sca-java-1.x/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java b/branches/sca-java-1.x/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java index e9fc938d7c..a2698cf9a3 100644 --- a/branches/sca-java-1.x/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java +++ b/branches/sca-java-1.x/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java @@ -50,7 +50,6 @@ public abstract class AbstractSCATestCase extends TestCase { @Override protected void setUp() throws Exception { domain = SCADomain.newInstance("http://localhost", contributionLocation, compositeName); - //domain = SCADomain.newInstance(getCompositeName()); service = domain.getService(getServiceClass(), "ClientComponent"); } diff --git a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java index f250db1631..5961c52cc4 100644 --- a/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java +++ b/branches/sca-java-1.x/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java @@ -38,7 +38,6 @@ import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.xml.XmlBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.GenericApplicationContext; @@ -103,33 +102,30 @@ public class SpringContextTie { if (beanClassName.indexOf(".ClassPathXmlApplicationContext") != -1) { BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); - String[] listValues = null; + String[] configLocations = null; List conArgs = beanDef.getConstructorArgumentValues().getGenericArgumentValues(); for (ConstructorArgumentValues.ValueHolder conArg : conArgs) { - if (conArg.getValue() instanceof TypedStringValue) { - TypedStringValue value = (TypedStringValue) conArg.getValue(); - if (value.getValue().indexOf(".xml") != -1) - listValues = new String[]{value.getValue()}; - } - if (conArg.getValue() instanceof ManagedList) { - Iterator itml = ((ManagedList)conArg.getValue()).iterator(); - StringBuffer values = new StringBuffer(); - while (itml.hasNext()) { - TypedStringValue next = (TypedStringValue)itml.next(); - if (next.getValue().indexOf(".xml") != -1) { - values.append(next.getValue()); - values.append("~"); - } - } - listValues = (values.toString()).split("~"); + if (conArg.getValue() instanceof TypedStringValue) { + TypedStringValue value = (TypedStringValue) conArg.getValue(); + if (value.getValue().indexOf(".xml") != -1) + configLocations = new String[]{value.getValue()}; + } + if (conArg.getValue() instanceof ManagedList) { + Iterator itml = ((ManagedList)conArg.getValue()).iterator(); + StringBuffer values = new StringBuffer(); + while (itml.hasNext()) { + TypedStringValue next = (TypedStringValue)itml.next(); + if (next.getValue().indexOf(".xml") != -1) { + values.append(implementation.getClassLoader().getResource(next.getValue()).toString()); + values.append("~"); + } } + configLocations = (values.toString()).split("~"); + } } - appContext = new ClassPathXmlApplicationContext(listValues, false, scaParentContext); - appContext.setClassLoader(implementation.getClassLoader()); - appContext.refresh(); - //appContext.getBeanFactory().setBeanClassLoader(implementation.getClassLoader()); + appContext = new ClassPathXmlApplicationContext(configLocations, true, scaParentContext); if (isAnnotationSupported) includeAnnotationProcessors(appContext.getBeanFactory()); return appContext; -- cgit v1.2.3