diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-28 21:01:41 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-28 21:01:41 +0000 |
commit | 9dafe3e2c4d2476cb3ea7789e3f3063418340059 (patch) | |
tree | fa543a6cc40ea6ec3ad43ee7f7bf0478685db344 /sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java | |
parent | 83d18d1113e87315181b6d9f1daba6146ad12cc9 (diff) |
Allow Spring WebApplicationContext to be used by Tuscany
Bring up a sample web application which demonstrates the integration between Spring and Tuscany
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980218 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java b/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java new file mode 100644 index 0000000000..4aa8cf5ebb --- /dev/null +++ b/sca-java-2.x/trunk/modules/implementation-spring-webapp/src/test/java/org/apache/tuscany/sca/implementation/spring/webapp/ApplicationContextAccessorTestCase.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.implementation.spring.webapp; + +import org.junit.Assert; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class ApplicationContextAccessorTestCase { + + @Test + public void testContext() { + ApplicationContext context = + new ClassPathXmlApplicationContext( + new String[] {"org/apache/tuscany/sca/implementation/spring/webapp/spring-webapp-context.xml"}); + Object accessor = context.getBean(ApplicationContextAccessor.BEAN_ID); + Assert.assertSame(ApplicationContextAccessor.getInstance(), accessor); + ApplicationContextAccessor contextAccessor = (ApplicationContextAccessor)accessor; + Assert.assertSame(context, contextAccessor.getApplicationContext()); + + } + +} |