cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r581606 - in /cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test: java/org/apache/cocoon/springosgi/test/FactoryExportTest.java resources/org/apache/cocoon/springosgi/test/factory-import.xml
Date Wed, 03 Oct 2007 14:03:35 GMT
Author: danielf
Date: Wed Oct  3 07:03:34 2007
New Revision: 581606

URL: http://svn.apache.org/viewvc?rev=581606&view=rev
Log:
Adding tests for importing bean factories.

Added:
    cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
  (with props)
Modified:
    cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/java/org/apache/cocoon/springosgi/test/FactoryExportTest.java

Modified: cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/java/org/apache/cocoon/springosgi/test/FactoryExportTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/java/org/apache/cocoon/springosgi/test/FactoryExportTest.java?rev=581606&r1=581605&r2=581606&view=diff
==============================================================================
--- cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/java/org/apache/cocoon/springosgi/test/FactoryExportTest.java
(original)
+++ cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/java/org/apache/cocoon/springosgi/test/FactoryExportTest.java
Wed Oct  3 07:03:34 2007
@@ -17,9 +17,6 @@
 
 import org.apache.cocoon.springosgi.simpleservice.SimpleService;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.springframework.beans.factory.SmartFactoryBean;
 import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests;
@@ -34,9 +31,9 @@
      /* (non-Javadoc)
      * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigLocations()
      */
-//    protected String[] getConfigLocations() {
-//        return this.configLocations;
-//    }
+    protected String[] getConfigLocations() {
+        return this.configLocations;
+    }
 
 	protected String getManifestLocation() { 
 		return "classpath:org/apache/cocoon/springosgi/test/simple-service.MF";
@@ -102,4 +99,21 @@
         }
     }
     
+    public void testFactoryImport() {
+        waitOnContextCreation("org.apache.cocoon.cocoon-spring-osgi-simple-service");
+        SimpleService simpleService = (SimpleService) this.applicationContext.getBean("simpleService.fe1");
+        assertNotNull("Service reference is null", simpleService);
+        assertEquals("fe1", simpleService.stringValue());
+    }
+
+    public void testPrototypeFactoryImport() {
+        waitOnContextCreation("org.apache.cocoon.cocoon-spring-osgi-simple-service");
+        SimpleService simpleService = (SimpleService) this.applicationContext.getBean("simpleService.fe2");
+        assertNotNull("Service reference is null", simpleService);
+        assertEquals("fe2", simpleService.stringValue());
+        SimpleService simpleService2 = (SimpleService) this.applicationContext.getBean("simpleService.fe2");
+        assertNotNull("Service reference is null", simpleService2);
+        assertEquals("fe2", simpleService2.stringValue());
+        assertNotSame(simpleService, simpleService2);
+    }
 }

Added: cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml?rev=581606&view=auto
==============================================================================
--- cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
(added)
+++ cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
Wed Oct  3 07:03:34 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!--+
+    | @version $Id$
+    +-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cosgi="http://cocoon.apache.org/schema/osgi"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
+                           http://cocoon.apache.org/schema/osgi http://cocoon.apache.org/schema/osgi/spring-osgi.xsd">
+
+  <cosgi:reference id="simpleService.fe1" interface="org.apache.cocoon.springosgi.simpleservice.SimpleService"
+	filter="(org.springframework.osgi.beanname=simpleService.fe1)" factory-export="true"/>
+
+  <cosgi:reference id="simpleService.fe2" interface="org.apache.cocoon.springosgi.simpleservice.SimpleService"
+	filter="(org.springframework.osgi.beanname=simpleService.fe2)" factory-export="true"/>
+
+</beans>
\ No newline at end of file

Propchange: cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/osgi/core/cocoon-spring-osgi/cocoon-spring-osgi-integration-test/src/test/resources/org/apache/cocoon/springosgi/test/factory-import.xml
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message