+ added integration tests
+ replaced org.sf to org.eclipse.gemini in various places including manifests/path/packages

git-svn-id: http://dev.eclipse.org/svnroot/rt/org.eclipse.gemini.blueprint/trunk@5 d5c50688-e17f-0410-abf2-532cdd3858a3
diff --git a/.gitignore b/.gitignore
index ed8cea1..7f56e4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 .svn
 target
 *.log
+*.bak*
 eclipse_config
\ No newline at end of file
diff --git a/core/template.mf b/core/template.mf
index 7204f20..5e79027 100644
--- a/core/template.mf
+++ b/core/template.mf
@@ -13,7 +13,7 @@
  org.osgi.service.packageadmin;version=1.2,

  org.osgi.service.startlevel;version=1.0;resolution:=optional,

  org.apache.commons.logging.*;version=${logging.version.range},

- org.eclipse.gemini.blueprint.*;version=${spring.osgi.version.range},

+ org.eclipse.gemini.blueprint.*;version=${gemini.blueprint.version.range},

  org.springframework.*;version=${spring.version.range},

  *;resolution:=optional

 Unversioned-Imports: 

diff --git a/extender/template.mf b/extender/template.mf
index c0ca1aa..6ea23cb 100644
--- a/extender/template.mf
+++ b/extender/template.mf
@@ -1,7 +1,7 @@
 Excluded-Exports: 

  *.internal*

 Import-Package: 

- org.springframework.osgi.extensions.annotation;resolution:=optional;version="${spring.osgi.version.range.nq}",

+ org.eclipse.gemini.blueprint.extensions.annotation;resolution:=optional;version="${gemini.blueprint.version.range.nq}",

  org.osgi.service.packageadmin;version=1.2,

  org.osgi.service.blueprint.container;version="1.0.0";resolution:=optional,

  org.osgi.service.blueprint.reflect;version="1.0.0";resolution:=optional

@@ -12,8 +12,8 @@
  org.osgi.service.event;version=1.1;resolution:=optional,

  org.osgi.util.tracker;version=1.3,

  org.apache.commons.logging.*;version=${logging.version.range},

- org.eclipse.gemini.blueprint.blueprint.*;version=${spring.osgi.version.range};resolution:=optional,

- org.eclipse.gemini.blueprint.*;version=${spring.osgi.version.range},

+ org.eclipse.gemini.blueprint.blueprint.*;version=${gemini.blueprint.version.range};resolution:=optional,

+ org.eclipse.gemini.blueprint.*;version=${gemini.blueprint.version.range},

  org.springframework.*;version=${spring.version.range},

  *;resolution:=optional

 Bundle-Activator: org.eclipse.gemini.blueprint.extender.internal.boot.ChainActivator

diff --git a/integration-tests/bundles/blueprint/config.bundle/pom.xml b/integration-tests/bundles/blueprint/config.bundle/pom.xml
new file mode 100644
index 0000000..6e0ea7c
--- /dev/null
+++ b/integration-tests/bundles/blueprint/config.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+    <artifactId>config.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Spring OSGi Blueprint Test Bundle: Configuration test bundle</name>
+    <description>An OSGi bundle that provides different configuration locations</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/blueprint/config.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/blueprint/config.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8a412f0
--- /dev/null
+++ b/integration-tests/bundles/blueprint/config.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Bundle-Version: 1.0

+Bundle-ManifestVersion: 2

+Bundle-SymbolicName: org.springframework.osgi.rfc124.iandt.config.bundle

+Bundle-Name: Config-Bundle

+Bundle-Vendor: SpringSource

+Blueprint-Bundle: config/
\ No newline at end of file
diff --git a/integration-tests/bundles/blueprint/config.bundle/src/main/resources/config/config.ignored b/integration-tests/bundles/blueprint/config.bundle/src/main/resources/config/config.ignored
new file mode 100644
index 0000000..e652d4e
--- /dev/null
+++ b/integration-tests/bundles/blueprint/config.bundle/src/main/resources/config/config.ignored
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="

+		http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

+		

+    <bean id="component" class="java.lang.Object"/>

+

+    <bean id="unicodeChar" class="java.lang.Character">

+        <argument value="\u2122"/>

+    </bean>

+    

+</blueprint>
\ No newline at end of file
diff --git a/integration-tests/bundles/blueprint/error.bundle/pom.xml b/integration-tests/bundles/blueprint/error.bundle/pom.xml
new file mode 100644
index 0000000..9424e6d
--- /dev/null
+++ b/integration-tests/bundles/blueprint/error.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+    <artifactId>error.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Spring OSGi Blueprint Test Bundle: Error bundle</name>
+    <description>An OSGi bundle that fails on startup</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/blueprint/error.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/blueprint/error.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6b22a94
--- /dev/null
+++ b/integration-tests/bundles/blueprint/error.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.rfc124.iandt.error.bundle
+Bundle-Name: Error Bundle
+Bundle-Vendor: SpringSource
diff --git a/integration-tests/bundles/blueprint/error.bundle/src/main/resources/OSGI-INF/blueprint/error.xml b/integration-tests/bundles/blueprint/error.bundle/src/main/resources/OSGI-INF/blueprint/error.xml
new file mode 100644
index 0000000..d33f836
--- /dev/null
+++ b/integration-tests/bundles/blueprint/error.bundle/src/main/resources/OSGI-INF/blueprint/error.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="

+		http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

+

+    <!--

+    <component id="failingComponent" class="non.existing.class"/>

+    -->

+    

+    <bean id="failingComponent" class="java.lang.Object" depends-on="missingComponent"/>

+    <foo invalid-xml/>

+   

+</blueprint>
\ No newline at end of file
diff --git a/integration-tests/bundles/blueprint/pom.xml b/integration-tests/bundles/blueprint/pom.xml
new file mode 100644
index 0000000..b20dcd7
--- /dev/null
+++ b/integration-tests/bundles/blueprint/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <parent>
+    <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+  <artifactId>bundles</artifactId>
+  <packaging>pom</packaging>
+  <name>Gemini Blueprint Integration Testing Bundles</name>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+  <properties>
+    <!-- root, empty package -->
+    <!-- plugin not yet enabled to avoid further problems -->
+	<spring.osgi.import.pkg>!org.springframework.osgi.blueprint.iandt, *</spring.osgi.import.pkg>
+	<spring.osgi.export.pkg>${pom.artifactId}*</spring.osgi.export.pkg>
+  	<clover.skip>true</clover.skip>
+  </properties>
+  
+  <!-- shared dependencies -->
+  <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+  </dependencies>
+  
+  <modules>
+    <module>simple.bundle</module>
+    <module>error.bundle</module>
+    <module>waiting.bundle</module>
+    <module>config.bundle</module>
+  </modules>
+
+ <build>
+    <plugins>
+	   <plugin>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>    
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+    
+ </build>
+
+</project>
diff --git a/integration-tests/bundles/blueprint/simple.bundle/pom.xml b/integration-tests/bundles/blueprint/simple.bundle/pom.xml
new file mode 100644
index 0000000..b0b2460
--- /dev/null
+++ b/integration-tests/bundles/blueprint/simple.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+    <artifactId>simple.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Spring OSGi Blueprint Test Bundle: Simple service test bundle</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8910832
--- /dev/null
+++ b/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.rfc124.iandt.simpleservice
+Bundle-Name: Simple-Service-Sample
+Bundle-Vendor: SpringSource
diff --git a/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/OSGI-INF/blueprint/simple.xml b/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/OSGI-INF/blueprint/simple.xml
new file mode 100644
index 0000000..bc71627
--- /dev/null
+++ b/integration-tests/bundles/blueprint/simple.bundle/src/main/resources/OSGI-INF/blueprint/simple.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="

+		http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

+

+   	<bean id="compProperties" class="java.util.Properties">

+		<argument value="Name=John" type="java.util.Properties"/>

+	</bean>

+		

+    <bean id="component" class="java.lang.Object"/>

+

+    <bean id="unicodeChar" class="java.lang.Character">

+        <argument value="\u2122"/>

+    </bean>

+    

+</blueprint>
\ No newline at end of file
diff --git a/integration-tests/bundles/blueprint/waiting.bundle/pom.xml b/integration-tests/bundles/blueprint/waiting.bundle/pom.xml
new file mode 100644
index 0000000..3d73ffc
--- /dev/null
+++ b/integration-tests/bundles/blueprint/waiting.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+        <artifactId>bundles</artifactId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt.blueprint</groupId>
+    <artifactId>waiting.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Spring OSGi Blueprint Test Bundle: Waiting bundle</name>
+    <description>An OSGi bundle that waits (quickly) on startup</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d7343f9
--- /dev/null
+++ b/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.rfc124.iandt.waiting.bundle;blueprint.timeout:=1000
+Bundle-Name: Waiting Bundle
+Bundle-Vendor: SpringSource
diff --git a/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/OSGI-INF/blueprint/config.xml b/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/OSGI-INF/blueprint/config.xml
new file mode 100644
index 0000000..6f09268
--- /dev/null
+++ b/integration-tests/bundles/blueprint/waiting.bundle/src/main/resources/OSGI-INF/blueprint/config.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

+

+    

+    <reference id="shape" interface="java.awt.Shape"/>

+   

+</blueprint>
\ No newline at end of file
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/.classpath b/integration-tests/bundles/cardinality.0to1.bundle/.classpath
new file mode 100644
index 0000000..3e1c441
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/Simple Service Bundle"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/cardinality.0to1.bundle/.project b/integration-tests/bundles/cardinality.0to1.bundle/.project
new file mode 100644
index 0000000..70791bf
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Cardinality 0..1 Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/cardinality.0to1.bundle/pom.xml b/integration-tests/bundles/cardinality.0to1.bundle/pom.xml
new file mode 100644
index 0000000..2f3a941
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>cardinality0to1</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context service reference cardinality 0..1 bundle</name>
+    <description>An OSGi bundle that tests the service reference cardinality value 0..1</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/MyListener.java b/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/MyListener.java
new file mode 100644
index 0000000..254202e
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/MyListener.java
@@ -0,0 +1,40 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cardinality0to1.test;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;
+import java.util.Dictionary;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 6, 2006
+ *         Time: 6:17:21 PM
+ */
+public class MyListener {
+    public static int BOUND_COUNT = 0;
+    public static int UNBOUND_COUNT = 0;
+
+
+    public void serviceAvailable(MyService2 simpleService, Dictionary properties) {
+        BOUND_COUNT++;
+    }
+
+
+    public void serviceUnavailable(MyService2 simpleService, Dictionary properties) {
+        UNBOUND_COUNT++;
+    }
+}
+
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/ReferenceContainer.java b/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/ReferenceContainer.java
new file mode 100644
index 0000000..631a5d4
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/test/ReferenceContainer.java
@@ -0,0 +1,32 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cardinality0to1.test;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Apr 16, 2007
+ *         Time: 3:23:40 PM
+ */
+public class ReferenceContainer {
+    public static MyService2 service;
+
+
+    public void setSimpleService(MyService2 simpleService) {
+        service = simpleService;
+    }
+}
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/Backup 1 of MANIFEST.MF b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/Backup 1 of MANIFEST.MF
new file mode 100644
index 0000000..818f85e
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/Backup 1 of MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.cardinality.0to1
+Bundle-Name: cardinality_0__1
+Bundle-Vendor: Spring Framework
+Bundle-ManifestVersion: 2
+Import-Package: org.springframework.osgi.iandt.simpleservice2
+Export-Package: org.springframework.osgi.iandt.cardinality0to1.test
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..79ac0d2
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.cardinality.0to1
+Bundle-Name: cardinality_0__1
+Bundle-Vendor: Spring Framework
+Bundle-ManifestVersion: 2
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice2
+Export-Package: org.eclipse.gemini.blueprint.iandt.cardinality0to1.test
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/Backup 1 of cardinality0to1.xml b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/Backup 1 of cardinality0to1.xml
new file mode 100644
index 0000000..3566a0c
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/Backup 1 of cardinality0to1.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.springframework.osgi.iandt.cardinality0to1.test.MyListener"/>
+    <bean id="my-container" class="org.springframework.osgi.iandt.cardinality0to1.test.ReferenceContainer">
+        <property name="simpleService" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi"
+                    interface="org.springframework.osgi.iandt.simpleservice2.MyService2"
+                    cardinality="0..1"
+                    timeout="10">
+        <osgi:reference-listener bind-method="serviceAvailable" unbind-method="serviceUnavailable" ref="listener"/>
+    </osgi:reference>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/cardinality0to1.xml b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/cardinality0to1.xml
new file mode 100644
index 0000000..e9fcf11
--- /dev/null
+++ b/integration-tests/bundles/cardinality.0to1.bundle/src/main/resources/META-INF/spring/cardinality0to1.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.MyListener"/>
+    <bean id="my-container" class="org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.ReferenceContainer">
+        <property name="simpleService" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi"
+                    interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2"
+                    cardinality="0..1"
+                    timeout="10">
+        <osgi:reference-listener bind-method="serviceAvailable" unbind-method="serviceUnavailable" ref="listener"/>
+    </osgi:reference>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/async.nowait.bundle/pom.xml b/integration-tests/bundles/config.bundle/async.nowait.bundle/pom.xml
new file mode 100644
index 0000000..ca7d203
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.nowait.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>async-nowait-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Async-NoWait-Bundle</name>
+    <description>Test bundle for Async NoWait behaviour</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..943a30d
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.async.nowait
+Bundle-Name: async-nowait
+Bundle-Vendor: Spring Framework
+Spring-Context: *;wait-for-dependencies:=false;create-asynchronously:=true

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..d67d04c
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.nowait.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <!-- seconds -->
+    <osgi:reference id="button" interface="java.awt.Shape" timeout="500"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/async.wait.bundle/pom.xml b/integration-tests/bundles/config.bundle/async.wait.bundle/pom.xml
new file mode 100644
index 0000000..da4ea81
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.wait.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>async-wait-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Async-Wait-Bundle</name>
+    <description>Test bundle for Async Wait behaviour</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..60824a9
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.async.wait
+Bundle-Name: async-wait
+Bundle-Vendor: Spring Framework
+Spring-Context: *;wait-for-dependencies:=true;create-asynchronously:=true

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..0a76b03
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/async.wait.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <!-- mili-seconds -->
+    <osgi:reference id="button" interface="java.awt.Shape" timeout="30"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/no.publish.bundle/pom.xml b/integration-tests/bundles/config.bundle/no.publish.bundle/pom.xml
new file mode 100644
index 0000000..868e654
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/no.publish.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>nopublish-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: NoPublish-Bundle</name>
+    <description>Test bundle for NoPublish behaviour</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..44716b6
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.nopublish
+Bundle-Name: nopublish
+Bundle-Vendor: Spring Framework
+Spring-Context: *;publish-context:=false

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..fcdd4bb
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/no.publish.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="point" class="java.awt.Point" lazy-init="false"/>
+
+    <osgi:service ref="point" auto-export="all-classes"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/pom.xml b/integration-tests/bundles/config.bundle/pom.xml
new file mode 100644
index 0000000..a9992ce
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <parent>
+    <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>

+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <artifactId>config.bundle</artifactId>
+  <packaging>pom</packaging>
+  <name>Gemini Blueprint Test Bundle: Integration testing bundles for configuration options</name>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+  <properties>
+    <!-- root, empty package -->
+    <!-- plugin not yet enabled to avoid further problems -->
+	<spring.osgi.import.pkg>!org.eclipse.gemini.blueprint.iandt, *</spring.osgi.import.pkg>
+	<spring.osgi.export.pkg>${pom.artifactId}*</spring.osgi.export.pkg>
+  </properties>
+  
+  <!-- shared dependencies -->
+  <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-core</artifactId>
+            <version>${project.parent.version}</version>
+            <type>jar</type>
+            <scope>provided</scope>
+        </dependency>
+  </dependencies>
+  
+  <modules>
+    <module>no.publish.bundle</module>

+    <module>async.nowait.bundle</module>
+	<module>async.wait.bundle</module>
+    <module>sync.nowait.bundle</module>
+	<module>sync.tail.bundle</module>    
+    <module>sync.wait.bundle</module>

+  </modules>
+
+
+ <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+    
+ </build>
+
+   <!-- the above doesn't work, so we spell it out in full below
+  <reporting>
+   <excludeDefaults>true</excludeDefaults>
+   <plugins>
+     <plugin>
+       <groupId>org.apache.maven.plugins</groupId>
+       <artifactId>maven-project-info-reports-plugin</artifactId>
+       <inherited>true</inherited>
+       <reportSets>
+        <reportSet></reportSet>
+       </reportSets>
+     </plugin>   
+	<plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+        <excludePackageNames>*</excludePackageNames>
+        </configuration>
+     </plugin>   
+   </plugins>
+  </reporting>
+  -->
+</project>
diff --git a/integration-tests/bundles/config.bundle/sync.nowait.bundle/pom.xml b/integration-tests/bundles/config.bundle/sync.nowait.bundle/pom.xml
new file mode 100644
index 0000000..bf15c3f
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.nowait.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>sync-nowait-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Sync-NoWait-Bundle</name>
+    <description>NoWait test bundle</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/java/org/springframework/osgi/iandt/wait/User.java b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/java/org/springframework/osgi/iandt/wait/User.java
new file mode 100644
index 0000000..e11d430
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/java/org/springframework/osgi/iandt/wait/User.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.wait;

+

+import java.awt.Shape;

+

+/**

+ * @author Costin Leau

+ */

+public class User {

+

+	public void setTarget(Shape shape) {

+		shape.getBounds();

+	}

+}

diff --git a/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a555216
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.sync-nowait
+Bundle-Name: sync-nowait
+Bundle-Vendor: Spring Framework
+Spring-Context: *;wait-for-dependencies:=false;create-asynchronously:=false;timeout:=2

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..bf9c45b
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.nowait.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <!-- import shape -->
+    <osgi:reference id="shape" interface="java.awt.Shape" timeout="300"/>
+    
+    <bean id="user" class="org.springframework.osgi.iandt.wait.User">
+        <property name="target" ref="shape"/>
+    </bean>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/sync.tail.bundle/pom.xml b/integration-tests/bundles/config.bundle/sync.tail.bundle/pom.xml
new file mode 100644
index 0000000..4a45af4
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.tail.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>sync-tail-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Sync-Tail-Bundle</name>
+    <description>Utililty test bundle for synch testing</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5816373
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.sync-tail
+Bundle-Name: sync-tail
+Bundle-Vendor: Spring Framework
+Spring-Context: *;create-asynchronously:=false;timeout:=5

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..060d8b7
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.tail.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="area" class="java.awt.geom.Area" lazy-init="false"/>
+
+    <!-- export area -->
+    <osgi:service ref="area" auto-export="all-classes"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.bundle/sync.wait.bundle/pom.xml b/integration-tests/bundles/config.bundle/sync.wait.bundle/pom.xml
new file mode 100644
index 0000000..9d4c5d9
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.wait.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>config.bundle</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>sync-wait-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Sync-Wait-Bundle</name>
+    <description>Wait test bundle</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9ee6efc
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-SymbolicName: org.springframework.osgi.iandt.config-opt.sync-wait
+Bundle-Name: sync-wait
+Bundle-Vendor: Spring Framework
+Spring-Context: *;wait-for-dependencies:=true;create-asynchronously:=false;timeout:=2

+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..154d3d5
--- /dev/null
+++ b/integration-tests/bundles/config.bundle/sync.wait.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <!-- import shape -->
+    <osgi:reference id="shape" interface="java.awt.Shape" timeout="300"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/config.file.with.dots.bundle/pom.xml b/integration-tests/bundles/config.file.with.dots.bundle/pom.xml
new file mode 100644
index 0000000..7964684
--- /dev/null
+++ b/integration-tests/bundles/config.file.with.dots.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>config-with-dots.bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Config File With Dots bundle</name>
+    <description>Simple bundle that uses a configuration file containing dots</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..0887389
--- /dev/null
+++ b/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.config.with.dots
+Bundle-Name: Configuration File with Dots
+Bundle-Vendor: Spring Framework
\ No newline at end of file
diff --git a/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/spring/config.file.with.dots.xml b/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/spring/config.file.with.dots.xml
new file mode 100644
index 0000000..adbd87d
--- /dev/null
+++ b/integration-tests/bundles/config.file.with.dots.bundle/src/main/resources/META-INF/spring/config.file.with.dots.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="area" interface="java.awt.Shape"/>
+
+    <bean id="area" class="java.awt.geom.Area"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/configuration.test.bundle/.classpath b/integration-tests/bundles/configuration.test.bundle/.classpath
new file mode 100644
index 0000000..105bcab
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/configuration.test.bundle/.project b/integration-tests/bundles/configuration.test.bundle/.project
new file mode 100644
index 0000000..64ccb73
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>ManagedFactory Configuration Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/configuration.test.bundle/pom.xml b/integration-tests/bundles/configuration.test.bundle/pom.xml
new file mode 100644
index 0000000..5f2e90d
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>configuration</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Configuration test bundle</name>
+    <description>A test bundle for the atomic updates of service and factory configuration changes</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceFactoryListener.java b/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceFactoryListener.java
new file mode 100644
index 0000000..ca83562
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceFactoryListener.java
@@ -0,0 +1,63 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.configuration;
+
+import java.util.*;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Jun 14, 2007
+ *         Time: 5:30:29 PM
+ */
+public class ManagedServiceFactoryListener {
+    public final static List updates = new ArrayList();
+    public final static List deletes = new ArrayList();
+
+    public static final String SERVICE_FACTORY_PID = "test.service.factory.pid";
+
+
+    public void updateFactory(String instancePid, Dictionary properties) {
+        if (properties.isEmpty()) {
+            return;
+        }
+        Dictionary copy = new Hashtable();
+        for (Enumeration keys = properties.keys(); keys.hasMoreElements();) {
+            Object key = keys.nextElement();
+            copy.put(key, properties.get(key));
+        }
+        updates.add(new Object[]{instancePid, copy});
+
+    }
+
+
+    public void updateFactoryMap(String instancePid, Map properties) {
+        if (properties.isEmpty()) {
+            return;
+        }
+        Dictionary copy = new Hashtable();
+        for (Iterator keys = properties.keySet().iterator(); keys.hasNext();) {
+            Object key = keys.next();
+            copy.put(key, properties.get(key));
+        }
+        updates.add(new Object[]{instancePid, copy});
+
+    }
+
+
+    public void deleteFactory(String instancePid) {
+        deletes.add(instancePid);
+    }
+}
diff --git a/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceListener.java b/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceListener.java
new file mode 100644
index 0000000..a1cc329
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/src/main/java/org/springframework/osgi/iandt/configuration/ManagedServiceListener.java
@@ -0,0 +1,55 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.configuration;
+
+import java.util.*;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Jun 14, 2007
+ *         Time: 5:30:05 PM
+ */
+public class ManagedServiceListener {
+    public final static List updates = new ArrayList();
+
+    public static final String SERVICE_FACTORY_PID = "test.service.pid";
+
+
+    public void updateService(Dictionary properties) {
+        if (properties.isEmpty()) {
+            return;
+        }
+        Dictionary copy = new Hashtable();
+        for (Enumeration keys = properties.keys(); keys.hasMoreElements();) {
+            Object key = keys.nextElement();
+            copy.put(key, properties.get(key));
+        }
+        updates.add(copy);
+    }
+
+
+    public void updateServiceMap(Map properties) {
+        if (properties.isEmpty()) {
+            return;
+        }
+        Dictionary copy = new Hashtable();
+        for (Iterator keys = properties.keySet().iterator(); keys.hasNext();) {
+            Object key = keys.next();
+            copy.put(key, properties.get(key));
+        }
+        updates.add(copy);
+    }
+}
diff --git a/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1810f38
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.configuration
+Bundle-Name: Atomic configuration update test
+Bundle-Vendor: Spring Framework
+Export-Package: org.springframework.osgi.iandt.configuration
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/spring/config.xml b/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/spring/config.xml
new file mode 100644
index 0000000..770d74d
--- /dev/null
+++ b/integration-tests/bundles/configuration.test.bundle/src/main/resources/META-INF/spring/config.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                      		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+

+    <osgix:config-properties persistent-id="test.service.pid">
+        <osgix:config-listener ref="service" update-method="updateService"/>
+        <osgix:config-listener ref="service" update-method="updateServiceMap"/>
+    </osgix:config-properties>
+    
+    <osgix:config-properties persistent-id="test.service.factory.pid" factory="true">
+        <osgix:config-listener ref="factory" update-method="updateFactory"/>
+        <osgix:config-listener ref="factory" update-method="updateFactoryMap"/>
+    </osgix:config-properties>
+
+    <bean id="service"
+          class="org.springframework.osgi.iandt.configuration.ManagedServiceListener"
+          lazy-init="false"/>
+
+    <bean id="factory"
+          class="org.springframework.osgi.iandt.configuration.ManagedServiceFactoryListener"
+          lazy-init="false"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/deadlock.bundle/pom.xml b/integration-tests/bundles/deadlock.bundle/pom.xml
new file mode 100644
index 0000000..6c2bead
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>deadlock</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Deadlock bundle</name>
+    <description>A test bundle which will force a deadlock in context creation</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/A.java b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/A.java
new file mode 100644
index 0000000..e1e6231
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/A.java
@@ -0,0 +1,65 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.deadlock;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Jun 5, 2007
+ *         Time: 8:48:43 PM
+ */
+public class A implements Test {
+    public static final Object lockA = new Object();
+
+
+    static {
+        Runnable runnable = new Runnable() {
+
+            public void run() {
+                while (true) {
+                    synchronized (lockA) {
+                        synchronized (B.lockB) {
+                            try {
+                                Thread.sleep(300 * 1000); // five minutes
+                            } catch (InterruptedException e) {
+                                // We're mean and ignoring the InterruptedException
+                            }
+                        }
+                    }
+                }
+            }
+        };
+        Thread t = new Thread(runnable, "deadlock A");
+        t.setDaemon(true);
+        t.start();
+        Thread.yield();
+    }
+
+    private B b;
+
+
+    public void setB(B b) {
+        synchronized(lockA) {
+            synchronized(B.lockB) {
+                this.b = b;    
+            }
+        }
+    }
+
+    public String someMethod() {
+        return b.toString();
+    }
+
+}
diff --git a/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/B.java b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/B.java
new file mode 100644
index 0000000..0fe586e
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/B.java
@@ -0,0 +1,66 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.deadlock;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Jun 5, 2007
+ *         Time: 8:48:51 PM
+ */
+public class B {
+    public static final Object lockB = new Object();
+
+
+    static {
+        Runnable runnable = new Runnable() {
+
+            public void run() {
+                while (true) {
+                    synchronized (lockB) {
+                        synchronized (A.lockA) {
+                            try {
+                                Thread.sleep(300 * 1000); // five minutes
+                            } catch (InterruptedException e) {
+                                // We're mean and ignoring the InterruptedException
+                            }
+                        }
+                    }
+                }
+            }
+        };
+        Thread t = new Thread(runnable, "deadlock B");
+        t.setDaemon(true);
+        t.start();
+        Thread.yield();
+    }
+
+
+    private A a;
+
+
+    public void setA(A a) {
+        synchronized (lockB) {
+            synchronized (A.lockA) {
+                this.a = a;
+            }
+        }
+    }
+
+
+    public String toString() {
+        return a.toString();
+    }
+}
diff --git a/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/Test.java b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/Test.java
new file mode 100644
index 0000000..9ba0e1f
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/src/main/java/org/springframework/osgi/iandt/deadlock/Test.java
@@ -0,0 +1,25 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.deadlock;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Jun 5, 2007
+ *         Time: 8:48:57 PM
+ */
+public interface Test {
+    String someMethod();
+}
diff --git a/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..adc4253
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.deadlock
+Bundle-Name: Purposeful Deadlock
+Bundle-Vendor: Spring Framework
+Spring-Context: *;
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/spring/deadlock.xml b/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/spring/deadlock.xml
new file mode 100644
index 0000000..d4f8e3a
--- /dev/null
+++ b/integration-tests/bundles/deadlock.bundle/src/main/resources/META-INF/spring/deadlock.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="culprit" interface="org.springframework.osgi.iandt.deadlock.Test"/>
+
+    <bean id="culprit" class="org.springframework.osgi.iandt.deadlock.A" lazy-init="false">
+        <property name="b" ref="amigo"/>
+    </bean>
+
+    <bean id="amigo" class="org.springframework.osgi.iandt.deadlock.B" lazy-init="false">
+        <property name="a" ref="culprit"/>   
+    </bean>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.factory.bundle/pom.xml b/integration-tests/bundles/dependency.factory.bundle/pom.xml
new file mode 100644
index 0000000..1fc2b81
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>dependendencies.factory</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service created by a factory which has a non trivial delay in createObject()</name>
+    <description>Simple service created by a factory which has a non trivial delay in createObject()</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url> 
+
+</project>
+
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java
new file mode 100644
index 0000000..f9e4453
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java
@@ -0,0 +1,62 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependencies.factory;
+
+import org.springframework.beans.factory.SmartFactoryBean;
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 8:41:19 AM
+ */
+public class MyServiceFactory implements SmartFactoryBean {
+
+    protected MyService service = new MyService() {
+        public String stringValue() {
+            return "Hello World";
+        }
+    };
+    private static final String DELAY_PROP = "org.eclipse.gemini.blueprint.iandt.dependencies.factory.delay"; 
+
+    public Object getObject() throws Exception {
+        Integer delay = Integer.getInteger(DELAY_PROP, new Integer(0));
+        System.getProperties().remove(DELAY_PROP);
+        System.out.println("Delaying for:" + delay);
+        Thread.sleep(delay.intValue());
+        return service;
+    }
+
+
+    public Class<?> getObjectType() {
+        return MyService.class;
+    }
+
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+
+    public boolean isPrototype() {
+        return false;
+    }
+
+
+    public boolean isEagerInit() {
+        return true;
+    }
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java.bak
new file mode 100644
index 0000000..5d7645b
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/factory/MyServiceFactory.java.bak
@@ -0,0 +1,62 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.dependencies.factory;
+
+import org.springframework.beans.factory.SmartFactoryBean;
+import org.springframework.osgi.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 8:41:19 AM
+ */
+public class MyServiceFactory implements SmartFactoryBean {
+
+    protected MyService service = new MyService() {
+        public String stringValue() {
+            return "Hello World";
+        }
+    };
+    private static final String DELAY_PROP = "org.springframework.osgi.iandt.dependencies.factory.delay"; 
+
+    public Object getObject() throws Exception {
+        Integer delay = Integer.getInteger(DELAY_PROP, new Integer(0));
+        System.getProperties().remove(DELAY_PROP);
+        System.out.println("Delaying for:" + delay);
+        Thread.sleep(delay.intValue());
+        return service;
+    }
+
+
+    public Class<?> getObjectType() {
+        return MyService.class;
+    }
+
+
+    public boolean isSingleton() {
+        return true;
+    }
+
+
+    public boolean isPrototype() {
+        return false;
+    }
+
+
+    public boolean isEagerInit() {
+        return true;
+    }
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java
new file mode 100644
index 0000000..65c3355
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:43:02 AM
+ */
+public interface MyService {
+
+	String stringValue();
+
+}
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java.bak
new file mode 100644
index 0000000..4484b1b
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java.bak
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.simpleservice;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:43:02 AM
+ */
+public interface MyService {
+
+	String stringValue();
+
+}
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java
new file mode 100644
index 0000000..47df4c1
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:43:47 AM
+ */
+public interface MyService2 {
+
+	String stringValue();
+
+    void voidMethod();
+
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java.bak
new file mode 100644
index 0000000..7c3165c
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java.bak
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.simpleservice2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:43:47 AM
+ */
+public interface MyService2 {
+
+	String stringValue();
+
+    void voidMethod();
+
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java
new file mode 100644
index 0000000..766cded
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice2.impl;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:48:04 AM
+ */
+public class MyService2Impl implements MyService2 {
+    public String stringValue() {
+        return "Finklestein.  Bartholomew Finklestein";
+    }
+
+    public void voidMethod() {
+        System.out.println("void method called");
+    }
+
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java.bak
new file mode 100644
index 0000000..32b13ad
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java.bak
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.simpleservice2.impl;
+
+import org.springframework.osgi.iandt.simpleservice2.MyService2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Aug 27, 2007
+ *         Time: 9:48:04 AM
+ */
+public class MyService2Impl implements MyService2 {
+    public String stringValue() {
+        return "Finklestein.  Bartholomew Finklestein";
+    }
+
+    public void voidMethod() {
+        System.out.println("void method called");
+    }
+
+}
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d9e9e6d
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.dependencies.factory
+Bundle-Name: Simple-Service created by factory
+Bundle-Vendor: Spring Framework
+Spring-Context: *;
+Import-Package: org.springframework.beans.factory
+Export-Package: org.eclipse.gemini.blueprint.iandt.simpleservice, org.eclipse.gemini.blueprint.iandt.simpleservice2,
+  org.eclipse.gemini.blueprint.iandt.simpleservice2.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..c7ff347
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,11 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.dependencies.factory
+Bundle-Name: Simple-Service created by factory
+Bundle-Vendor: Spring Framework
+Spring-Context: *;
+Import-Package: org.springframework.beans.factory
+Export-Package: org.springframework.osgi.iandt.simpleservice, org.springframework.osgi.iandt.simpleservice2,
+  org.springframework.osgi.iandt.simpleservice2.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml
new file mode 100644
index 0000000..a3eb247
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean name="factory" class="org.eclipse.gemini.blueprint.iandt.dependencies.factory.MyServiceFactory"/>
+
+    <osgi:service id="factoryCreatedObjectExportedToOSGi" ref="factory"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml.bak b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml.bak
new file mode 100644
index 0000000..8b7335e
--- /dev/null
+++ b/integration-tests/bundles/dependency.factory.bundle/src/main/resources/META-INF/spring/factory-dependency.xml.bak
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean name="factory" class="org.springframework.osgi.iandt.dependencies.factory.MyServiceFactory"/>
+
+    <osgi:service id="factoryCreatedObjectExportedToOSGi" ref="factory"
+                  interface="org.springframework.osgi.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.test.bundle/.classpath b/integration-tests/bundles/dependency.test.bundle/.classpath
new file mode 100644
index 0000000..30f35c2
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/.classpath
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service2/rfc-124-1.0-SNAPSHOT/simple.service2-rfc-124-1.0-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service/rfc-124-1.0-SNAPSHOT/simple.service-rfc-124-1.0-SNAPSHOT.jar"/>

+	<classpathentry kind="output" path="target/classes"/>
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service2/1.2-0-m2-SNAPSHOT/simple.service2-1.2-0-m2-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service/1.2-0-m2-SNAPSHOT/simple.service-1.2-0-m2-SNAPSHOT.jar"/>

+</classpath>
diff --git a/integration-tests/bundles/dependency.test.bundle/.project b/integration-tests/bundles/dependency.test.bundle/.project
new file mode 100644
index 0000000..94925b2
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Service Dependency Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/dependency.test.bundle/pom.xml b/integration-tests/bundles/dependency.test.bundle/pom.xml
new file mode 100644
index 0000000..17b495a
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/pom.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>dependencies</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context dependencies test bundle</name>
+    <description>An OSGi bundle that tests the service dependency mechanism</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+  
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service2</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java
new file mode 100644
index 0000000..b670a5c
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java
@@ -0,0 +1,25 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependencies;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:46:34 PM
+ */
+public interface Dependent {
+    boolean isResolved();
+}
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java.bak b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java.bak
new file mode 100644
index 0000000..4a6ecb5
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/Dependent.java.bak
@@ -0,0 +1,25 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.dependencies;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:46:34 PM
+ */
+public interface Dependent {
+    boolean isResolved();
+}
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java
new file mode 100644
index 0000000..fad1110
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java
@@ -0,0 +1,49 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependencies;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:39:40 PM
+ */
+public class DependentImpl implements Dependent {
+    private MyService service1;
+    private MyService2 service2;
+    private MyService2 service3;
+
+
+    public void setService1(MyService service1) {
+        this.service1 = service1;
+    }
+
+    public void setService2(MyService2 service2) {
+        this.service2 = service2;
+    }
+
+
+    public void setService3(MyService2 service3) {
+        this.service3 = service3;
+    }
+
+
+    public boolean isResolved() {
+        return service2 != null && service3 != null && service1 != null;
+    }
+}
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java.bak b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java.bak
new file mode 100644
index 0000000..8beff45
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependencies/DependentImpl.java.bak
@@ -0,0 +1,49 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.dependencies;
+
+import org.springframework.osgi.iandt.simpleservice2.MyService2;
+import org.springframework.osgi.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:39:40 PM
+ */
+public class DependentImpl implements Dependent {
+    private MyService service1;
+    private MyService2 service2;
+    private MyService2 service3;
+
+
+    public void setService1(MyService service1) {
+        this.service1 = service1;
+    }
+
+    public void setService2(MyService2 service2) {
+        this.service2 = service2;
+    }
+
+
+    public void setService3(MyService2 service3) {
+        this.service3 = service3;
+    }
+
+
+    public boolean isResolved() {
+        return service2 != null && service3 != null && service1 != null;
+    }
+}
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..60a6a3d
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Name: org-springframework-osgi-iandt-dependencies
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.dependencies
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Spring-Context: *; eagerly-init-importers:=true
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice,
+  org.eclipse.gemini.blueprint.iandt.simpleservice2
+Export-Package: org.eclipse.gemini.blueprint.iandt.dependencies
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..61419b1
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,9 @@
+Bundle-Name: org-springframework-osgi-iandt-dependencies
+Bundle-SymbolicName: org.springframework.osgi.iandt.dependencies
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Spring-Context: *; eagerly-init-importers:=true
+Import-Package: org.springframework.osgi.iandt.simpleservice,
+  org.springframework.osgi.iandt.simpleservice2
+Export-Package: org.springframework.osgi.iandt.dependencies
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml
new file mode 100644
index 0000000..b4cc8f8
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="dependent" interface="org.eclipse.gemini.blueprint.iandt.dependencies.Dependent"/>
+   
+
+    <osgi:reference id="simpleService3"
+                    interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2"
+                    filter="(service=3)"/>
+
+    <osgi:reference id="simpleService2"
+                    interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2"
+                    filter="(service=2)"/>
+
+	<osgi:reference interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService" id="nested"/>
+	
+    <bean id="dependent" class="org.eclipse.gemini.blueprint.iandt.dependencies.DependentImpl" lazy-init="false">
+        <property name="service2" ref="simpleService2"/>
+        <property name="service3" ref="simpleService3"/>
+        <property name="service1">
+				<ref bean="nested"/>
+        </property>
+    </bean>
+    
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml.bak b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml.bak
new file mode 100644
index 0000000..b298a59
--- /dev/null
+++ b/integration-tests/bundles/dependency.test.bundle/src/main/resources/META-INF/spring/dependencies.xml.bak
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="dependent" interface="org.springframework.osgi.iandt.dependencies.Dependent"/>
+   
+
+    <osgi:reference id="simpleService3"
+                    interface="org.springframework.osgi.iandt.simpleservice2.MyService2"
+                    filter="(service=3)"/>
+
+    <osgi:reference id="simpleService2"
+                    interface="org.springframework.osgi.iandt.simpleservice2.MyService2"
+                    filter="(service=2)"/>
+
+	<osgi:reference interface="org.springframework.osgi.iandt.simpleservice.MyService" id="nested"/>
+	
+    <bean id="dependent" class="org.springframework.osgi.iandt.dependencies.DependentImpl" lazy-init="false">
+        <property name="service2" ref="simpleService2"/>
+        <property name="service3" ref="simpleService3"/>
+        <property name="service1">
+				<ref bean="nested"/>
+        </property>
+    </bean>
+    
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/embedded.ns.bundle/.classpath b/integration-tests/bundles/embedded.ns.bundle/.classpath
new file mode 100644
index 0000000..5f5cc3d
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/spring-osgi-test-support"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar" sourcepath="/SPRING_SRC"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/embedded.ns.bundle/.project b/integration-tests/bundles/embedded.ns.bundle/.project
new file mode 100644
index 0000000..6e6b927
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Embedded Namespace Library</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/embedded.ns.bundle/pom.xml b/integration-tests/bundles/embedded.ns.bundle/pom.xml
new file mode 100644
index 0000000..c5acdee
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>ns.embedded</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: namespace test bundle</name>
+    <description>A simple namespace library (which gets embedded inside a bundle classpath)</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/embedded.ns.bundle/readme.txt b/integration-tests/bundles/embedded.ns.bundle/readme.txt
new file mode 100644
index 0000000..97cbca1
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/readme.txt
@@ -0,0 +1,3 @@
+this module should not be part of the maven build

+it is only used by the namespace integration test which requires the compiled

+artifact on the bundle classpath
\ No newline at end of file
diff --git a/integration-tests/bundles/embedded.ns.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/namespace/config/DummyNamespaceHandler.java b/integration-tests/bundles/embedded.ns.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/namespace/config/DummyNamespaceHandler.java
new file mode 100644
index 0000000..d889b19
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/namespace/config/DummyNamespaceHandler.java
@@ -0,0 +1,43 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.namespace.config;

+

+import org.springframework.beans.factory.config.BeanDefinition;

+import org.springframework.beans.factory.config.BeanDefinitionHolder;

+import org.springframework.beans.factory.xml.NamespaceHandler;

+import org.springframework.beans.factory.xml.ParserContext;

+import org.w3c.dom.Element;

+import org.w3c.dom.Node;

+

+/**

+ * Empty implementation used for testing only.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class DummyNamespaceHandler implements NamespaceHandler {

+

+	public BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder definition, ParserContext parserContext) {

+		return null;

+	}

+

+	public void init() {

+	}

+

+	public BeanDefinition parse(Element element, ParserContext parserContext) {

+		return null;

+	}

+

+}

diff --git a/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9c9e8a3
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Name: namespace-test

+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.ns.embedded

+Bundle-Version: 1.0

+Bundle-ManifestVersion: 2

+Import-Package: org.springframework.beans.factory.config,

+ org.springframework.beans.factory.xml,

+ org.w3c.dom

+

diff --git a/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.handlers b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000..e7d4fb9
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/osgi/test=org.eclipse.gemini.blueprint.iandt.namespace.config.DummyNamespaceHandler
\ No newline at end of file
diff --git a/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.schemas b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000..b59b1c0
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/osgi/test/test.xsd=org/eclipse/gemini/blueprint/iandt/namespace/config/test.xsd
\ No newline at end of file
diff --git a/integration-tests/bundles/embedded.ns.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/namespace/config/test.xsd b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/namespace/config/test.xsd
new file mode 100644
index 0000000..286a68f
--- /dev/null
+++ b/integration-tests/bundles/embedded.ns.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/namespace/config/test.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!-- test schema used for checking namespace discovery -->

+<xsd:schema xmlns="http://www.springframework.org/schema/osgi/test"

+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+            targetNamespace="http://www.springframework.org/schema/osgi/test"

+            elementFormDefault="qualified"

+            attributeFormDefault="unqualified">

+

+    <!-- simple element -->

+    <xsd:element name="test" type="xsd:string"/>

+</xsd:schema>
\ No newline at end of file
diff --git a/integration-tests/bundles/error.bundle/pom.xml b/integration-tests/bundles/error.bundle/pom.xml
new file mode 100644
index 0000000..6ac8369
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>error</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Error bundle</name>
+    <description>An OSGi bundle with an error in imports which will force an error</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java b/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java
new file mode 100644
index 0000000..8f21ccb
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java
@@ -0,0 +1,24 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.error;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+public class TestService implements MyService {
+    public String stringValue() {
+        return "Bond.  James Bond.";
+    }
+
+}
diff --git a/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java.bak b/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java.bak
new file mode 100644
index 0000000..ca6ed98
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/java/org/springframework/osgi/iandt/error/TestService.java.bak
@@ -0,0 +1,24 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.error;
+
+import org.springframework.osgi.iandt.simpleservice.MyService;
+
+public class TestService implements MyService {
+    public String stringValue() {
+        return "Bond.  James Bond.";
+    }
+
+}
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..aeb80a1
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Bundle-Name: org-springframework-osgi-iandt-error
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.error
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..0a44b5d
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,6 @@
+Bundle-Name: org-springframework-osgi-iandt-error
+Bundle-SymbolicName: org.springframework.osgi.iandt.error
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml
new file mode 100644
index 0000000..95b59fe
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.error.TestService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml.bak b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml.bak
new file mode 100644
index 0000000..c32109c
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/error.xml.bak
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.springframework.osgi.iandt.error.TestService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml
new file mode 100644
index 0000000..21f4c47
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service id="simpleServiceOsgi" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml.bak b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml.bak
new file mode 100644
index 0000000..387d9b6
--- /dev/null
+++ b/integration-tests/bundles/error.bundle/src/main/resources/META-INF/spring/osgi.xml.bak
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service id="simpleServiceOsgi" ref="simpleService"
+                  interface="org.springframework.osgi.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/export.import.dependency.bundle/pom.xml b/integration-tests/bundles/export.import.dependency.bundle/pom.xml
new file mode 100644
index 0000000..9f080c0
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>export-import-dependency-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Export Import Dependency Bundle</name>
+    <description>Bundle with beans depending on exporters and importers</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java b/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java
new file mode 100644
index 0000000..e735e95
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java
@@ -0,0 +1,42 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependency;

+

+import java.io.Serializable;

+

+/**

+ * @author Costin Leau

+ */

+public class SimpleComponent implements Cloneable, Serializable {

+

+	private Object optionalDependency;

+	private Object mandatoryDependency;

+

+	public Object getOptionalDependency() {

+		return optionalDependency;

+	}

+

+	public void setOptionalDependency(Object optionalDependency) {

+		this.optionalDependency = optionalDependency;

+	}

+

+	public Object getMandatoryDependency() {

+		return mandatoryDependency;

+	}

+

+	public void setMandatoryDependency(Object mandatoryDependency) {

+		this.mandatoryDependency = mandatoryDependency;

+	}

+}

diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java.bak b/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java.bak
new file mode 100644
index 0000000..d174e4d
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/dependency/SimpleComponent.java.bak
@@ -0,0 +1,42 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.dependency;

+

+import java.io.Serializable;

+

+/**

+ * @author Costin Leau

+ */

+public class SimpleComponent implements Cloneable, Serializable {

+

+	private Object optionalDependency;

+	private Object mandatoryDependency;

+

+	public Object getOptionalDependency() {

+		return optionalDependency;

+	}

+

+	public void setOptionalDependency(Object optionalDependency) {

+		this.optionalDependency = optionalDependency;

+	}

+

+	public Object getMandatoryDependency() {

+		return mandatoryDependency;

+	}

+

+	public void setMandatoryDependency(Object mandatoryDependency) {

+		this.mandatoryDependency = mandatoryDependency;

+	}

+}

diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..823e7d4
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.dependency.exporter.importer
+Bundle-Name: ExporterImporterDependency
+Bundle-Vendor: Spring Framework
\ No newline at end of file
diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..edebb8b
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,5 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.dependency.exporter.importer
+Bundle-Name: ExporterImporterDependency
+Bundle-Vendor: Spring Framework
\ No newline at end of file
diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml
new file mode 100644
index 0000000..edded7e
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="injected-export">
+        <osgi:interfaces>
+            <value>java.io.Serializable</value>
+            <value>java.lang.Cloneable</value>
+        </osgi:interfaces>
+        <osgi:service-properties>
+            <entry key="type" value="injected-deps"/>
+        </osgi:service-properties>
+    </osgi:service>
+
+
+    <bean id="injected-export" class="org.eclipse.gemini.blueprint.iandt.dependency.SimpleComponent">
+        <property name="optionalDependency" ref="optional"/>
+        <property name="mandatoryDependency" ref="mandatory"/>
+    </bean>
+
+    <osgi:service depends-on="optional mandatory" ref="depends-on-export">
+        <osgi:interfaces>
+            <value>java.io.Serializable</value>
+            <value>java.lang.Cloneable</value>
+        </osgi:interfaces>
+    </osgi:service>
+    
+    <bean id="depends-on-export" class="org.eclipse.gemini.blueprint.iandt.dependency.SimpleComponent"/>
+
+    
+    <osgi:reference id="optional" interface="java.util.SortedSet" cardinality="0..1"/>
+    <osgi:reference id="mandatory" interface="java.util.SortedMap" cardinality="1..1"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml.bak b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml.bak
new file mode 100644
index 0000000..468e0e5
--- /dev/null
+++ b/integration-tests/bundles/export.import.dependency.bundle/src/main/resources/META-INF/spring/config.xml.bak
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="injected-export">
+        <osgi:interfaces>
+            <value>java.io.Serializable</value>
+            <value>java.lang.Cloneable</value>
+        </osgi:interfaces>
+        <osgi:service-properties>
+            <entry key="type" value="injected-deps"/>
+        </osgi:service-properties>
+    </osgi:service>
+
+
+    <bean id="injected-export" class="org.springframework.osgi.iandt.dependency.SimpleComponent">
+        <property name="optionalDependency" ref="optional"/>
+        <property name="mandatoryDependency" ref="mandatory"/>
+    </bean>
+
+    <osgi:service depends-on="optional mandatory" ref="depends-on-export">
+        <osgi:interfaces>
+            <value>java.io.Serializable</value>
+            <value>java.lang.Cloneable</value>
+        </osgi:interfaces>
+    </osgi:service>
+    
+    <bean id="depends-on-export" class="org.springframework.osgi.iandt.dependency.SimpleComponent"/>
+
+    
+    <osgi:reference id="optional" interface="java.util.SortedSet" cardinality="0..1"/>
+    <osgi:reference id="mandatory" interface="java.util.SortedMap" cardinality="1..1"/>
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/extender.fragment.bundle/pom.xml b/integration-tests/bundles/extender.fragment.bundle/pom.xml
new file mode 100644
index 0000000..8fcdbfd
--- /dev/null
+++ b/integration-tests/bundles/extender.fragment.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>extender-fragment-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Extender Configuration Fragment Bundle</name>
+    <description>Fragment configuring the extender</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fb80bd4
--- /dev/null
+++ b/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.extender.fragment.configuration
+Bundle-Name: ExtenderConfigurationFragment
+Bundle-Vendor: Spring Framework
+Fragment-Host: org.eclipse.gemini.blueprint.extender
+Import-Package: org.osgi.service.packageadmin
diff --git a/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/spring/extender/extra-config.xml b/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/spring/extender/extra-config.xml
new file mode 100644
index 0000000..5c630a9
--- /dev/null
+++ b/integration-tests/bundles/extender.fragment.bundle/src/main/resources/META-INF/spring/extender/extra-config.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:util="http://www.springframework.org/schema/util"

+	xmlns:p="http://www.springframework.org/schema/p"

+	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://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

+

+	<osgi:reference id="packageAdmin"

+		interface="org.osgi.service.packageadmin.PackageAdmin" cardinality="0..1"/>

+

+	<bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor" p:threadGroupName="configured-extender" 

+			p:threadNamePrefix="conf-extender-thread" />

+

+	<bean id="shutdownTaskExecutor" class="org.springframework.scheduling.timer.TimerTaskExecutor"/>

+	

+	<util:properties id="extenderProperties">

+		<prop key="smth">bla</prop>

+		<prop key="dependencies.wait.time">180</prop>

+	</util:properties>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/extender.listener.bundle/pom.xml b/integration-tests/bundles/extender.listener.bundle/pom.xml
new file mode 100644
index 0000000..a12129f
--- /dev/null
+++ b/integration-tests/bundles/extender.listener.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>extender.listener.bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Extender Event listener bundle Bundle</name>
+    <description>Simple bundle which listeners for events send by the listener</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+    
+</project>
+
diff --git a/integration-tests/bundles/extender.listener.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/extenderlistener/LoggerListener.java b/integration-tests/bundles/extender.listener.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/extenderlistener/LoggerListener.java
new file mode 100644
index 0000000..e9e0acb
--- /dev/null
+++ b/integration-tests/bundles/extender.listener.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/extenderlistener/LoggerListener.java
@@ -0,0 +1,37 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.extenderlistener;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextEvent;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextListener;

+

+/**

+ * Simple logger.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class LoggerListener implements OsgiBundleApplicationContextListener {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(LoggerListener.class);

+

+

+	public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {

+		log.info("Received event " + event);

+	}

+}

diff --git a/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..778ec5b
--- /dev/null
+++ b/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.extenderlistener
+Bundle-Name: ExtenderListener
+Bundle-Vendor: Spring Framework
+Import-Package: org.apache.commons.logging,org.eclipse.gemini.blueprint.context.event
diff --git a/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/spring/config.xml b/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/spring/config.xml
new file mode 100644
index 0000000..a7ef318
--- /dev/null
+++ b/integration-tests/bundles/extender.listener.bundle/src/main/resources/META-INF/spring/config.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<osgi:service id="packageAdmin" ref="listener"

+		interface="org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextListener" />

+

+	<bean id="listener" class="org.eclipse.gemini.blueprint.iandt.extenderlistener.LoggerListener"/>

+	

+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/extender.version.bundle/.classpath b/integration-tests/bundles/extender.version.bundle/.classpath
new file mode 100644
index 0000000..623b52a
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/extender.version.bundle/.project b/integration-tests/bundles/extender.version.bundle/.project
new file mode 100644
index 0000000..b14406c
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Gemini Extender Version Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF b/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..83a8b9b
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.extenderversion
+Bundle-Name: Extender Version
+Bundle-Vendor: Spring Framework
+SpringExtender-Version: 19.99.98.not-existing
+Spring-Context: *;
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..644f928
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.extenderversion
+Bundle-Name: Extender Version
+Bundle-Vendor: Spring Framework
+SpringExtender-Version: 19.99.98.not-existing
+Spring-Context: *;
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/extender.version.bundle/pom.xml b/integration-tests/bundles/extender.version.bundle/pom.xml
new file mode 100644
index 0000000..2d76296
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>extender-version-bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: ExtenderVersion-Test-Bundle</name>
+    <description>Testing bundle for checking the SpringExtender-Version manifest entry</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..83a8b9b
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.extenderversion
+Bundle-Name: Extender Version
+Bundle-Vendor: Spring Framework
+SpringExtender-Version: 19.99.98.not-existing
+Spring-Context: *;
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..644f928
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,9 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.extenderversion
+Bundle-Name: Extender Version
+Bundle-Vendor: Spring Framework
+SpringExtender-Version: 19.99.98.not-existing
+Spring-Context: *;
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/spring/config.xml b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/spring/config.xml
new file mode 100644
index 0000000..f7620e6
--- /dev/null
+++ b/integration-tests/bundles/extender.version.bundle/src/main/resources/META-INF/spring/config.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service ref="point" auto-export="all-classes"/>
+
+    <bean id="point" class="java.awt.Point" lazy-init="false"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/.classpath b/integration-tests/bundles/io.fragment.1.bundle/.classpath
new file mode 100644
index 0000000..49f9859
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/spring-osgi-test-support"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/io.fragment.1.bundle/.project b/integration-tests/bundles/io.fragment.1.bundle/.project
new file mode 100644
index 0000000..eb957db
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>IO-Fragment Bundle 1</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/io.fragment.1.bundle/pom.xml b/integration-tests/bundles/io.fragment.1.bundle/pom.xml
new file mode 100644
index 0000000..bcb6391
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>io.fragment.1.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: IO fragment 1 bundle</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..44f76f6
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: io-fragment-1
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.io.fragment.1
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Fragment-Host: org.eclipse.gemini.blueprint.iandt.io.functional.fragments
+Fragment1-Header: fragment1
+Fragment-Header: fragment1
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.file
new file mode 100644
index 0000000..de2c516
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.file
@@ -0,0 +1 @@
+some file used as a fragment
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/fragment.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/fragment.file
new file mode 100644
index 0000000..5d75486
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/fragment.file
@@ -0,0 +1 @@
+common fragment file

diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/nested.folder/nested.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/nested.folder/nested.file
new file mode 100644
index 0000000..5d75486
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment.folder/nested.folder/nested.file
@@ -0,0 +1 @@
+common fragment file

diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.file
new file mode 100644
index 0000000..1a010b1
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.file
@@ -0,0 +1 @@
+file
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.file.1.1 b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.file.1.1
new file mode 100644
index 0000000..60fa80c
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.file.1.1
@@ -0,0 +1 @@
+just some file
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.folder.1/nested.file.1.1 b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.folder.1/nested.file.1.1
new file mode 100644
index 0000000..60fa80c
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/fragment1.folder/nested.folder.1/nested.file.1.1
@@ -0,0 +1 @@
+just some file
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
new file mode 100644
index 0000000..2cc1c9c
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
@@ -0,0 +1 @@
+file available in attached bundle also - as
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file
new file mode 100644
index 0000000..5997639
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.1.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file
@@ -0,0 +1 @@
+file duplicated only in fragments - bla
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/.classpath b/integration-tests/bundles/io.fragment.2.bundle/.classpath
new file mode 100644
index 0000000..49f9859
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/spring-osgi-test-support"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/io.fragment.2.bundle/.project b/integration-tests/bundles/io.fragment.2.bundle/.project
new file mode 100644
index 0000000..3422beb
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>IO-Fragment Bundle 2</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/io.fragment.2.bundle/pom.xml b/integration-tests/bundles/io.fragment.2.bundle/pom.xml
new file mode 100644
index 0000000..94a492a
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>io.fragment.2.bundle</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: IO fragment 2 bundle</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..80a7f9e
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: io-fragment-2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.io.fragment.2
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Fragment-Host: org.eclipse.gemini.blueprint.iandt.io.functional.fragments
+Fragment2-Header: fragment2
+Fragment-Header: fragment2
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.file
new file mode 100644
index 0000000..de2c516
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.file
@@ -0,0 +1 @@
+some file used as a fragment
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/fragment.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/fragment.file
new file mode 100644
index 0000000..5d75486
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/fragment.file
@@ -0,0 +1 @@
+common fragment file

diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/nested.folder/nested.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/nested.folder/nested.file
new file mode 100644
index 0000000..5d75486
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment.folder/nested.folder/nested.file
@@ -0,0 +1 @@
+common fragment file

diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.file
new file mode 100644
index 0000000..de2c516
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.file
@@ -0,0 +1 @@
+some file used as a fragment
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.file.2.1 b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.file.2.1
new file mode 100644
index 0000000..60fa80c
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.file.2.1
@@ -0,0 +1 @@
+just some file
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.folder.2/nested.file.2.2 b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.folder.2/nested.file.2.2
new file mode 100644
index 0000000..60fa80c
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/fragment2.folder/nested.folder.2/nested.file.2.2
@@ -0,0 +1 @@
+just some file
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
new file mode 100644
index 0000000..6f46712
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
@@ -0,0 +1 @@
+file available in attached bundle also - asdasdsa
\ No newline at end of file
diff --git a/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file
new file mode 100644
index 0000000..5997639
--- /dev/null
+++ b/integration-tests/bundles/io.fragment.2.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/io/fragment-duplicate.file
@@ -0,0 +1 @@
+file duplicated only in fragments - bla
\ No newline at end of file
diff --git a/integration-tests/bundles/jdk.proxy.bundle/.classpath b/integration-tests/bundles/jdk.proxy.bundle/.classpath
new file mode 100644
index 0000000..2a02d14
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl104-over-slf4j/1.5.0/jcl104-over-slf4j-1.5.0.jar"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/jdk.proxy.bundle/.project b/integration-tests/bundles/jdk.proxy.bundle/.project
new file mode 100644
index 0000000..beabcb5
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>JDK Proxy</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/jdk.proxy.bundle/pom.xml b/integration-tests/bundles/jdk.proxy.bundle/pom.xml
new file mode 100644
index 0000000..149071d
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/pom.xml
@@ -0,0 +1,21 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>jdk.proxy</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: JDK proxy test</name>
+    <description>An OSGi bundle for JDK proxy testing</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+
+</project>
+
diff --git a/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateExecutor.java b/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateExecutor.java
new file mode 100644
index 0000000..29b8cfd
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateExecutor.java
@@ -0,0 +1,39 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdkproxy.internal;

+

+import java.lang.reflect.Method;

+import java.util.Date;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * Simple private class that dispatches a method.

+ * 

+ * @author Costin Leau

+ * 

+ */

+class PrivateExecutor {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(PrivateExecutor.class);

+

+

+	Object dispatchMethod(Method method) {

+		log.info("about to invoke " + method);

+		return "method invoked by a private class at " + new Date();

+	}

+}

diff --git a/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateInvocationHandler.java b/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateInvocationHandler.java
new file mode 100644
index 0000000..5c1744a
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/jdkproxy/internal/PrivateInvocationHandler.java
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdkproxy.internal;

+

+import java.lang.reflect.InvocationHandler;

+import java.lang.reflect.Method;

+

+/**

+ * Private implementation of InvocationHandler interface.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class PrivateInvocationHandler implements InvocationHandler {

+

+	private final PrivateExecutor executor = new PrivateExecutor();

+

+

+	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

+		return executor.dispatchMethod(method);

+	}

+}

diff --git a/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d8807d6
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-jdk-proxy
+Bundle-SymbolicName: org.springframework.osgi.iandt.jdk.proxy
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Import-Package: org.apache.commons.logging
diff --git a/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..d98e897
--- /dev/null
+++ b/integration-tests/bundles/jdk.proxy.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+    <osgi:service id="invocationHandler" interface="java.lang.reflect.InvocationHandler">
+		<bean name="handlerBean" class="org.eclipse.gemini.blueprint.iandt.jdkproxy.internal.PrivateInvocationHandler" />
+    </osgi:service> 

+    
+</beans>

diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/pom.xml b/integration-tests/bundles/jdk5/component.scan.bundle/pom.xml
new file mode 100644
index 0000000..3da6170
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>spring-osgi-jdk5-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>component.scan.bundle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: @Component beans bundle</name>
+    <description>An OSGi bundle with Spring annotated components</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+</project>
+
diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java
new file mode 100644
index 0000000..152ab55
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io.component;

+

+import org.springframework.stereotype.Component;

+

+

+/**

+ * @author Costin Leau

+ * 

+ */

+@Component

+public class Bean {

+

+}

diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java.bak b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java.bak
new file mode 100644
index 0000000..5c50833
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/Bean.java.bak
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.io.component;

+

+import org.springframework.stereotype.Component;

+

+

+/**

+ * @author Costin Leau

+ * 

+ */

+@Component

+public class Bean {

+

+}

diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java
new file mode 100644
index 0000000..cbcef32
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io.component;

+

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Component;

+

+

+/**

+ * @author Costin Leau

+ * 

+ */

+@Component

+public class ComponentBean{

+

+	@Autowired

+	private Bean bean;

+

+	public Bean getBean() {

+		return bean;

+	}

+}

diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java.bak b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java.bak
new file mode 100644
index 0000000..a6b37ae
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/io/component/ComponentBean.java.bak
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.io.component;

+

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Component;

+

+

+/**

+ * @author Costin Leau

+ * 

+ */

+@Component

+public class ComponentBean{

+

+	@Autowired

+	private Bean bean;

+

+	public Bean getBean() {

+		return bean;

+	}

+}

diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b73ea2a
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.io.component
+Bundle-Name: Component Bundle
+Bundle-Vendor: Spring Framework
+Export-Package: org.eclipse.gemini.blueprint.iandt.io.component
+Import-Package: org.springframework.stereotype,org.springframework.beans.factory.annotation
diff --git a/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..bd100b8
--- /dev/null
+++ b/integration-tests/bundles/jdk5/component.scan.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,7 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.io.component
+Bundle-Name: Component Bundle
+Bundle-Vendor: Spring Framework
+Export-Package: org.springframework.osgi.iandt.io.component
+Import-Package: org.springframework.stereotype,org.springframework.beans.factory.annotation
diff --git a/integration-tests/bundles/jdk5/pom.xml b/integration-tests/bundles/jdk5/pom.xml
new file mode 100644
index 0000000..eadda45
--- /dev/null
+++ b/integration-tests/bundles/jdk5/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <parent>
+    <artifactId>gemini-blueprint</artifactId>
+    <groupId>org.eclipse.gemini.blueprint</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>spring-osgi-jdk5-integration-test-bundles</artifactId>
+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <packaging>pom</packaging>
+  <name>Spring OSGi JDK5 Integration Testing Bundles</name>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+  <properties>
+	
+	<bundlor.enabled>false</bundlor.enabled>
+  </properties>
+  
+  <!-- shared dependencies -->
+  <dependencies>
+     <dependency>
+         <groupId>org.eclipse.gemini.blueprint</groupId>
+         <artifactId>gemini-blueprint-core</artifactId>
+         <version>${project.parent.version}</version>
+         <type>jar</type>
+         <scope>provided</scope>
+     </dependency>
+     <!--
+     <dependency>
+       <groupId>org.eclipse.gemini.blueprint</groupId>
+       <artifactId>gemini-blueprint-annotation</artifactId>
+       <version>${project.parent.version}</version>
+       <scope>provided</scope>
+     </dependency>
+        -->
+  </dependencies>
+  
+  <modules>
+    <!--
+    <module>annotation.dependency.test.bundle</module>
+    <module>annotation.test.bundle</module>
+    -->
+    <module>component.scan.bundle</module>
+  </modules>
+  
+ 
+	<build>
+	  <plugins>
+		  <plugin>
+			<artifactId>maven-compiler-plugin</artifactId>
+			  <groupId>org.apache.maven.plugins</groupId>
+			  <configuration>
+				<source>1.5</source>
+				<target>1.5</target>
+				<debug>true</debug>
+			  </configuration>
+		  </plugin>
+		
+		  <plugin>
+			<groupId>org.apache.maven.plugins</groupId>
+			<artifactId>maven-jar-plugin</artifactId>
+			<configuration>
+			  <archive>
+				<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+			  </archive>
+			</configuration>
+		  </plugin>
+		</plugins>
+
+	</build>
+ 
+</project>
diff --git a/integration-tests/bundles/lifecycle.test.bundle/.classpath b/integration-tests/bundles/lifecycle.test.bundle/.classpath
new file mode 100644
index 0000000..423dbbf
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/.classpath
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="var" path="M2_REPO/org/osgi/osgi_R4_core/1.0/osgi_R4_core-1.0.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar" sourcepath="/SPRING_SRC"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/gemini-blueprint-core"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/lifecycle.test.bundle/.project b/integration-tests/bundles/lifecycle.test.bundle/.project
new file mode 100644
index 0000000..93c0d2b
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Application Context Lifecycle Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/lifecycle.test.bundle/build.properties b/integration-tests/bundles/lifecycle.test.bundle/build.properties
new file mode 100644
index 0000000..270de6d
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/build.properties
@@ -0,0 +1,7 @@
+source.. = src/main/java/,src/main/resources/

+output.. = target/classes/,target/test-classes

+bin.includes = META-INF/,\

+               target/classes/,\

+               .

+src.includes = src/main/java/,\

+               src/main/resources/

diff --git a/integration-tests/bundles/lifecycle.test.bundle/pom.xml b/integration-tests/bundles/lifecycle.test.bundle/pom.xml
new file mode 100644
index 0000000..1f208d7
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>lifecycle</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context lifecycle test bundle</name>
+    <description>An OSGi bundle that tests the lifecycle of the Spring Application context</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+  
+    </dependencies> 
+</project>
+
diff --git a/integration-tests/bundles/lifecycle.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/lifecycle/GuineaPig.java b/integration-tests/bundles/lifecycle.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/lifecycle/GuineaPig.java
new file mode 100644
index 0000000..994aed2
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/lifecycle/GuineaPig.java
@@ -0,0 +1,58 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.lifecycle;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.eclipse.gemini.blueprint.context.BundleContextAware;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Oct 15, 2006
+ *         Time: 5:23:16 PM
+ */
+public class GuineaPig implements InitializingBean, DisposableBean, BundleContextAware {
+    BundleContext bundleContext;
+    Listener listener;
+
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+
+    public void afterPropertiesSet() throws Exception {
+        System.setProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.startUp", "true");
+        listener = new Listener();
+        bundleContext.addFrameworkListener(listener);
+    }
+
+
+    public void destroy() throws Exception {
+        bundleContext.removeFrameworkListener(listener);
+        System.setProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.close", "true");
+    }
+
+
+    static class Listener implements FrameworkListener {
+        public void frameworkEvent(FrameworkEvent frameworkEvent) {
+            System.out.println("Eavesdropping on " + frameworkEvent);
+        }
+    }
+}
diff --git a/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..10d8631
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Name: org-eclipse-gemini-blueprint-iandt-lifecycle
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.lifecycle
+Bundle-Version: 2.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: . 
+Import-Package: org.springframework.beans.factory,
+ org.eclipse.gemini.blueprint.context,
+ org.osgi.framework
+  
diff --git a/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/spring/lifecycle.xml b/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/spring/lifecycle.xml
new file mode 100644
index 0000000..0bf0885
--- /dev/null
+++ b/integration-tests/bundles/lifecycle.test.bundle/src/main/resources/META-INF/spring/lifecycle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+
+    <bean id="guinea-pig" class="org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/pom.xml b/integration-tests/bundles/namespace.own.consumer.bundle/pom.xml
new file mode 100644
index 0000000..15db08d
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>ns.own.consumer</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: namespace provider and consumer bundle</name>
+    <description>A simple namespace bundle that provides and uses its own namespace</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/ns/BogusHandler.java b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/ns/BogusHandler.java
new file mode 100644
index 0000000..31a317a
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/ns/BogusHandler.java
@@ -0,0 +1,54 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.ns;

+

+import org.springframework.beans.factory.config.BeanDefinition;

+import org.springframework.beans.factory.config.BeanDefinitionHolder;

+import org.springframework.beans.factory.support.BeanDefinitionBuilder;

+import org.springframework.beans.factory.support.BeanDefinitionRegistry;

+import org.springframework.beans.factory.xml.NamespaceHandler;

+import org.springframework.beans.factory.xml.ParserContext;

+import org.w3c.dom.Element;

+import org.w3c.dom.Node;

+

+/**

+ * Bogus handler. Creates a bean definition to test whether the handler

+ * providing the namespace can actually start its own context. It registers two

+ * beans named: "nsDate" and "nsBean".

+ * 

+ * @author Costin Leau

+ */

+public class BogusHandler implements NamespaceHandler {

+

+	public static volatile boolean initialized = false;

+

+

+	public BeanDefinitionHolder decorate(Node source, BeanDefinitionHolder definition, ParserContext parserContext) {

+		return null;

+	}

+

+	public void init() {

+		initialized = true;

+		System.out.println("BogusHandler initialized");

+	}

+

+	public BeanDefinition parse(Element element, ParserContext parserContext) {

+		BeanDefinitionRegistry registry = parserContext.getRegistry();

+		

+		registry.registerBeanDefinition("nsDate", BeanDefinitionBuilder.genericBeanDefinition("java.util.Date").getBeanDefinition());

+		registry.registerBeanDefinition("nsBean", BeanDefinitionBuilder.genericBeanDefinition("java.awt.Rectangle").getBeanDefinition());

+		return null;

+	}

+}

diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..eebdc91
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Name: namespace-test

+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.ns.own.provider

+Bundle-Version: 1.0

+Bundle-ManifestVersion: 2

+Bundle-ActivationPolicy: lazy

+Import-Package: org.springframework.beans.factory.config,

+ org.springframework.beans.factory.xml,

+ org.springframework.beans.factory.support,

+ org.w3c.dom

diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.handlers b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000..07f2e33
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.handlers
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/bogus=org.eclipse.gemini.blueprint.iandt.ns.BogusHandler
\ No newline at end of file
diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.schemas b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000..cabe505
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1 @@
+http\://www.springframework.org/schema/bogus/bogus.xsd=org/eclipse/gemini/blueprint/iandt/ns/bogus.xsd
diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..8d86ae9
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!-- import embedded namespace -->

+<b:beans xmlns="http://www.springframework.org/schema/bogus"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:b="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:bogus="http://www.springframework.org/schema/bogus"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+                      http://www.springframework.org/schema/bogus http://www.springframework.org/schema/bogus/bogus.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<b:bean id="bean" class="java.lang.Object"/>

+	<bogus:bogus>bogus declaration</bogus:bogus>

+	

+	<osgi:service auto-export="all-classes" ref="nsDate"/>

+	<osgi:service auto-export="all-classes" ref="nsBean"/>

+	<osgi:service auto-export="all-classes" ref="bean"/>

+	

+</b:beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/ns/bogus.xsd b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/ns/bogus.xsd
new file mode 100644
index 0000000..ea6f533
--- /dev/null
+++ b/integration-tests/bundles/namespace.own.consumer.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/ns/bogus.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>

+

+<xsd:schema xmlns="http://www.springframework.org/schema/bogus"

+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+            targetNamespace="http://www.springframework.org/schema/bogus"

+            elementFormDefault="qualified"

+            attributeFormDefault="unqualified">

+

+    <xsd:annotation>

+        <xsd:documentation><![CDATA[

+    'Bogus' integration test namespace handler.

+        ]]></xsd:documentation>

+    </xsd:annotation>

+

+

+    <xsd:element name="bogus" type="xsd:string"/>

+

+</xsd:schema>
\ No newline at end of file
diff --git a/integration-tests/bundles/pom.xml b/integration-tests/bundles/pom.xml
new file mode 100644
index 0000000..b665361
--- /dev/null
+++ b/integration-tests/bundles/pom.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <parent>
+    <artifactId>gemini-blueprint</artifactId>
+    <groupId>org.eclipse.gemini.blueprint</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <packaging>pom</packaging>
+  <name>Eclipse Gemini Blueprint Integration Testing Bundles</name>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+  <properties>
+    <!-- root, empty package -->
+    <!-- plugin not yet enabled to avoid further problems -->
+	<spring.osgi.import.pkg>!org.eclipse.gemini.blueprint.iandt, *</spring.osgi.import.pkg>
+	<spring.osgi.export.pkg>${pom.artifactId}*</spring.osgi.export.pkg>
+  	<clover.skip>true</clover.skip>
+    <bundlor.enabled>false</bundlor.enabled>  	
+  </properties>
+  
+  <!-- shared dependencies -->
+  <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+  </dependencies>
+  
+  <modules>
+    <module>simple.service.bundle</module>
+    <module>simple.service.bundle.identical</module>
+    <module>simple.service.bundle.2.identical</module>
+    <module>simple.service.2.bundle</module>
+    <module>simple.service.3.bundle</module>
+    <module>dependency.factory.bundle</module>
+    <module>trivial.bundle</module>
+    <module>trivial.test.bundle</module>
+    <module>lifecycle.test.bundle</module>
+    <module>service.listener.bundle</module>
+    <module>reference.test.bundle</module>
+    <module>proxy.destruction.test.bundle</module>
+    <module>dependency.test.bundle</module>
+    <module>cardinality.0to1.bundle</module>
+    <module>scoped.a.bundle</module>    
+    <module>scoped.b.bundle</module>    
+    <module>scoped.common.bundle</module>
+    <module>io.fragment.1.bundle</module>    
+    <module>io.fragment.2.bundle</module>
+    <module>error.bundle</module>
+    <module>deadlock.bundle</module>
+    <module>configuration.test.bundle</module>
+    <module>extender.version.bundle</module>
+    <module>config.bundle</module>
+    <module>tccl.intf.bundle</module>    
+    <module>tccl.bundle</module>
+    <module>config.file.with.dots.bundle</module>
+    <module>proxy.creator.bundle</module>
+    <module>extender.fragment.bundle</module>
+    <module>jdk.proxy.bundle</module>
+    <module>extender.listener.bundle</module>
+    <module>namespace.own.consumer.bundle</module>
+    <module>proxy.listener</module>
+    <module>export.import.dependency.bundle</module>
+    <!--
+    <module>web.bundles</module>
+    -->
+    <module>jdk5</module>
+
+    <!-- lazy bundles -->
+    <module>lazy.companion.bundle</module>
+    <module>lazy.basic</module>
+    <module>lazy.export.no.import</module>
+    <module>lazy.export.import</module>
+    <!-- blueprint bundles 
+    <module>blueprint</module>
+    -->
+  </modules>
+
+ <build>
+    <plugins>
+	   <plugin>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>    
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+    
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.creator.bundle/.classpath b/integration-tests/bundles/proxy.creator.bundle/.classpath
new file mode 100644
index 0000000..2a02d14
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl104-over-slf4j/1.5.0/jcl104-over-slf4j-1.5.0.jar"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/proxy.creator.bundle/.project b/integration-tests/bundles/proxy.creator.bundle/.project
new file mode 100644
index 0000000..28ae1f0
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Proxy Creator</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/proxy.creator.bundle/pom.xml b/integration-tests/bundles/proxy.creator.bundle/pom.xml
new file mode 100644
index 0000000..4e48e0a
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/pom.xml
@@ -0,0 +1,20 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>proxy.creator</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring Proxy Creator bundle</name>
+    <description>An OSGi bundle that creates proxies internally and is updated</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+</project>
+
diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java
new file mode 100644
index 0000000..4fb6ded
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java
@@ -0,0 +1,35 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class SomeImplementation implements SomeInterface {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(SomeImplementation.class);

+

+

+	public boolean doSmth(Object argument) {

+		log.info("received " + argument);

+		return true;

+	}

+

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java.bak b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java.bak
new file mode 100644
index 0000000..9508c65
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeImplementation.java.bak
@@ -0,0 +1,35 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.proxycreator;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class SomeImplementation implements SomeInterface {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(SomeImplementation.class);

+

+

+	public boolean doSmth(Object argument) {

+		log.info("received " + argument);

+		return true;

+	}

+

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java
new file mode 100644
index 0000000..fcb634c
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+/**

+ * Interface. We cannot used one from outside the bundle since we want to expose

+ * the CL problems.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public interface SomeInterface {

+

+	boolean doSmth(Object argument);

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java.bak b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java.bak
new file mode 100644
index 0000000..4a38eb2
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java.bak
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.proxycreator;

+

+/**

+ * Interface. We cannot used one from outside the bundle since we want to expose

+ * the CL problems.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public interface SomeInterface {

+

+	boolean doSmth(Object argument);

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java
new file mode 100644
index 0000000..693afbf
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java
@@ -0,0 +1,73 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * Simple test that touches proxies created through spring. While this test

+ * doesn't do much by itself, it should always work even when the bundle it runs

+ * in, is updated. Failure to do so implies incorrect usage of the appropriate

+ * class loader.

+ * 

+ * Thanks to Alexei Akimov for the proof of concept.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class Test {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(Test.class);

+

+	private SomeInterface jdkProxy;

+	private SomeInterface cglibProxy;

+

+

+	/**

+	 * Sets echo JDK proxy

+	 * 

+	 * @param echoJdkProxy

+	 */

+	public void setJdkProxy(SomeInterface echoJdkProxy) {

+		this.jdkProxy = echoJdkProxy;

+	}

+

+	/**

+	 * Sets echo CGLIB proxy

+	 * 

+	 * @param echoCglibProxy

+	 */

+	public void setCglibProxy(SomeInterface echoCglibProxy) {

+		this.cglibProxy = echoCglibProxy;

+	}

+

+	public void test() {

+		testInterface(jdkProxy);

+		testInterface(cglibProxy);

+	}

+

+	// interact with the proxy to make sure the weaving process is successful

+	private void testInterface(SomeInterface intfs) {

+		try {

+			log.info("testing proxy interception...");

+			intfs.doSmth("hangar 18");

+		}

+		catch (Throwable th) {

+			log.error("caught exception", th);

+		}

+	}

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java.bak b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java.bak
new file mode 100644
index 0000000..1b6d82b
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/proxycreator/Test.java.bak
@@ -0,0 +1,73 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.proxycreator;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * Simple test that touches proxies created through spring. While this test

+ * doesn't do much by itself, it should always work even when the bundle it runs

+ * in, is updated. Failure to do so implies incorrect usage of the appropriate

+ * class loader.

+ * 

+ * Thanks to Alexei Akimov for the proof of concept.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class Test {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(Test.class);

+

+	private SomeInterface jdkProxy;

+	private SomeInterface cglibProxy;

+

+

+	/**

+	 * Sets echo JDK proxy

+	 * 

+	 * @param echoJdkProxy

+	 */

+	public void setJdkProxy(SomeInterface echoJdkProxy) {

+		this.jdkProxy = echoJdkProxy;

+	}

+

+	/**

+	 * Sets echo CGLIB proxy

+	 * 

+	 * @param echoCglibProxy

+	 */

+	public void setCglibProxy(SomeInterface echoCglibProxy) {

+		this.cglibProxy = echoCglibProxy;

+	}

+

+	public void test() {

+		testInterface(jdkProxy);

+		testInterface(cglibProxy);

+	}

+

+	// interact with the proxy to make sure the weaving process is successful

+	private void testInterface(SomeInterface intfs) {

+		try {

+			log.info("testing proxy interception...");

+			intfs.doSmth("hangar 18");

+		}

+		catch (Throwable th) {

+			log.error("caught exception", th);

+		}

+	}

+}

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ce5287c
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-creator
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.proxy.creator
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Import-Package: org.apache.commons.logging,org.springframework.aop.interceptor,
+ org.springframework.aop.framework,org.springframework.aop,org.aopalliance.aop,
+ net.sf.cglib.proxy,net.sf.cglib.core,net.sf.cglib.reflect
+Export-Package: org.eclipse.gemini.blueprint.iandt.service.listener
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..d9593ce
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,9 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-creator
+Bundle-SymbolicName: org.springframework.osgi.iandt.proxy.creator
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Import-Package: org.apache.commons.logging,org.springframework.aop.interceptor,
+ org.springframework.aop.framework,org.springframework.aop,org.aopalliance.aop,
+ net.sf.cglib.proxy,net.sf.cglib.core,net.sf.cglib.reflect
+Export-Package: org.springframework.osgi.iandt.service.listener
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..43b810e
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

+

+	<bean name="bean" class="org.eclipse.gemini.blueprint.iandt.proxycreator.SomeImplementation" />

+

+	<bean name="loggerInterceptor"

+		class="org.springframework.aop.interceptor.SimpleTraceInterceptor" />

+

+	<bean name="jdkProxy"

+		class="org.springframework.aop.framework.ProxyFactoryBean">

+		<property name="target" ref="bean" />

+		<property name="proxyInterfaces">

+			<value>org.eclipse.gemini.blueprint.iandt.proxycreator.SomeInterface</value>

+		</property>

+		<property name="interceptorNames">

+			<value>loggerInterceptor</value>

+		</property>

+	</bean>

+

+	<bean name="cglibProxy"

+		class="org.springframework.aop.framework.ProxyFactoryBean">

+		<property name="target" ref="bean" />

+		<property name="interceptorNames">

+			<value>loggerInterceptor</value>

+		</property>

+		<property name="proxyTargetClass" value="true" />

+	</bean>

+

+	<bean name="test" class="org.eclipse.gemini.blueprint.iandt.proxycreator.Test" init-method="test">

+		<property name="jdkProxy" ref="jdkProxy" />

+		<property name="cglibProxy" ref="cglibProxy" />

+	</bean>

+</beans>

diff --git a/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml.bak b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml.bak
new file mode 100644
index 0000000..652dc77
--- /dev/null
+++ b/integration-tests/bundles/proxy.creator.bundle/src/main/resources/META-INF/spring/context.xml.bak
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

+

+	<bean name="bean" class="org.springframework.osgi.iandt.proxycreator.SomeImplementation" />

+

+	<bean name="loggerInterceptor"

+		class="org.springframework.aop.interceptor.SimpleTraceInterceptor" />

+

+	<bean name="jdkProxy"

+		class="org.springframework.aop.framework.ProxyFactoryBean">

+		<property name="target" ref="bean" />

+		<property name="proxyInterfaces">

+			<value>org.springframework.osgi.iandt.proxycreator.SomeInterface</value>

+		</property>

+		<property name="interceptorNames">

+			<value>loggerInterceptor</value>

+		</property>

+	</bean>

+

+	<bean name="cglibProxy"

+		class="org.springframework.aop.framework.ProxyFactoryBean">

+		<property name="target" ref="bean" />

+		<property name="interceptorNames">

+			<value>loggerInterceptor</value>

+		</property>

+		<property name="proxyTargetClass" value="true" />

+	</bean>

+

+	<bean name="test" class="org.springframework.osgi.iandt.proxycreator.Test" init-method="test">

+		<property name="jdkProxy" ref="jdkProxy" />

+		<property name="cglibProxy" ref="cglibProxy" />

+	</bean>

+</beans>

diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/.classpath b/integration-tests/bundles/proxy.destruction.test.bundle/.classpath
new file mode 100644
index 0000000..eb7dac5
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/.classpath
@@ -0,0 +1,15 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2.jar" sourcepath="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.api/1.5.6/com.springsource.slf4j.api-1.5.6.jar" sourcepath="M2_REPO/org/slf4j/com.springsource.slf4j.api/1.5.6/com.springsource.slf4j.api-1.5.6-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.log4j/1.5.6/com.springsource.slf4j.log4j-1.5.6.jar" sourcepath="M2_REPO/org/slf4j/com.springsource.slf4j.log4j/1.5.6/com.springsource.slf4j.log4j-1.5.6-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.org.apache.commons.logging/1.5.6/com.springsource.slf4j.org.apache.commons.logging-1.5.6.jar" sourcepath="M2_REPO/org/slf4j/com.springsource.slf4j.org.apache.commons.logging/1.5.6/com.springsource.slf4j.org.apache.commons.logging-1.5.6-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/easymock/easymock/1.2_Java1.3/easymock-1.2_Java1.3.jar" sourcepath="M2_REPO/easymock/easymock/1.2_Java1.3/easymock-1.2_Java1.3-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/springframework/osgi/log4j.osgi/1.2.15-SNAPSHOT/log4j.osgi-1.2.15-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/eclipse/osgi/org.eclipse.osgi/3.5.1.R35x_v20090827/org.eclipse.osgi-3.5.1.R35x_v20090827.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service/1.0.0.M1-SNAPSHOT/simple.service-1.0.0.M1-SNAPSHOT.jar"/>
+  <classpathentry kind="src" path="/simple.service"/>
+</classpath>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/.project b/integration-tests/bundles/proxy.destruction.test.bundle/.project
new file mode 100644
index 0000000..60c9882
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/.project
@@ -0,0 +1,17 @@
+<projectDescription>
+  <name>reference.proxy</name>
+  <comment>An OSGi bundle that tests the proxy behavior on an OSGi service reference</comment>
+  <projects>
+    <project>simple.service</project>
+    <project>spring-osgi-core</project>
+    <project>spring-osgi-io</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/.settings/org.eclipse.jdt.core.prefs b/integration-tests/bundles/proxy.destruction.test.bundle/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..5a144a8
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+#Thu Sep 25 16:40:01 BST 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.compliance=1.4
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/pom.xml b/integration-tests/bundles/proxy.destruction.test.bundle/pom.xml
new file mode 100644
index 0000000..c2d0317
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/pom.xml
@@ -0,0 +1,27 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>proxy.destruction</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context service reference destruction test bundle</name>
+    <description>An OSGi bundle that tests the destruction of a proxy when the referring application context is closed</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies> 
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java
new file mode 100644
index 0000000..58ac078
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.reference.proxy;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 25, 2006
+ *         Time: 12:50:20 PM
+ */
+public class ServiceReferer {
+    public static MyService serviceReference;
+
+    public void setReference(MyService reference) {
+        serviceReference = reference;
+    }
+}
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak
new file mode 100644
index 0000000..d7f254d
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.reference.proxy;
+
+import org.springframework.osgi.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 25, 2006
+ *         Time: 12:50:20 PM
+ */
+public class ServiceReferer {
+    public static MyService serviceReference;
+
+    public void setReference(MyService reference) {
+        serviceReference = reference;
+    }
+}
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d6a4884
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-destruction
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.proxy.destruction
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.iandt.reference.proxy
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..723dfa1
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,7 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-destruction
+Bundle-SymbolicName: org.springframework.osgi.iandt.proxy.destruction
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Import-Package: org.springframework.osgi.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.iandt.reference.proxy
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml
new file mode 100644
index 0000000..640a240
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="referer" class="org.eclipse.gemini.blueprint.iandt.reference.proxy.ServiceReferer" lazy-init="false">
+        <property name="reference" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi" interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak
new file mode 100644
index 0000000..af0fc71
--- /dev/null
+++ b/integration-tests/bundles/proxy.destruction.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="referer" class="org.eclipse.gemini.blueprint.iandt.reference.proxy.ServiceReferer" lazy-init="false">
+        <property name="reference" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi" interface="org.springframework.osgi.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.listener/pom.xml b/integration-tests/bundles/proxy.listener/pom.xml
new file mode 100644
index 0000000..d5ce3f0
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>proxy.listener</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Just a listener exported as a service</name>
+    <description>An OSGi bundle that exports a service listener</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+</project>
+
diff --git a/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java
new file mode 100644
index 0000000..cb86d38
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxy.listener;

+

+import java.util.Map;

+

+/**

+ * @author Costin Leau

+ */

+public interface Listener {

+

+	void bind(Object service, Map props);

+	

+	void unbind(Object service, Map props);

+}

diff --git a/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java.bak b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java.bak
new file mode 100644
index 0000000..35abb7c
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/Listener.java.bak
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.proxy.listener;

+

+import java.util.Map;

+

+/**

+ * @author Costin Leau

+ */

+public interface Listener {

+

+	void bind(Object service, Map props);

+	

+	void unbind(Object service, Map props);

+}

diff --git a/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java
new file mode 100644
index 0000000..89d2325
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java
@@ -0,0 +1,33 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxy.listener.internal;

+

+import java.util.Map;

+

+import org.eclipse.gemini.blueprint.iandt.proxy.listener.Listener;

+

+/**

+ * @author Costin Leau

+ */

+public class ListenerClass implements Listener {

+

+	public void bind(Object service, Map props) {

+		System.out.println("Bind service " + service + " w/ props "+ props);

+	}

+

+	public void unbind(Object service, Map props) {

+		System.out.println("Unbind service " + service + " w/ props "+ props);

+	}

+}

diff --git a/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java.bak b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java.bak
new file mode 100644
index 0000000..a225b46
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/java/org/eclipse/gemini/blueprint/iandt/proxy/listener/internal/ListenerClass.java.bak
@@ -0,0 +1,33 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.proxy.listener.internal;

+

+import java.util.Map;

+

+import org.springframework.osgi.iandt.proxy.listener.Listener;

+

+/**

+ * @author Costin Leau

+ */

+public class ListenerClass implements Listener {

+

+	public void bind(Object service, Map props) {

+		System.out.println("Bind service " + service + " w/ props "+ props);

+	}

+

+	public void unbind(Object service, Map props) {

+		System.out.println("Unbind service " + service + " w/ props "+ props);

+	}

+}

diff --git a/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..83eb786
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-listener
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.proxy.listener
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Export-Package: org.eclipse.gemini.blueprint.iandt.proxy.listener
diff --git a/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..65d7481
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-proxy-listener
+Bundle-SymbolicName: org.springframework.osgi.iandt.proxy.listener
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Export-Package: org.springframework.osgi.iandt.proxy.listener
diff --git a/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml
new file mode 100644
index 0000000..a6859df
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.eclipse.gemini.blueprint.iandt.proxy.listener.internal.ListenerClass"/>
+
+    <osgi:service id="export" ref="listener" interface="org.eclipse.gemini.blueprint.iandt.proxy.listener.Listener"/>
+        
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml.bak b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml.bak
new file mode 100644
index 0000000..ed7c55c
--- /dev/null
+++ b/integration-tests/bundles/proxy.listener/src/main/resources/META-INF/spring/config.xml.bak
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.springframework.osgi.iandt.proxy.listener.internal.ListenerClass"/>
+
+    <osgi:service id="export" ref="listener" interface="org.springframework.osgi.iandt.proxy.listener.Listener"/>
+        
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/reference.test.bundle/.classpath b/integration-tests/bundles/reference.test.bundle/.classpath
new file mode 100644
index 0000000..3e1c441
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/Simple Service Bundle"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/reference.test.bundle/.project b/integration-tests/bundles/reference.test.bundle/.project
new file mode 100644
index 0000000..68e9319
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Service Reference Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/reference.test.bundle/pom.xml b/integration-tests/bundles/reference.test.bundle/pom.xml
new file mode 100644
index 0000000..af9b498
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/pom.xml
@@ -0,0 +1,27 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>reference.proxy</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context service reference lifecycle test bundle</name>
+    <description>An OSGi bundle that tests the proxy behavior on an OSGi service reference</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies> 
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java b/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java
new file mode 100644
index 0000000..58ac078
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.reference.proxy;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 25, 2006
+ *         Time: 12:50:20 PM
+ */
+public class ServiceReferer {
+    public static MyService serviceReference;
+
+    public void setReference(MyService reference) {
+        serviceReference = reference;
+    }
+}
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak b/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak
new file mode 100644
index 0000000..009fc05
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/reference/proxy/ServiceReferer.java.bak
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.reference.proxy;
+
+import org.springframework.osgi.iandt.simpleservice.MyService;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 25, 2006
+ *         Time: 12:50:20 PM
+ */
+public class ServiceReferer {
+    public static MyService serviceReference;
+
+    public void setReference(MyService reference) {
+        serviceReference = reference;
+    }
+}
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..591766a
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: org-springframework-osgi-iandt-reference-proxy
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.reference.proxy
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.iandt.reference.proxy
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..bd493cc
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,7 @@
+Bundle-Name: org-springframework-osgi-iandt-reference-proxy
+Bundle-SymbolicName: org.springframework.osgi.iandt.reference.proxy
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-ClassPath: .
+Import-Package: org.springframework.osgi.iandt.simpleservice
+Export-Package: org.springframework.osgi.iandt.reference.proxy
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml
new file mode 100644
index 0000000..90aa8bd
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="referer" class="org.eclipse.gemini.blueprint.iandt.reference.proxy.ServiceReferer" lazy-init="false">
+        <property name="reference" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi" timeout="3000" interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak
new file mode 100644
index 0000000..c0c4fa2
--- /dev/null
+++ b/integration-tests/bundles/reference.test.bundle/src/main/resources/META-INF/spring/reference.xml.bak
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="referer" class="org.springframework.osgi.iandt.reference.proxy.ServiceReferer" lazy-init="false">
+        <property name="reference" ref="simpleServiceOsgi"/>
+    </bean>
+
+    <osgi:reference id="simpleServiceOsgi" timeout="3000" interface="org.springframework.osgi.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/scoped.a.bundle/.classpath b/integration-tests/bundles/scoped.a.bundle/.classpath
new file mode 100644
index 0000000..105bcab
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/scoped.a.bundle/.project b/integration-tests/bundles/scoped.a.bundle/.project
new file mode 100644
index 0000000..22e7bf0
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Bundle-Scope A Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/scoped.a.bundle/pom.xml b/integration-tests/bundles/scoped.a.bundle/pom.xml
new file mode 100644
index 0000000..b874c31
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>scoped.bundle.a</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Bundle scoping test bundle - A</name>
+    <description>An OSGi bundle which tests 'bundle' scoped beans</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+ 
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/scoped.a.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/a/BeanReference.java b/integration-tests/bundles/scoped.a.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/a/BeanReference.java
new file mode 100644
index 0000000..d5fcb8f
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/a/BeanReference.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.scope.a;

+

+/**

+ * @author Costin Leau

+ *

+ */

+public class BeanReference {

+	public static Object BEAN = null;

+

+	public void setBean(Object bean) {

+		BEAN = bean;

+	}

+	

+	

+}

diff --git a/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..12a73f4
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Name: org-eclipse-gemini-blueprint-iandt-scope-a
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.scope.a
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Import-Package: org.eclipse.gemini.blueprint.iandt.scope.common
+Export-Package: org.eclipse.gemini.blueprint.iandt.scope.a
+Bundle-ClassPath: .,
+ target/classes/
\ No newline at end of file
diff --git a/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/spring/scoped-beans.xml b/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/spring/scoped-beans.xml
new file mode 100644
index 0000000..d756e59
--- /dev/null
+++ b/integration-tests/bundles/scoped.a.bundle/src/main/resources/META-INF/spring/scoped-beans.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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"
+       default-lazy-init="false">
+
+
+    <bean id="a.service" class="org.eclipse.gemini.blueprint.iandt.scope.common.HashCodeScopeTestService" scope="bundle"/>
+
+    <osgi:service ref="a.service" interface="org.eclipse.gemini.blueprint.iandt.scope.common.ScopeTestService"/>
+    
+    <bean id="staticReference" class="org.eclipse.gemini.blueprint.iandt.scope.a.BeanReference">
+    	<property name="bean" ref="a.service"/>
+    </bean>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/scoped.b.bundle/.classpath b/integration-tests/bundles/scoped.b.bundle/.classpath
new file mode 100644
index 0000000..105bcab
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/scoped.b.bundle/.project b/integration-tests/bundles/scoped.b.bundle/.project
new file mode 100644
index 0000000..a290e44
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Bundle-Scope B Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/scoped.b.bundle/pom.xml b/integration-tests/bundles/scoped.b.bundle/pom.xml
new file mode 100644
index 0000000..017f2ba
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>scoped.bundle.b</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Bundle scoping test bundle - B</name>
+    <description>An OSGi bundle which tests 'bundle' scoped beans</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java b/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java
new file mode 100644
index 0000000..6b27235
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.scope.b;

+

+/**

+ * @author Costin Leau

+ *

+ */

+public class BeanReference {

+	public static Object BEAN = null;

+

+	public void setBean(Object bean) {

+		BEAN = bean;

+	}

+	

+	

+}

diff --git a/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java.bak b/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java.bak
new file mode 100644
index 0000000..6f80eb2
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/b/BeanReference.java.bak
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.scope.b;

+

+/**

+ * @author Costin Leau

+ *

+ */

+public class BeanReference {

+	public static Object BEAN = null;

+

+	public void setBean(Object bean) {

+		BEAN = bean;

+	}

+	

+	

+}

diff --git a/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..103b3e8
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Name: org.eclipse.gemini.blueprint.iandt-scope-b
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.scope.b
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Import-Package: org.eclipse.gemini.blueprint.iandt.scope.common
+Export-Package: org.eclipse.gemini.blueprint.iandt.scope.b
+Bundle-ClassPath: .,
+ target/classes/
\ No newline at end of file
diff --git a/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/spring/scoped-beans.xml b/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/spring/scoped-beans.xml
new file mode 100644
index 0000000..c5a9f04
--- /dev/null
+++ b/integration-tests/bundles/scoped.b.bundle/src/main/resources/META-INF/spring/scoped-beans.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:osgi="http://www.springframework.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"
+	default-lazy-init="false">
+
+	<bean id="b.service"
+		class="org.eclipse.gemini.blueprint.iandt.scope.common.HashCodeScopeTestService"
+		scope="bundle" />
+
+	<osgi:service ref="b.service" auto-export="all-classes" />
+	
+	
+	<osgi:reference id="serviceFromA"
+		interface="org.eclipse.gemini.blueprint.iandt.scope.common.ScopeTestService"
+		filter="(Bundle-SymbolicName=org.eclipse.gemini.blueprint.iandt.scope.a)"
+		cardinality="0..1" timeout="10"
+	/>
+
+	<bean id="staticReference"
+		class="org.eclipse.gemini.blueprint.iandt.scope.b.BeanReference">
+		<property name="bean" ref="b.service" />
+	</bean>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/scoped.common.bundle/.classpath b/integration-tests/bundles/scoped.common.bundle/.classpath
new file mode 100644
index 0000000..105bcab
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/scoped.common.bundle/.project b/integration-tests/bundles/scoped.common.bundle/.project
new file mode 100644
index 0000000..355c8d5
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Bundle-Scope Common Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/scoped.common.bundle/pom.xml b/integration-tests/bundles/scoped.common.bundle/pom.xml
new file mode 100644
index 0000000..ca81bed
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>scoped.bundle.common</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Bundle scoping test bundle - Common</name>
+    <description>An OSGi bundle which tests 'bundle' scoped beans</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/HashCodeScopeTestService.java b/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/HashCodeScopeTestService.java
new file mode 100644
index 0000000..3fd80d1
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/HashCodeScopeTestService.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.scope.common;

+

+import java.util.Properties;

+

+/**

+ * Hash-code based identity test.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class HashCodeScopeTestService extends Properties implements ScopeTestService {

+

+	public String getServiceIdentity() {

+		return "" + System.identityHashCode(this);

+	}

+

+}

diff --git a/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/ScopeTestService.java b/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/ScopeTestService.java
new file mode 100644
index 0000000..a01aa21
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/scope/common/ScopeTestService.java
@@ -0,0 +1,30 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.scope.common;

+

+/**

+ * Interface for scope testing.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public interface ScopeTestService {

+	/**

+	 * Returns a String which identifies the underlying service instance.

+	 * @see #hashCode()

+	 * @return

+	 */

+	String getServiceIdentity();

+}

diff --git a/integration-tests/bundles/scoped.common.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/scoped.common.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..58b2848
--- /dev/null
+++ b/integration-tests/bundles/scoped.common.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: org.eclipse.gemini.blueprint.iandt-scope-common
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.scope.common
+Bundle-Version: 1.0
+Export-Package: org.eclipse.gemini.blueprint.iandt.scope.common
+Bundle-ClassPath: .,
+ target/classes/
\ No newline at end of file
diff --git a/integration-tests/bundles/service.listener.bundle/.classpath b/integration-tests/bundles/service.listener.bundle/.classpath
new file mode 100644
index 0000000..3227bdf
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service/1.0.0.M1-SNAPSHOT/simple.service-1.0.0.M1-SNAPSHOT.jar"/>	
+</classpath>
diff --git a/integration-tests/bundles/service.listener.bundle/.project b/integration-tests/bundles/service.listener.bundle/.project
new file mode 100644
index 0000000..a299627
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Reference Listener Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/service.listener.bundle/pom.xml b/integration-tests/bundles/service.listener.bundle/pom.xml
new file mode 100644
index 0000000..b9cc90e
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>service.listener</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring context service listener test bundle</name>
+    <description>An OSGi bundle that tests the listener on an OSGi service reference</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
+
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java b/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java
new file mode 100644
index 0000000..882d63d
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java
@@ -0,0 +1,45 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.service.listener;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+import java.util.Dictionary;
+
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 14, 2006
+ *         Time: 8:07:27 AM
+ */
+public class MyListener {
+    public static int BOUND_COUNT = 0;
+    public static int UNBOUND_COUNT = 0;
+
+
+    public void serviceAvailable(MyService simpleService, Dictionary props) {
+        BOUND_COUNT++;
+    }
+
+
+    public void serviceUnavailable(MyService simpleService, Dictionary props) {
+        UNBOUND_COUNT++;
+    }
+
+
+    public void setSimpleService(MyService simpleService) {
+        // Dummy used to force initialization of osgi service reference to simple service
+    }
+}
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java.bak b/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java.bak
new file mode 100644
index 0000000..5cb215e
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/java/org/springframework/osgi/iandt/service/listener/MyListener.java.bak
@@ -0,0 +1,45 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.service.listener;
+
+import org.springframework.osgi.iandt.simpleservice.MyService;
+import java.util.Dictionary;
+
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Nov 14, 2006
+ *         Time: 8:07:27 AM
+ */
+public class MyListener {
+    public static int BOUND_COUNT = 0;
+    public static int UNBOUND_COUNT = 0;
+
+
+    public void serviceAvailable(MyService simpleService, Dictionary props) {
+        BOUND_COUNT++;
+    }
+
+
+    public void serviceUnavailable(MyService simpleService, Dictionary props) {
+        UNBOUND_COUNT++;
+    }
+
+
+    public void setSimpleService(MyService simpleService) {
+        // Dummy used to force initialization of osgi service reference to simple service
+    }
+}
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6011205
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Name: org-springframework-osgi-iandt-service-listener
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.service.listener
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Bundle-ClassPath: .
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.iandt.service.listener
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..2aaf297
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,8 @@
+Bundle-Name: org-springframework-osgi-iandt-service-listener
+Bundle-SymbolicName: org.springframework.osgi.iandt.service.listener
+Bundle-ManifestVersion: 2
+Bundle-Version: 1.0
+Bundle-ClassPath: .
+Import-Package: org.springframework.osgi.iandt.simpleservice
+Export-Package: org.springframework.osgi.iandt.service.listener
+Spring-Context: *; eagerly-init-importers:=true
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml
new file mode 100644
index 0000000..ffe4de8
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.eclipse.gemini.blueprint.iandt.service.listener.MyListener">
+        <property name="simpleService" ref="simpleServiceOsgi"/>
+    </bean>
+
+	
+    <osgi:reference id="simpleServiceOsgi" interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService">
+		<osgi:reference-listener bind-method="serviceAvailable" unbind-method="serviceUnavailable" ref="listener"/>
+    </osgi:reference> 
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml.bak b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml.bak
new file mode 100644
index 0000000..8e08d52
--- /dev/null
+++ b/integration-tests/bundles/service.listener.bundle/src/main/resources/META-INF/spring/service-listener.xml.bak
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <bean id="listener" class="org.springframework.osgi.iandt.service.listener.MyListener">
+        <property name="simpleService" ref="simpleServiceOsgi"/>
+    </bean>
+
+	
+    <osgi:reference id="simpleServiceOsgi" interface="org.springframework.osgi.iandt.simpleservice.MyService">
+		<osgi:reference-listener bind-method="serviceAvailable" unbind-method="serviceUnavailable" ref="listener"/>
+    </osgi:reference> 
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.2.bundle/.classpath b/integration-tests/bundles/simple.service.2.bundle/.classpath
new file mode 100644
index 0000000..e7ea4d6
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/integration-tests/bundles/simple.service.2.bundle/.project b/integration-tests/bundles/simple.service.2.bundle/.project
new file mode 100644
index 0000000..5d27eff
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Simple Service (2nd) Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/simple.service.2.bundle/pom.xml b/integration-tests/bundles/simple.service.2.bundle/pom.xml
new file mode 100644
index 0000000..964c43d
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>simple.service2</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service test bundle 2</name>
+    <description>An OSGi bundle that provides another simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2fbe351
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.simpleservice2
+Bundle-Name: Simple-Service-2
+Bundle-Vendor: Spring Framework
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice2, org.eclipse.gemini.blueprint.iandt.simpleservice2.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
new file mode 100644
index 0000000..7273779
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+    
+    <osgi:service id="simpleServiceOsgi" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2">
+        <osgi:service-properties>
+            <entry key="service" value="2"/>
+        </osgi:service-properties>
+    </osgi:service>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice.xml b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice.xml
new file mode 100644
index 0000000..9360ba6
--- /dev/null
+++ b/integration-tests/bundles/simple.service.2.bundle/src/main/resources/META-INF/spring/simpleservice.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.simpleservice2.impl.MyService2Impl" lazy-init="false"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.3.bundle/.classpath b/integration-tests/bundles/simple.service.3.bundle/.classpath
new file mode 100644
index 0000000..e7ea4d6
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/integration-tests/bundles/simple.service.3.bundle/.project b/integration-tests/bundles/simple.service.3.bundle/.project
new file mode 100644
index 0000000..9e6ee45
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Simple Service (3rd) Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/simple.service.3.bundle/pom.xml b/integration-tests/bundles/simple.service.3.bundle/pom.xml
new file mode 100644
index 0000000..240a56f
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>simple.service3</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service test bundle 3</name>
+    <description>An OSGi bundle that provides yet another simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..0831d7f
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.simpleservice3
+Bundle-Name: Simple-Service-2
+Bundle-Vendor: Spring Framework
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice2, org.eclipse.gemini.blueprint.iandt.simpleservice2.impl 
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
new file mode 100644
index 0000000..cce0806
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+    
+    <osgi:service id="simpleServiceOsgi" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2" ranking="4">
+        <osgi:service-properties>
+            <entry key="service" value="3"/>
+        </osgi:service-properties>
+    </osgi:service>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice.xml b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice.xml
new file mode 100644
index 0000000..9360ba6
--- /dev/null
+++ b/integration-tests/bundles/simple.service.3.bundle/src/main/resources/META-INF/spring/simpleservice.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.simpleservice2.impl.MyService2Impl" lazy-init="false"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/.classpath b/integration-tests/bundles/simple.service.bundle.2.identical/.classpath
new file mode 100644
index 0000000..74c438d
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/.classpath
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/spring-osgi-test-support"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/Simple Service Bundle"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/.project b/integration-tests/bundles/simple.service.bundle.2.identical/.project
new file mode 100644
index 0000000..2da907f
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Simple (Identical) Service (2nd) Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/pom.xml b/integration-tests/bundles/simple.service.bundle.2.identical/pom.xml
new file mode 100644
index 0000000..70bd16a
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>simple.service.2.identical</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service test bundle (impl differs)</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
+
diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
new file mode 100644
index 0000000..fa13c1a
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice.impl;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Andy Piper
+ */
+public class MyServiceImpl implements MyService {
+    // The counter can be used to check that the class has been freshly loaded, rather than
+    // reused by the system
+    private static int counter = 1;
+    public String stringValue() {
+		return "Dalton.  Timothy Dalton #" + counter++;
+	}
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b0fb808
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.simpleservice.identical
+Bundle-Name: Simple-Service-Sample
+Bundle-Vendor: Spring Framework
+Spring-Context: *; eagerly-init-importers:=true
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.samples.simpleservice.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml
new file mode 100644
index 0000000..5bd412b
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service id="simpleServiceOsgiIdentical" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
diff --git a/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice.xml b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice.xml
new file mode 100644
index 0000000..367d0c4
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.2.identical/src/main/resources/META-INF/spring/simpleservice.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.simpleservice.impl.MyServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.bundle.identical/.classpath b/integration-tests/bundles/simple.service.bundle.identical/.classpath
new file mode 100644
index 0000000..74c438d
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/.classpath
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/spring-osgi-test-support"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/Simple Service Bundle"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/simple.service.bundle.identical/.project b/integration-tests/bundles/simple.service.bundle.identical/.project
new file mode 100644
index 0000000..7942346
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Simple (Identical) Service Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/simple.service.bundle.identical/pom.xml b/integration-tests/bundles/simple.service.bundle.identical/pom.xml
new file mode 100644
index 0000000..e3e9da9
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>simple.service.identical</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service test bundle (impl differs)</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
+
diff --git a/integration-tests/bundles/simple.service.bundle.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java b/integration-tests/bundles/simple.service.bundle.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
new file mode 100644
index 0000000..d4070b1
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice.impl;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+
+/**
+ * @author Andy Piper
+ */
+public class MyServiceImpl implements MyService {
+    // The counter can be used to check that the class has been freshly loaded, rather than
+    // reused by the system
+    private static int counter = 1;
+    public String stringValue() {
+		return "Connery.  Sean Connery #" + counter++;
+	}
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b0fb808
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.simpleservice.identical
+Bundle-Name: Simple-Service-Sample
+Bundle-Vendor: Spring Framework
+Spring-Context: *; eagerly-init-importers:=true
+Import-Package: org.eclipse.gemini.blueprint.iandt.simpleservice
+Export-Package: org.eclipse.gemini.blueprint.samples.simpleservice.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml
new file mode 100644
index 0000000..5bd412b
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice-osgi.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service id="simpleServiceOsgiIdentical" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
diff --git a/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice.xml b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice.xml
new file mode 100644
index 0000000..367d0c4
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle.identical/src/main/resources/META-INF/spring/simpleservice.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.simpleservice.impl.MyServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.bundle/.classpath b/integration-tests/bundles/simple.service.bundle/.classpath
new file mode 100644
index 0000000..26f1019
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar" sourcepath="/SPRING_SRC"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/simple.service.bundle/.project b/integration-tests/bundles/simple.service.bundle/.project
new file mode 100644
index 0000000..e8d2b71
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Simple Service Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/simple.service.bundle/pom.xml b/integration-tests/bundles/simple.service.bundle/pom.xml
new file mode 100644
index 0000000..3a88502
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/pom.xml
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>simple.service</artifactId>
+	<packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Simple service test bundle</name>
+    <description>An OSGi bundle that provides a simple service</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+</project>
+
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java
new file mode 100644
index 0000000..c6b36a8
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/MyService.java
@@ -0,0 +1,27 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:05:23 PM
+ */
+public interface MyService {
+
+	String stringValue();
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
new file mode 100644
index 0000000..0977ee3
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice/impl/MyServiceImpl.java
@@ -0,0 +1,39 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice.impl;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:06:01 PM
+ */
+public class MyServiceImpl implements MyService, InitializingBean {
+    public void afterPropertiesSet() throws Exception {
+        Integer delay = Integer.getInteger("org.eclipse.gemini.blueprint.iandt.simpleservice.impl.delay", new Integer(0));
+        System.getProperties().remove("org.eclipse.gemini.blueprint.iandt.simpleservice.impl.delay");
+        System.out.println("Delaying for:" + delay);
+        Thread.sleep(delay.intValue());
+    }
+
+
+    public String stringValue() {
+		return "Bond.  James Bond.";
+	}
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java
new file mode 100644
index 0000000..b9a6f44
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/MyService2.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:05:23 PM
+ */
+public interface MyService2 {
+
+	String stringValue();
+
+    void voidMethod();
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java
new file mode 100644
index 0000000..5fc0405
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/simpleservice2/impl/MyService2Impl.java
@@ -0,0 +1,34 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.simpleservice2.impl;
+
+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Dec 1, 2006
+ *         Time: 3:06:01 PM
+ */
+public class MyService2Impl implements MyService2 { 
+    public String stringValue() {
+        return "Finklestein.  Bartholomew Finklestein";
+    }
+
+    public void voidMethod() {
+        System.out.println("void method called"); 
+    }
+
+}
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..593321b
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.simpleservice
+Bundle-Name: Simple-Service-Sample
+Bundle-Vendor: Spring Framework
+Spring-Context: *; eagerly-init-importers:=true
+Import-Package: org.springframework.beans.factory
+Export-Package: org.eclipse.gemini.blueprint.iandt.simpleservice, org.eclipse.gemini.blueprint.iandt.simpleservice2,
+  org.eclipse.gemini.blueprint.iandt.simpleservice2.impl
+Bundle-ClassPath: .,
+ target/classes/
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
new file mode 100644
index 0000000..61c1e48
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice-osgi.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.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">
+
+    <osgi:service id="simpleServiceExportedToOsgi" ref="simpleService"
+                  interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice.xml b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice.xml
new file mode 100644
index 0000000..367d0c4
--- /dev/null
+++ b/integration-tests/bundles/simple.service.bundle/src/main/resources/META-INF/spring/simpleservice.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean name="simpleService" class="org.eclipse.gemini.blueprint.iandt.simpleservice.impl.MyServiceImpl"/>
+
+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/tccl.bundle/.classpath b/integration-tests/bundles/tccl.bundle/.classpath
new file mode 100644
index 0000000..623b52a
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/tccl.bundle/.project b/integration-tests/bundles/tccl.bundle/.project
new file mode 100644
index 0000000..79daa3b
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>TCCL Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/tccl.bundle/pom.xml b/integration-tests/bundles/tccl.bundle/pom.xml
new file mode 100644
index 0000000..88182a7
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>tccl</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring service TCCL management test bundle</name>
+    <description>An OSGi test bundle that gives access to the TCCL during service invocations</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>tccl.intf</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
+
diff --git a/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java b/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java
new file mode 100644
index 0000000..9c914e4
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java
@@ -0,0 +1,33 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.tccl.internal;
+
+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;
+
+/**
+ * Private class that should not be exposed.
+ * 
+ * @author Costin Leau
+ */
+public class PrivateTCCLServiceImplementation implements TCCLService {
+
+	public ClassLoader getTCCL() {
+		return Thread.currentThread().getContextClassLoader();
+	}
+
+	public String toString() {
+		return PrivateTCCLServiceImplementation.class.getName() + "#" + System.identityHashCode(this);
+	}
+}
diff --git a/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java.bak b/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java.bak
new file mode 100644
index 0000000..39e1e9b
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/internal/PrivateTCCLServiceImplementation.java.bak
@@ -0,0 +1,33 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.tccl.internal;
+
+import org.springframework.osgi.iandt.tccl.TCCLService;
+
+/**
+ * Private class that should not be exposed.
+ * 
+ * @author Costin Leau
+ */
+public class PrivateTCCLServiceImplementation implements TCCLService {
+
+	public ClassLoader getTCCL() {
+		return Thread.currentThread().getContextClassLoader();
+	}
+
+	public String toString() {
+		return PrivateTCCLServiceImplementation.class.getName() + "#" + System.identityHashCode(this);
+	}
+}
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b9e6192
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-tccl
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.tccl
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Import-Package: org.eclipse.gemini.blueprint.iandt.tccl
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..0057514
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-tccl
+Bundle-SymbolicName: org.springframework.osgi.iandt.tccl
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Import-Package: org.springframework.osgi.iandt.tccl
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml
new file mode 100644
index 0000000..7bbffb0
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">
+
+	<bean id="service"

+		class="org.eclipse.gemini.blueprint.iandt.tccl.internal.PrivateTCCLServiceImplementation"

+		lazy-init="false" />

+

+	<!-- export service with unmanaged tccl -->

+	<osgi:service ref="service" auto-export="interfaces" context-class-loader="unmanaged">

+		<osgi:service-properties>

+			<entry key="tccl" value="unmanaged"/>

+		</osgi:service-properties>

+	</osgi:service>

+

+	<!-- export service with managed tccl -->

+	<osgi:service ref="service" auto-export="interfaces" context-class-loader="service-provider">

+		<osgi:service-properties>

+			<entry key="tccl" value="service-provider"/>

+		</osgi:service-properties>

+	</osgi:service>

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml.bak b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml.bak
new file mode 100644
index 0000000..d63cfa0
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/META-INF/spring/context.xml.bak
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">
+
+	<bean id="service"

+		class="org.springframework.osgi.iandt.tccl.internal.PrivateTCCLServiceImplementation"

+		lazy-init="false" />

+

+	<!-- export service with unmanaged tccl -->

+	<osgi:service ref="service" auto-export="interfaces" context-class-loader="unmanaged">

+		<osgi:service-properties>

+			<entry key="tccl" value="unmanaged"/>

+		</osgi:service-properties>

+	</osgi:service>

+

+	<!-- export service with managed tccl -->

+	<osgi:service ref="service" auto-export="interfaces" context-class-loader="service-provider">

+		<osgi:service-properties>

+			<entry key="tccl" value="service-provider"/>

+		</osgi:service-properties>

+	</osgi:service>

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/internal/internal-resource.file b/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/internal/internal-resource.file
new file mode 100644
index 0000000..222f81e
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/internal/internal-resource.file
@@ -0,0 +1 @@
+dummy file used for resource location
\ No newline at end of file
diff --git a/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/service-resource.file b/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/service-resource.file
new file mode 100644
index 0000000..222f81e
--- /dev/null
+++ b/integration-tests/bundles/tccl.bundle/src/main/resources/org/eclipse/gemini/blueprint/iandt/tccl/service-resource.file
@@ -0,0 +1 @@
+dummy file used for resource location
\ No newline at end of file
diff --git a/integration-tests/bundles/tccl.intf.bundle/pom.xml b/integration-tests/bundles/tccl.intf.bundle/pom.xml
new file mode 100644
index 0000000..e989cdf
--- /dev/null
+++ b/integration-tests/bundles/tccl.intf.bundle/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+        <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <artifactId>tccl.intf</artifactId>
+    <packaging>jar</packaging>
+    <name>Gemini Blueprint Test Bundle: Spring service TCCL management inteface test bundle</name>
+    <description>An OSGi test bundle that gives access to the TCCL during service invocations</description>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+</project>
+
diff --git a/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java b/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java
new file mode 100644
index 0000000..91e9693
--- /dev/null
+++ b/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java
@@ -0,0 +1,32 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.tccl;
+
+/**
+ * Simple service that loads classes and resources using the context
+ * classloader.
+ * 
+ * @author Costin Leau
+ */
+public interface TCCLService {
+
+	/**
+	 * Return the TCCL class loader used during the service invocation.
+	 * 
+	 * @return TCCL Class<?> Loader
+	 */
+	public ClassLoader getTCCL();
+
+}
diff --git a/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java.bak b/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java.bak
new file mode 100644
index 0000000..3dd5795
--- /dev/null
+++ b/integration-tests/bundles/tccl.intf.bundle/src/main/java/org/eclipse/gemini/blueprint/iandt/tccl/TCCLService.java.bak
@@ -0,0 +1,32 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.tccl;
+
+/**
+ * Simple service that loads classes and resources using the context
+ * classloader.
+ * 
+ * @author Costin Leau
+ */
+public interface TCCLService {
+
+	/**
+	 * Return the TCCL class loader used during the service invocation.
+	 * 
+	 * @return TCCL Class<?> Loader
+	 */
+	public ClassLoader getTCCL();
+
+}
diff --git a/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1b5c23e
--- /dev/null
+++ b/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-tccl-intf
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.tccl.intf
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Export-Package: org.eclipse.gemini.blueprint.iandt.tccl
diff --git a/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF.bak b/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
new file mode 100644
index 0000000..8cda38b
--- /dev/null
+++ b/integration-tests/bundles/tccl.intf.bundle/src/main/resources/META-INF/MANIFEST.MF.bak
@@ -0,0 +1,5 @@
+Bundle-Name: org-springframework-osgi-iandt-tccl-intf
+Bundle-SymbolicName: org.springframework.osgi.iandt.tccl.intf
+Bundle-Version: 1.0
+Bundle-ManifestVersion: 2
+Export-Package: org.springframework.osgi.iandt.tccl
diff --git a/integration-tests/bundles/trivial.bundle/.classpath b/integration-tests/bundles/trivial.bundle/.classpath
new file mode 100644
index 0000000..50ce411
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry output="target/test-classes" kind="src" path="src/test/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/integration-tests/bundles/trivial.bundle/.project b/integration-tests/bundles/trivial.bundle/.project
new file mode 100644
index 0000000..b577c5e
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Trivial Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/trivial.bundle/build.properties b/integration-tests/bundles/trivial.bundle/build.properties
new file mode 100644
index 0000000..53a7e68
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/build.properties
@@ -0,0 +1,9 @@
+source.. = src/main/java/,src/main/resources/,src/test/java,src/test/resources

+output.. = target/classes/,target/test-classes

+bin.includes = META-INF/,\

+               .,\

+               target/classes/

+src.includes = src/main/java/,\

+               src/main/resources/,\

+               src/test/java/,\

+               src/test/resources/

diff --git a/integration-tests/bundles/trivial.bundle/pom.xml b/integration-tests/bundles/trivial.bundle/pom.xml
new file mode 100644
index 0000000..71426fc
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/pom.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <artifactId>trivial</artifactId>
+  <packaging>jar</packaging>
+  <name>Gemini Blueprint Test Bundle: Trivial OSGi bundle</name>
+  <description>An OSGi bundle that contains and exports just one class
+  </description>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+</project>
\ No newline at end of file
diff --git a/integration-tests/bundles/trivial.bundle/src/main/java/org/springframework/osgi/iandt/trivial/TrivialClass.java b/integration-tests/bundles/trivial.bundle/src/main/java/org/springframework/osgi/iandt/trivial/TrivialClass.java
new file mode 100644
index 0000000..0ef4396
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/src/main/java/org/springframework/osgi/iandt/trivial/TrivialClass.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.trivial;
+
+
+/**
+ * Used as the most basic test possible of the OSGi test harness support
+ */
+public class TrivialClass {
+
+    public boolean trueValue() { return true; }
+
+    public boolean falseValue() { return false; }
+
+    public int ten() { return 10; }
+
+}
diff --git a/integration-tests/bundles/trivial.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/trivial.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1090e97
--- /dev/null
+++ b/integration-tests/bundles/trivial.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Bundle-Name: Trivial-Bundle
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.trivial
+Export-Package: org.springframework.osgi.iandt.trivial
+Bundle-Version: 1.0
+Bundle-ClassPath: target/classes/,
+ .
+
diff --git a/integration-tests/bundles/trivial.test.bundle/.classpath b/integration-tests/bundles/trivial.test.bundle/.classpath
new file mode 100644
index 0000000..b713d92
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/.classpath
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/main/resources"/>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>

+	<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/trivial.tests/rfc-124-1.0-SNAPSHOT/trivial.tests-rfc-124-1.0-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2.jar" sourcepath="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2-sources.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/trivial/rfc-124-1.0-SNAPSHOT/trivial-rfc-124-1.0-SNAPSHOT.jar"/>

+	<classpathentry kind="output" path="target/classes"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/trivial.tests/1.0.0.M1-SNAPSHOT/trivial.tests-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2.jar" sourcepath="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2-sources.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/trivial/1.0.0.M1-SNAPSHOT/trivial-1.0.0.M1-SNAPSHOT.jar"/>

+	

+</classpath>

diff --git a/integration-tests/bundles/trivial.test.bundle/.project b/integration-tests/bundles/trivial.test.bundle/.project
new file mode 100644
index 0000000..e8e1160
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Trivial Test Bundle</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.ManifestBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.pde.SchemaBuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/bundles/trivial.test.bundle/build.properties b/integration-tests/bundles/trivial.test.bundle/build.properties
new file mode 100644
index 0000000..560993b
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/build.properties
@@ -0,0 +1,9 @@
+source.. = src/main/java/,src/main/resources/,src/test/java,src/test/resources

+output.. = target/classes/,target/test-classes

+bin.includes = META-INF/,\

+               target/classes/,\

+               .

+src.includes = src/main/java/,\

+               src/main/resources/,\

+               src/test/java/,\

+               src/test/resources/

diff --git a/integration-tests/bundles/trivial.test.bundle/pom.xml b/integration-tests/bundles/trivial.test.bundle/pom.xml
new file mode 100644
index 0000000..2a98736
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?><project>
+  <parent>
+    <artifactId>gemini-blueprint-integration-test-bundles</artifactId>
+    <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <artifactId>trivial.tests</artifactId>
+  <packaging>jar</packaging>
+  <name>Gemini Blueprint Test Bundle: Simple test that uses trivial bundle</name>
+  <description>Contains a single test case that exercises function in 
+   org.springframework.osgi.trivial bundle. Used as a basic proof of 
+   concept for the test harness support.</description>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  <dependencies>
+
+    <dependency>
+      <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+      <artifactId>trivial</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  
+    <!-- JUnit is required at build time not just test time -->
+    <dependency>
+	  <groupId>org.junit</groupId>
+	  <artifactId>com.springsource.junit</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/integration-tests/bundles/trivial.test.bundle/src/main/java/org/springframework/osgi/iandt/trivial/tests/TrivialTest.java b/integration-tests/bundles/trivial.test.bundle/src/main/java/org/springframework/osgi/iandt/trivial/tests/TrivialTest.java
new file mode 100644
index 0000000..bb5b327
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/src/main/java/org/springframework/osgi/iandt/trivial/tests/TrivialTest.java
@@ -0,0 +1,42 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.springframework.osgi.iandt.trivial.tests;
+
+import org.springframework.osgi.iandt.trivial.TrivialClass;
+
+import junit.framework.TestCase;
+
+public class TrivialTest extends TestCase {
+
+    private TrivialClass trivial;
+
+    public void setUp() {
+	this.trivial = new TrivialClass();
+    }
+
+    public void testTrueValue() {
+	assertTrue(trivial.trueValue());
+    }
+
+    public void testFalseValue() {
+	assertFalse(trivial.falseValue());
+    }
+
+    public void testIntValue() {
+	assertEquals(10,trivial.ten());
+    }
+
+
+}
diff --git a/integration-tests/bundles/trivial.test.bundle/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/bundles/trivial.test.bundle/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..3d8501d
--- /dev/null
+++ b/integration-tests/bundles/trivial.test.bundle/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Bundle-Name: Trivial-Bundle-Tests
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.springframework.osgi.iandt.trivial.tests
+Import-Package: org.springframework.osgi.iandt.trivial,junit.framework
+Bundle-Version: 1.0
+Bundle-ClassPath: target/classes/,
+ .
diff --git a/integration-tests/policy.all b/integration-tests/policy.all
new file mode 100644
index 0000000..7bafb0e
--- /dev/null
+++ b/integration-tests/policy.all
@@ -0,0 +1,3 @@
+grant {

+        permission java.security.AllPermission;

+};

diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
new file mode 100644
index 0000000..15bdc7d
--- /dev/null
+++ b/integration-tests/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <parent>
+    <artifactId>gemini-blueprint</artifactId>
+    <groupId>org.eclipse.gemini.blueprint</groupId>
+    <version>1.0.0.M1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+  <artifactId>gemini-blueprint-integration-tests-module</artifactId>
+  <packaging>pom</packaging>
+  <name>Eclipse Gemini Blueprint Integration Tests Module</name>
+  <url>http://www.eclipse.org/gemini/blueprint/</url>
+  
+  <properties>
+	<clover.skip>true</clover.skip>
+	<bundlor.enabled>false</bundlor.enabled>
+  </properties>
+  
+  <modules>
+    <module>bundles</module>
+    <module>tests</module>
+  </modules>
+  
+  <build>
+	  <plugins>
+		  <plugin>
+			<artifactId>maven-deploy-plugin</artifactId>
+			<configuration>
+			  <skip>true</skip>
+			</configuration>
+		  </plugin>
+	  </plugins>
+  </build>
+  
+</project>
diff --git a/integration-tests/tests/.classpath b/integration-tests/tests/.classpath
new file mode 100644
index 0000000..aead6e6
--- /dev/null
+++ b/integration-tests/tests/.classpath
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/osgi/org.eclipse.osgi/3.5.1.R35x_v20090827/org.eclipse.osgi-3.5.1.R35x_v20090827.jar" sourcepath="/M2_REPO/org/eclipse/osgi/org.eclipse.osgi/3.4.3/org.eclipse.osgi-3.4.3-sources.jar"/>

+	<classpathentry kind="var" path="M2_REPO/knopflerfish/framework/3.0.0.beta3/framework-3.0.0.beta3.jar" sourcepath="/KF3_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/M2_REPO/org/springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE-sources.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/SPRING_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/SPRING_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE-sources.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/org.springframework.test/3.0.0.RELEASE/org.springframework.test-3.0.0.RELEASE.jar" sourcepath="/SPRING_MOCK_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.api/1.5.6/com.springsource.slf4j.api-1.5.6.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.org.apache.commons.logging/1.5.6/com.springsource.slf4j.org.apache.commons.logging-1.5.6.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/slf4j/com.springsource.slf4j.log4j/1.5.6/com.springsource.slf4j.log4j-1.5.6.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/lifecycle/1.0.0.M1-SNAPSHOT/lifecycle-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/service.listener/1.0.0.M1-SNAPSHOT/service.listener-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/simple.service/1.0.0.M1-SNAPSHOT/simple.service-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/net/sourceforge/cglib/com.springsource.net.sf.cglib/2.2.0/com.springsource.net.sf.cglib-2.2.0.jar" sourcepath="/CGLIB_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/junit/com.springsource.junit/3.8.2/com.springsource.junit-3.8.2.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/apache/felix/org.apache.felix.main/2.0.2/org.apache.felix.main-2.0.2.jar" sourcepath="/FELIX_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/gemini-blueprint-core/1.0.0.M1-SNAPSHOT/gemini-blueprint-core-1.0.0.M1-SNAPSHOT.jar" sourcepath="/OSGI_SRC_ROOT/core"/>

+	<classpathentry kind="var" path="M2_REPO/org/osgi/osgi_R4_compendium/1.0/osgi_R4_compendium-1.0.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/gemini-blueprint-test/1.0.0.M1-SNAPSHOT/gemini-blueprint-test-1.0.0.M1-SNAPSHOT.jar" sourcepath="/OSGI_SRC_ROOT/test-support/src/main/java"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/gemini-blueprint-io/1.0.0.M1-SNAPSHOT/gemini-blueprint-io-1.0.0.M1-SNAPSHOT.jar" sourcepath="/OSGI_SRC_ROOT/io/src/main/java"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>

+	<classpathentry kind="var" path="M2_REPO/org/objectweb/asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/scoped.bundle.a/1.0.0.M1-SNAPSHOT/scoped.bundle.a-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/scoped.bundle.b/1.0.0.M1-SNAPSHOT/scoped.bundle.b-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/scoped.bundle.common/1.0.0.M1-SNAPSHOT/scoped.bundle.common-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/cardinality0to1/1.0.0.M1-SNAPSHOT/cardinality0to1-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/tccl/1.0.0.M1-SNAPSHOT/tccl-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/configuration/1.0.0.M1-SNAPSHOT/configuration-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/reference.proxy/1.0.0.M1-SNAPSHOT/reference.proxy-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/javax/servlet/com.springsource.javax.servlet/2.4.0/com.springsource.javax.servlet-2.4.0.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/osgi/jasper.osgi/5.5.23-SNAPSHOT/jasper.osgi-5.5.23-SNAPSHOT.jar" sourcepath="/JASPER_SRC"/>

+	<classpathentry kind="var" path="M2_REPO/org/springframework/osgi/catalina.osgi/5.5.23-SNAPSHOT/catalina.osgi-5.5.23-SNAPSHOT.jar" sourcepath="/CATALINA_5.5.X"/>

+	<classpathentry kind="var" path="M2_REPO/com/cenqua/clover/clover/2.3.1/clover-2.3.1.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/gemini-blueprint-extender/1.0.0.M1-SNAPSHOT/gemini-blueprint-extender-1.0.0.M1-SNAPSHOT.jar" sourcepath="/OSGI_SRC_ROOT/extender/src/main/java"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/proxy.listener/1.0.0.M1-SNAPSHOT/proxy.listener-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/apache/log4j/com.springsource.org.apache.log4j/1.2.15/com.springsource.org.apache.log4j-1.2.15.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/tccl.intf/1.0.0.M1-SNAPSHOT/tccl.intf-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="var" path="M2_REPO/org/eclipse/gemini/blueprint/iandt/component.scan.bundle/1.0.0.M1-SNAPSHOT/component.scan.bundle-1.0.0.M1-SNAPSHOT.jar"/>

+	<classpathentry kind="output" path="target/test-classes"/>

+</classpath>

diff --git a/integration-tests/tests/.project b/integration-tests/tests/.project
new file mode 100644
index 0000000..72c7d39
--- /dev/null
+++ b/integration-tests/tests/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>Gemini Blueprint Integration Tests</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+	</natures>

+</projectDescription>

diff --git a/integration-tests/tests/build.properties b/integration-tests/tests/build.properties
new file mode 100644
index 0000000..53a7e68
--- /dev/null
+++ b/integration-tests/tests/build.properties
@@ -0,0 +1,9 @@
+source.. = src/main/java/,src/main/resources/,src/test/java,src/test/resources

+output.. = target/classes/,target/test-classes

+bin.includes = META-INF/,\

+               .,\

+               target/classes/

+src.includes = src/main/java/,\

+               src/main/resources/,\

+               src/test/java/,\

+               src/test/resources/

diff --git a/integration-tests/tests/pom.xml b/integration-tests/tests/pom.xml
new file mode 100644
index 0000000..f5cc977
--- /dev/null
+++ b/integration-tests/tests/pom.xml
@@ -0,0 +1,335 @@
+<?xml version="1.0"?>
+<project>
+    <parent>
+        <artifactId>gemini-blueprint</artifactId>
+        <groupId>org.eclipse.gemini.blueprint</groupId>
+        <version>1.0.0.M1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.eclipse.gemini.blueprint</groupId>
+    <artifactId>gemini-blueprint-integration-tests</artifactId>
+    <packaging>jar</packaging>
+    <name>Eclipse Gemini Blueprint Integration Tests</name>
+    <url>http://www.eclipse.org/gemini/blueprint/</url>
+
+    <properties>
+       <bundlor.enabled>false</bundlor.enabled>
+    </properties>
+  
+    <dependencies>
+        <!-- config admin (from Felix) -->
+        <dependency>
+		   <groupId>org.apache.felix</groupId>
+		   <artifactId>org.apache.felix.configadmin</artifactId>
+		   <version>1.2.4</version>
+		   <scope>provided</scope>
+		   <exclusions>
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.core</artifactId>
+            </exclusion>          
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.compendium</artifactId>
+            </exclusion>          
+		   </exclusions>
+		</dependency>
+
+		<!-- metatype service -->
+        <dependency>
+		   <groupId>org.apache.felix</groupId>
+		   <artifactId>org.apache.felix.metatype</artifactId>
+		   <version>1.0.2</version>
+		   <scope>provided</scope>
+		   <exclusions>
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.core</artifactId>
+            </exclusion>          
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.compendium</artifactId>
+            </exclusion>          
+		   </exclusions>
+		</dependency>
+  
+  
+        <dependency>
+		   <groupId>org.apache.felix</groupId>
+		   <artifactId>org.apache.felix.eventadmin</artifactId>
+		   <version>1.0.0</version>
+		   <scope>provided</scope>
+		   <exclusions>
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.core</artifactId>
+            </exclusion>          
+            <exclusion>
+  			  <groupId>org.apache.felix</groupId>
+			  <artifactId>org.osgi.compendium</artifactId>
+            </exclusion>          
+		   </exclusions>
+		</dependency>
+		
+	    <dependency>
+            <groupId>net.sourceforge.cglib</groupId>
+            <artifactId>com.springsource.net.sf.cglib</artifactId>
+            <version>2.2.0</version>
+            <scope>provided</scope>
+        </dependency> 
+        
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-extender</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-test</artifactId>
+            <scope>provided</scope>
+        </dependency> 
+<!--
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint</groupId>
+            <artifactId>gemini-blueprint-annotation</artifactId>
+            <scope>provided</scope>
+        </dependency>
+-->    	
+    	<dependency>
+      		<groupId>org.aopalliance</groupId>
+      		<artifactId>com.springsource.org.aopalliance</artifactId>
+      		<scope>provided</scope>
+    	</dependency>
+
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>service.listener</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>lifecycle</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>reference.proxy</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>simple.service2</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>cardinality0to1</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>scoped.bundle.a</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>scoped.bundle.b</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>scoped.bundle.common</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>configuration</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>dependencies</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>tccl.intf</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>proxy.listener</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>osgi_R4_compendium</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+
+
+		<!-- this dependency exists only to test clogging 1.0.4 behaviour -->
+		<!-- slf4j is strongly recommended as a replacement for clogging at least for OSGi environments
+		<dependency>
+			<groupId>org.eclipse.bundles</groupId>
+			<artifactId>commons-logging</artifactId>
+			<version>20070611</version>
+			<scope>provided</scope>
+		</dependency>
+		 -->
+
+		<!--
+		  web artifacts
+		  -->
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>com.springsource.javax.servlet</artifactId>
+			<version>2.4.0</version>
+			<scope>provided</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework.osgi</groupId>
+			<artifactId>jsp-api.osgi</artifactId>
+			<version>2.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+				
+		<dependency>
+		  <groupId>net.sourceforge.mx4j</groupId>
+		  <artifactId>com.springsource.mx4j</artifactId>
+		  <version>3.0.2</version>
+		  <scope>test</scope>
+		</dependency>		
+
+		<dependency>
+		  <groupId>org.springframework.osgi</groupId>
+		  <artifactId>jasper.osgi</artifactId>
+		  <version>5.5.23-SNAPSHOT</version>
+		  <scope>test</scope>
+		</dependency>		
+
+		<dependency>
+		  <groupId>org.springframework.osgi</groupId>
+		  <artifactId>commons-el.osgi</artifactId>
+		  <version>1.0-SNAPSHOT</version>
+		  <scope>test</scope>
+		</dependency>		
+
+		<dependency>
+		  <groupId>org.springframework.osgi</groupId>
+		  <artifactId>jstl.osgi</artifactId>
+		  <version>1.1.2-SNAPSHOT</version>
+		  <scope>test</scope>
+		</dependency>		
+
+		<dependency>
+		  <groupId>org.springframework.osgi</groupId>
+		  <artifactId>catalina.osgi</artifactId>
+		  <version>5.5.23-SNAPSHOT</version>
+		  <scope>test</scope>
+		</dependency>		
+
+		<dependency>
+		  <groupId>org.springframework.osgi</groupId>
+		  <artifactId>catalina.start.osgi</artifactId>
+		  <version>1.0.0</version>
+		  <scope>test</scope>
+		</dependency>		
+    <!--
+
+		<dependency>
+		  <groupId>org.eclipse.gemini.blueprint</groupId>
+		  <artifactId>gemini-blueprint-web</artifactId>
+		  <scope>test</scope>
+		</dependency>
+        <dependency>
+           <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+           <artifactId>annotation.proxy</artifactId>
+           <version>${project.parent.version}</version>                    
+           <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>annotation.proxy</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>compile</scope>
+        </dependency>
+    -->
+        
+        <dependency>
+            <groupId>org.eclipse.gemini.blueprint.iandt</groupId>
+            <artifactId>component.scan.bundle</artifactId>
+            <version>${project.parent.version}</version>
+            <scope>compile</scope>
+        </dependency>
+			
+    </dependencies>
+
+
+
+    <build>
+        <plugins>
+			  <plugin>
+				<artifactId>maven-deploy-plugin</artifactId>
+				<configuration>
+				  <skip>true</skip>
+				</configuration>
+			  </plugin>
+        
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <forkMode>pertest</forkMode>
+                    <forkedProcessTimeoutInSeconds>2700</forkedProcessTimeoutInSeconds>
+                    <systemProperties>
+                        <property>
+                            <name>com.gatespace.bundle.cm.store</name>
+                            <value>test-config</value>
+                        </property>
+						<property>
+							<name>org.springframework.osgi.test.framework</name>
+							<value>${osgi.test.platform}</value>
+						</property>
+						<property>
+							<name>org.springframework.osgi.integration.testing.clover</name>
+							<value>${clover.enabled}</value>
+						</property>
+                    </systemProperties>
+                    <argLine>${clover.argLine} ${security.argLine}</argLine>
+                    <!--argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=2111,server=y,suspend=y</argLine-->
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/BaseIntegrationTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/BaseIntegrationTest.java
new file mode 100644
index 0000000..fee4f10
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/BaseIntegrationTest.java
@@ -0,0 +1,290 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt;

+

+import java.io.File;

+import java.io.FilePermission;

+import java.lang.reflect.ReflectPermission;

+import java.security.AllPermission;

+import java.security.Permission;

+import java.util.ArrayList;

+import java.util.Iterator;

+import java.util.List;

+import java.util.PropertyPermission;

+import java.util.jar.Manifest;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.BundleEvent;

+import org.osgi.framework.BundlePermission;

+import org.osgi.framework.Constants;

+import org.osgi.framework.PackagePermission;

+import org.osgi.framework.ServicePermission;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.SynchronousBundleListener;

+import org.osgi.service.permissionadmin.PermissionAdmin;

+import org.osgi.service.permissionadmin.PermissionInfo;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.test.AbstractConfigurableBundleCreatorTests;

+import org.eclipse.gemini.blueprint.test.platform.OsgiPlatform;

+import org.eclipse.gemini.blueprint.test.provisioning.ArtifactLocator;

+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

+import org.springframework.util.CollectionUtils;

+import org.springframework.util.ObjectUtils;

+import org.springframework.util.StringUtils;

+

+/**

+ * Base test class used for improving performance of integration tests by

+ * creating bundles only with the classes within a package as opposed to all

+ * resources available in the target folder.

+ * 

+ * <p/>

+ * Additionally, the class checks for the presence Clover if a certain property

+ * is set and uses a special setup to use the instrumented jars instead of the

+ * naked ones.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public abstract class BaseIntegrationTest extends AbstractConfigurableBundleCreatorTests {

+

+	private class CloverClassifiedArtifactLocator implements ArtifactLocator {

+

+		private final ArtifactLocator delegate;

+

+

+		public CloverClassifiedArtifactLocator(ArtifactLocator delegate) {

+			this.delegate = delegate;

+		}

+

+		public Resource locateArtifact(String group, String id, String version, String type) {

+			return parse(id + "-" + version, delegate.locateArtifact(group, id, version, type));

+		}

+

+		public Resource locateArtifact(String group, String id, String version) {

+			return parse(id + "-" + version, delegate.locateArtifact(group, id, version));

+		}

+

+		private Resource parse(String id, Resource resource) {

+			if (id.indexOf(SPRING_DM_PREFIX) > -1) {

+				try {

+					String relativePath = "";

+					// check if it's a relative file

+					if (StringUtils.cleanPath(resource.getURI().toString()).indexOf("/target/") > -1) {

+						relativePath = "clover" + File.separator;

+					}

+					relativePath = relativePath + id + "-clover.jar";

+

+					Resource res = resource.createRelative(relativePath);

+					BaseIntegrationTest.this.logger.info("Using clover instrumented jar " + res.getDescription());

+					return res;

+				}

+				catch (Exception ex) {

+					throw (RuntimeException) new IllegalStateException(

+						"Trying to find Clover instrumented class but none is available; disable clover or build the instrumented artifacts").initCause(ex);

+				}

+			}

+			return resource;

+		}

+	}

+

+	private class PermissionManager implements SynchronousBundleListener {

+

+		private final PermissionAdmin pa;

+

+

+		/**

+		 * Constructs a new <code>PermissionManager</code> instance.

+		 * 

+		 * @param bc

+		 */

+		private PermissionManager(BundleContext bc) {

+			ServiceReference ref = bc.getServiceReference(PermissionAdmin.class.getName());

+			if (ref != null) {

+				logger.trace("Found permission admin " + ref);

+				pa = (PermissionAdmin) bc.getService(ref);

+				bc.addBundleListener(this);

+				logger.trace("Default permissions are " + ObjectUtils.nullSafeToString(pa.getDefaultPermissions()));

+				logger.warn("Security turned ON");

+

+			}

+			else {

+				logger.warn("Security turned OFF");

+				pa = null;

+			}

+		}

+

+		public void bundleChanged(BundleEvent event) {

+			if (event.getType() == BundleEvent.INSTALLED) {

+				Bundle bnd = event.getBundle();

+				String location = bnd.getLocation();

+				// iandt bundles

+				if (location.indexOf("iandt") > -1 || location.indexOf("integration-tests") > -1) {

+					logger.trace("Discovered I&T test...");

+					List perms = getIAndTPermissions();

+					// define permission info

+					PermissionInfo[] pi = getPIFromPermissions(perms);

+					logger.info("About to set permissions " + perms + " for I&T bundle "

+							+ OsgiStringUtils.nullSafeNameAndSymName(bnd) + "@" + location);

+					pa.setPermissions(location, pi);

+				}

+				// on the fly test

+				else if (location.indexOf("onTheFly") > -1) {

+					logger.trace("Discovered on the fly test...");

+					List<Permission> perms = getTestPermissions();

+

+					// define permission info

+					PermissionInfo[] pi = getPIFromPermissions(perms);

+					logger.info("About to set permissions " + perms + " for OnTheFly bundle "

+							+ OsgiStringUtils.nullSafeNameAndSymName(bnd) + "@" + location);

+					pa.setPermissions(location, pi);

+				}

+				// logging bundle

+				else if (bnd.getSymbolicName().indexOf("log4j.osgi") > -1) {

+					logger.trace("Setting permissions on log4j bundle " + OsgiStringUtils.nullSafeNameAndSymName(bnd));

+					List<Permission> perms = new ArrayList<Permission>();

+					// defaults

+					perms.add(new AllPermission());

+					PermissionInfo[] defaultPerm = pa.getDefaultPermissions();

+					if (defaultPerm != null)

+						CollectionUtils.mergeArrayIntoCollection(defaultPerm, perms);

+					pa.setPermissions(location, getPIFromPermissions(perms));

+				}

+			}

+		}

+

+		private PermissionInfo[] getPIFromPermissions(List perms) {

+			PermissionInfo[] pi = new PermissionInfo[perms.size()];

+			int index = 0;

+			for (Iterator iterator = perms.iterator(); iterator.hasNext();) {

+				Permission perm = (Permission) iterator.next();

+				pi[index++] = new PermissionInfo(perm.getClass().getName(), perm.getName(), perm.getActions());

+			}

+			return pi;

+		}

+	}

+

+

+	private static final String CLOVER_PROPERTY = "org.eclipse.gemini.blueprint.integration.testing.clover";

+

+	private static final String CLOVER_PKG = "com_cenqua_clover";

+

+	private static final String SPRING_DM_PREFIX = "spring-osgi";

+

+

+	protected String[] getBundleContentPattern() {

+		String pkg = getClass().getPackage().getName().replace('.', '/').concat("/");

+		String[] patterns = new String[] { BaseIntegrationTest.class.getName().replace('.', '/').concat("*.class"),

+			pkg + "**/*" };

+		return patterns;

+	}

+

+	protected void preProcessBundleContext(BundleContext context) throws Exception {

+		super.preProcessBundleContext(context);

+

+		if (isCloverEnabled()) {

+			logger.warn("Test coverage instrumentation (Clover) enabled");

+		}

+	}

+

+	private boolean isCloverEnabled() {

+		return Boolean.getBoolean(CLOVER_PROPERTY);

+	}

+

+	protected ArtifactLocator getLocator() {

+		ArtifactLocator defaultLocator = super.getLocator();

+		// redirect to the clover artifacts

+		if (isCloverEnabled()) {

+			return new CloverClassifiedArtifactLocator(defaultLocator);

+		}

+		return defaultLocator;

+	}

+

+	protected List getBootDelegationPackages() {

+		List bootPkgs = super.getBootDelegationPackages();

+		if (isCloverEnabled()) {

+			bootPkgs.add(CLOVER_PKG);

+		}

+		return bootPkgs;

+	}

+

+	protected Manifest getManifest() {

+		String permissionPackage = "org.osgi.service.permissionadmin";

+		Manifest mf = super.getManifest();

+		// make permission admin packages optional

+		String impPackage = mf.getMainAttributes().getValue(Constants.IMPORT_PACKAGE);

+		int startIndex = impPackage.indexOf(permissionPackage);

+		String newImpPackage = impPackage;

+		if (startIndex >= 0) {

+			newImpPackage = impPackage.substring(0, startIndex) + permissionPackage + ";resolution:=optional"

+					+ impPackage.substring(startIndex + permissionPackage.length());

+		}

+		mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, newImpPackage);

+		return mf;

+	}

+

+	/**

+	 * Returns the list of permissions for the running test.

+	 * 

+	 * @return

+	 */

+	protected List<Permission> getTestPermissions() {

+		List<Permission> perms = new ArrayList<Permission>();

+		perms.add(new PackagePermission("*", PackagePermission.EXPORT));

+		perms.add(new PackagePermission("*", PackagePermission.IMPORT));

+		perms.add(new BundlePermission("*", BundlePermission.HOST));

+		perms.add(new BundlePermission("*", BundlePermission.PROVIDE));

+		perms.add(new BundlePermission("*", BundlePermission.REQUIRE));

+		perms.add(new ServicePermission("*", ServicePermission.REGISTER));

+		perms.add(new ServicePermission("*", ServicePermission.GET));

+		perms.add(new PropertyPermission("*", "read,write"));

+		// required by Spring

+		perms.add(new RuntimePermission("*", "accessDeclaredMembers"));

+		perms.add(new ReflectPermission("*", "suppressAccessChecks"));

+		// logging permission

+		perms.add(new FilePermission("-", "write"));

+		perms.add(new FilePermission("-", "read"));

+		return perms;

+	}

+

+	protected List<Permission> getIAndTPermissions() {

+		List<Permission> perms = new ArrayList<Permission>();

+		// export package

+		perms.add(new PackagePermission("*", PackagePermission.EXPORT));

+		perms.add(new PackagePermission("*", PackagePermission.IMPORT));

+		perms.add(new BundlePermission("*", BundlePermission.FRAGMENT));

+		perms.add(new BundlePermission("*", BundlePermission.PROVIDE));

+		perms.add(new ServicePermission("*", ServicePermission.REGISTER));

+		perms.add(new ServicePermission("*", ServicePermission.GET));

+		perms.add(new PropertyPermission("*", "read,write"));

+

+		// required by Spring

+		perms.add(new RuntimePermission("*", "accessDeclaredMembers"));

+		perms.add(new ReflectPermission("*", "suppressAccessChecks"));

+

+		// logging permission

+		perms.add(new FilePermission("-", "write"));

+		perms.add(new FilePermission("-", "read"));

+

+		return perms;

+	}

+

+	@Override

+	protected OsgiPlatform createPlatform() {

+		OsgiPlatform platform = super.createPlatform();

+		platform.getConfigurationProperties().setProperty("felix.fragment.validation", "warning");

+		return platform;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.java
new file mode 100644
index 0000000..41e997e
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.java
@@ -0,0 +1,189 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.bundleScope;

+

+import java.security.AllPermission;

+import java.util.List;

+import java.util.Properties;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.ServiceReference;

+import org.springframework.context.ConfigurableApplicationContext;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+import org.eclipse.gemini.blueprint.iandt.scope.common.ScopeTestService;

+import org.eclipse.gemini.blueprint.util.OsgiFilterUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Integration tests for 'bundle' scoped beans.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ScopingTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "net.sourceforge.cglib, com.springsource.net.sf.cglib, 2.1.3",

+			"org.eclipse.gemini.blueprint.iandt, scoped.bundle.common," + getSpringDMVersion(),

+			"org.eclipse.gemini.blueprint.iandt, scoped.bundle.a," + getSpringDMVersion(),

+			"org.eclipse.gemini.blueprint.iandt, scoped.bundle.b," + getSpringDMVersion() };

+	}

+

+	protected String getManifestLocation() {

+		return "org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.MF";

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/bundleScope/scope-context.xml" };

+	}

+

+	public void testEnvironmentValidity() throws Exception {

+		assertNotNull(getServiceA());

+		assertNotNull(getServiceB());

+	}

+

+	public void testServiceAScopeForCurrentBundle() throws Exception {

+		ScopeTestService serviceAcopy1 = getServiceA();

+		ScopeTestService serviceAcopy2 = getServiceA();

+

+		assertEquals("different bean instances given for the same bundle", serviceAcopy1, serviceAcopy2);

+	}

+

+	public void testServiceAScopeForBundleA() throws Exception {

+		ScopeTestService serviceAInBundleA = (ScopeTestService) org.eclipse.gemini.blueprint.iandt.scope.a.BeanReference.BEAN;

+

+		System.out.println(serviceAInBundleA.getServiceIdentity());

+		System.out.println(getServiceA().getServiceIdentity());

+

+		assertFalse("same bean instance used for different bundles", serviceAInBundleA.getServiceIdentity().equals(

+			getServiceA().getServiceIdentity()));

+	}

+

+	public void testServiceAScopeForBundleB() throws Exception {

+		String symName = "org.eclipse.gemini.blueprint.iandt.scope.b";

+		ScopeTestService serviceAInBundleB = (ScopeTestService) getAppCtx(symName).getBean("serviceFromA");

+

+		assertFalse("same bean instance used for different bundles", serviceAInBundleB.getServiceIdentity().equals(

+			getServiceA().getServiceIdentity()));

+	}

+

+	public void testServiceBInBundleBAndTestBundle() throws Exception {

+		ScopeTestService serviceAInBundleB = (ScopeTestService) org.eclipse.gemini.blueprint.iandt.scope.b.BeanReference.BEAN;

+

+		assertFalse("same bean instance used for different bundles", serviceAInBundleB.getServiceIdentity().equals(

+			getServiceB().getServiceIdentity()));

+	}

+

+	public void testScopedBeanNotExported() throws Exception {

+		Properties props = (Properties) applicationContext.getBean("props");

+		// ask for it again

+		Properties another = (Properties) applicationContext.getBean("props");

+		assertSame("different instances returned for the same scope", props, another);

+	}

+

+	public void testBeanReferenceAndLocalScopeInstanceForBundleA() throws Exception {

+		String symName = "org.eclipse.gemini.blueprint.iandt.scope.a";

+		assertSame("local references are different", getAppCtx(symName).getBean("a.service"),

+			org.eclipse.gemini.blueprint.iandt.scope.a.BeanReference.BEAN);

+	}

+

+	public void testBeanReferenceAndLocalScopeInstanceForBundleB() throws Exception {

+		String symName = "org.eclipse.gemini.blueprint.iandt.scope.b";

+		assertSame("local references are different", getAppCtx(symName).getBean("b.service"),

+			org.eclipse.gemini.blueprint.iandt.scope.b.BeanReference.BEAN);

+	}

+

+	public void testScopedBeanDestructionCallbackDuringContextRefresh() throws Exception {

+		Properties props = (Properties) applicationContext.getBean("props");

+		// add some content

+		props.put("foo", "bar");

+

+		// check by asking again for the bean

+		Properties another = (Properties) applicationContext.getBean("props");

+		assertSame(props, another);

+		assertTrue(another.containsKey("foo"));

+

+		// refresh context

+		applicationContext.refresh();

+		Properties refreshed = (Properties) applicationContext.getBean("props");

+		assertNotSame("context refresh does not clean scoped objects", props, refreshed);

+		assertTrue(refreshed.isEmpty());

+		// check that props object has been cleaned also

+		assertTrue("destroy callback wasn't called/applied", props.isEmpty());

+	}

+

+	public void testExportedScopedBeansDestructionCallbackCalled() throws Exception {

+		Object rawServiceA = getServiceA();

+		assertTrue(rawServiceA instanceof Properties);

+		Properties props = (Properties) rawServiceA;

+		// modify properties

+		props.put("service", "a");

+

+		// check service again

+		assertTrue(((Properties) getServiceA()).containsKey("service"));

+

+		// refresh opposite service

+		getAppCtx("org.eclipse.gemini.blueprint.iandt.scope.a").refresh();

+

+		// wait for the context to refresh

+		Thread.sleep(1000);

+		// get service a again

+		assertTrue("scoped bean a did not have its callback called", ((Properties) getServiceA()).isEmpty());

+	}

+

+	protected ScopeTestService getServiceA() throws Exception {

+		return getService("a");

+	}

+

+	protected ScopeTestService getServiceB() throws Exception {

+		return getService("b");

+	}

+

+	protected ScopeTestService getService(String bundleName) {

+		ServiceReference ref = OsgiServiceReferenceUtils.getServiceReference(bundleContext,

+			ScopeTestService.class.getName(), "(Bundle-SymbolicName=org.eclipse.gemini.blueprint.iandt.scope." + bundleName

+					+ ")");

+		if (ref == null) {

+			String filter = OsgiFilterUtils.unifyFilter(ScopeTestService.class, null);

+			System.out.println(ObjectUtils.nullSafeToString(OsgiServiceReferenceUtils.getServiceReferences(

+				bundleContext, filter)));

+			throw new IllegalStateException("cannot find service with owning bundle " + bundleName);

+		}

+		return (ScopeTestService) bundleContext.getService(ref);

+	}

+

+	private ConfigurableApplicationContext getAppCtx(String symBundle) {

+		ServiceReference ref = OsgiServiceReferenceUtils.getServiceReference(bundleContext, "("

+				+ ConfigurableOsgiBundleApplicationContext.APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME + "=" + symBundle

+				+ ")");

+

+		if (ref == null)

+			throw new IllegalArgumentException("cannot find appCtx for bundle " + symBundle);

+		return (ConfigurableApplicationContext) bundleContext.getService(ref);

+	}

+

+	/**

+	 * Since the test is creating some application contexts, give it some

+	 * privileges.

+	 */

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		perms.add(new AdminPermission("(name=org.eclipse.gemini.blueprint.iandt.scope.a)", "*"));

+		perms.add(new AllPermission());

+		return perms;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.java
new file mode 100644
index 0000000..7b9f0fc
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.java
@@ -0,0 +1,102 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cardinality0to1;
+
+import java.io.FilePermission;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundlePermission;
+import org.osgi.framework.PackagePermission;
+import org.osgi.framework.ServicePermission;
+import org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.MyListener;
+import org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.ReferenceContainer;
+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;
+
+/**
+ * @author Hal Hildebrand Date: Dec 6, 2006 Time: 6:04:42 PM
+ */
+public class Cardinality0to1Test extends BaseIntegrationTest {
+
+	protected String[] getTestBundlesNames() {
+		return new String[] { "org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion(),
+			"org.eclipse.gemini.blueprint.iandt, cardinality0to1," + getSpringDMVersion() };
+	}
+
+	public void test0to1Cardinality() throws Exception {
+		Bundle simpleService2Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion()).getURL().toExternalForm());
+
+		assertNotNull("Cannot find the simple service 2 bundle", simpleService2Bundle);
+
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService2Bundle.getState()));
+
+		assertEquals("Unxpected initial binding of service", 0, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected initial unbinding of service", 1, MyListener.UNBOUND_COUNT);
+		assertNotNull("Service reference should be not null", ReferenceContainer.service);
+
+		try {
+			ReferenceContainer.service.stringValue();
+			fail("Service should be unavailable");
+		}
+		catch (ServiceUnavailableException e) {
+			// expected
+		}
+
+		startDependency(simpleService2Bundle);
+
+		assertEquals("Expected initial binding of service", 1, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected initial unbinding of service", 1, MyListener.UNBOUND_COUNT);
+		assertNotNull("Service reference should be not null", ReferenceContainer.service);
+
+		assertNotNull(ReferenceContainer.service.stringValue());
+
+	}
+
+	private void startDependency(Bundle simpleService2Bundle) throws BundleException, InterruptedException {
+		System.out.println("Starting dependency");
+		simpleService2Bundle.start();
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice2");
+
+		System.out.println("Dependency started");
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		// export package
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		perms.add(new FilePermission("<<ALL FILES>>", "read"));
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/clogging/CommonsLogging104Test.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/clogging/CommonsLogging104Test.java
new file mode 100644
index 0000000..abb4e83
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/clogging/CommonsLogging104Test.java
@@ -0,0 +1,75 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.clogging;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.Iterator;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.BundleContext;

+import org.springframework.util.CollectionUtils;

+

+/**

+ * Integration test for commons logging 1.0.4 and its broken logging discovery.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public abstract class CommonsLogging104Test extends BaseIntegrationTest {

+

+	/** logger */

+	private static final Log log = LogFactory.getLog(CommonsLogging104Test.class);

+

+

+	protected String[] getTestFrameworkBundlesNames() {

+		String[] bundles = super.getTestFrameworkBundlesNames();

+

+		// remove slf4j

+		Collection bnds = new ArrayList(bundles.length);

+		CollectionUtils.mergeArrayIntoCollection(bundles, bnds);

+

+		for (Iterator iterator = bnds.iterator(); iterator.hasNext();) {

+			String object = (String) iterator.next();

+			// remove slf4j

+			if (object.startsWith("org.slf4j"))

+				iterator.remove();

+		}

+		// add commons logging

+		bnds.add("org.eclipse.bundles,commons-logging,20070611");

+

+		return (String[]) bnds.toArray(new String[bnds.size()]);

+	}

+

+	public void testSimpleLoggingStatement() throws Exception {

+		log.info("logging statement");

+	}

+

+	protected void preProcessBundleContext(BundleContext platformBundleContext) throws Exception {

+

+		// all below fail

+		LogFactory.releaseAll();

+		//System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.NoOpLog");

+		System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");

+

+		ClassLoader cl = Thread.currentThread().getContextClassLoader();

+		//		System.out.println("TCCL is " + cl);

+		Thread.currentThread().setContextClassLoader(null);

+		super.preProcessBundleContext(platformBundleContext);

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/BundleClassPathTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/BundleClassPathTest.java
new file mode 100644
index 0000000..482b326
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/BundleClassPathTest.java
@@ -0,0 +1,184 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.compliance.io;

+

+import java.io.InputStream;

+import java.lang.reflect.ReflectPermission;

+import java.net.URL;

+import java.net.URLConnection;

+import java.util.ArrayList;

+import java.util.Enumeration;

+import java.util.List;

+import java.util.PropertyPermission;

+import java.util.jar.JarInputStream;

+import java.util.jar.Manifest;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundlePermission;

+import org.osgi.framework.Constants;

+import org.osgi.framework.PackagePermission;

+import org.osgi.framework.ServicePermission;

+import org.eclipse.gemini.blueprint.test.platform.OsgiPlatform;

+import org.eclipse.gemini.blueprint.test.platform.Platforms;

+

+/**

+ * IO compliance test for bundles containing Bundle ClassPath entries.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BundleClassPathTest extends BaseIntegrationTest {

+

+	protected Manifest getManifest() {

+		Manifest mf = super.getManifest();

+		// add bundle classpath

+		mf.getMainAttributes().putValue(Constants.BUNDLE_CLASSPATH,

+				".,bundleclasspath/folder,bundleclasspath/simple.jar");

+		return mf;

+	}

+

+	protected String[] getBundleContentPattern() {

+		String pkg = getClass().getPackage().getName().replace('.', '/').concat("/");

+		String[] patterns =

+				new String[] { BaseIntegrationTest.class.getName().replace('.', '/').concat(".class"), pkg + "**/*",

+						"bundleclasspath/**/*" };

+		return patterns;

+	}

+

+	private Bundle bundle;

+	private String classLocation;

+

+	protected void onSetUp() throws Exception {

+		bundle = bundleContext.getBundle();

+		classLocation = BundleClassPathTest.class.getName().replace('.', '/') + ".class";

+	}

+

+	public void testGetResourceOnClassInsideBundle() throws Exception {

+		assertNotNull(bundle.getResource(classLocation));

+	}

+

+	public void testGetResourceOnFileJustInsideBundle() throws Exception {

+		assertNotNull(bundle.getResource("org/eclipse/gemini/blueprint/iandt/compliance/io/package.file"));

+		assertNotNull(bundle.getResource("org/eclipse/gemini/blueprint/iandt/compliance/io/test.file"));

+	}

+

+	public void testGetResourceOnFileOnBundleClassPathAndBundleJar() throws Exception {

+		assertNotNull(bundle.getResource("org/eclipse/gemini/blueprint/iandt/compliance/io/test.file"));

+	}

+

+	public void testGetResourceOnFileJustInsideFolderOnClassPath() throws Exception {

+		assertNotNull(bundle.getResource("org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file"));

+	}

+

+	public void testGetResourceOnFileJustInsideJarOnClassPath() throws Exception {

+		assertNotNull(bundle.getResource("jar.file"));

+	}

+

+	public void testGetResourcesOnFilePresentMultipleTimesOnTheClassPathAndInsideTheBundle() throws Exception {

+		System.out.println("running test " + this.getName());

+		Enumeration enm = bundle.getResources("org/eclipse/gemini/blueprint/iandt/compliance/io/test.file");

+		int count = 0;

+		while (enm.hasMoreElements()) {

+			Object object = (Object) enm.nextElement();

+			System.out.println("found res " + object);

+			count++;

+		}

+		assertEquals("not all resources are found", 3, count);

+	}

+

+	public void testFindEntriesOnFileJustInsideFolderOnClassPath() throws Exception {

+		System.out.println("running test" + this.getName());

+		Enumeration enm =

+				bundle.findEntries("org/eclipse/gemini/blueprint/iandt/compliance/io/", "folder-test.file", false);

+		assertNull("findEntries doesn't work on bundle classpath entries", enm);

+	}

+

+	public void testFindEntriesOnFileJustInsideJarOnClassPath() throws Exception {

+		System.out.println("running test" + this.getName());

+		Enumeration enm = bundle.findEntries("/", "jar.file", false);

+		assertNull("findEntries doesn't work on bundle classpath entries", enm);

+	}

+

+	// disabled as it fails on the server for some reason (linux + equinox)

+	// TODO: investigate

+	public void tstFindEntriesOnFilePresentMultipleTimesOnTheClassPathAndInsideTheBundle() throws Exception {

+		System.out.println("running test" + this.getName());

+		Enumeration enm = bundle.findEntries("org/eclipse/gemini/blueprint/iandt/compliance/io/", "test.file", false);

+		int count = 0;

+		while (enm.hasMoreElements()) {

+			count++;

+		}

+		assertEquals("bundle only resources are found", 1, count);

+	}

+

+	public void testGetEntryOnFileJustInsideFolderOnClassPath() throws Exception {

+		System.out.println("running test" + this.getName());

+		URL url = bundle.getEntry("org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file");

+		assertNull("findEntries doesn't work on bundle classpath entries", url);

+	}

+

+	public void testGetEntryOnFileJustInsideJarOnClassPath() throws Exception {

+		System.out.println("running test" + this.getName());

+		URL url = bundle.getEntry("jar.file");

+		assertNull("findEntries doesn't work on bundle classpath entries", url);

+	}

+

+	// fails on Felix + KF

+	public void tstFindEntriesOnMetaInfEntryOnSystemBundle() throws Exception {

+		Bundle sysBundle = bundleContext.getBundle(0);

+		Enumeration enm = sysBundle.findEntries("/", "META-INF", false);

+		assertNotNull("system bundle doesn't return META-INF", enm);

+	}

+

+	// fails on Felix + KF

+	public void tstGetEntryOnMetaInfEntryOnSystemBundle() throws Exception {

+		Bundle sysBundle = bundleContext.getBundle(0);

+		URL url = sysBundle.getEntry("/META-INF");

+		assertNotNull("system bundle doesn't consider META-INF on classpath", url);

+	}

+

+	// simple debugging test (no need to keep it running)

+	public void tstConnectionToJarOnClassPath() throws Exception {

+		URL url = bundle.getEntry("bundleclasspath/simple.jar");

+		System.out.println("jar url is " + url);

+		URLConnection con = url.openConnection();

+		System.out.println(con);

+		System.out.println(con.getContentType());

+		InputStream stream = con.getInputStream();

+		JarInputStream jis = new JarInputStream(stream);

+		System.out.println(jis);

+		System.out.println(jis.available());

+		System.out.println(jis.getNextJarEntry());

+		System.out.println(jis.getNextJarEntry());

+		System.out.println(jis.getNextJarEntry());

+		System.out.println(jis.available());

+		System.out.println(jis.getNextJarEntry());

+		System.out.println(jis.available());

+		jis.close();

+	}

+

+	// @Override

+	// protected OsgiPlatform createPlatform() {

+	// OsgiPlatform platform = super.createPlatform();

+	// platform.getConfigurationProperties().setProperty("org.knopflerfish.framework.debug.framework", "true");

+	// platform.getConfigurationProperties().setProperty("org.knopflerfish.framework.debug.errors", "true");

+	// platform.getConfigurationProperties().setProperty("org.knopflerfish.framework.debug.classloader", "true");

+	// platform.getConfigurationProperties().setProperty("org.knopflerfish.framework.debug.packages", "true");

+	//		

+	// return platform;

+	// }

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/CallingResourceOnDifferentBundlesTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/CallingResourceOnDifferentBundlesTest.java
new file mode 100644
index 0000000..46ffd31
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/CallingResourceOnDifferentBundlesTest.java
@@ -0,0 +1,135 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.compliance.io;

+

+import java.io.IOException;

+import java.net.URL;

+import java.util.Enumeration;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleEvent;

+import org.osgi.framework.SynchronousBundleListener;

+import org.eclipse.gemini.blueprint.test.platform.Platforms;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * 

+ * http://sourceforge.net/tracker/index.php?func=detail&aid=1581187&group_id=82798&atid=567241 ClassCastException from

+ * Bundle.getResource when called on Bundle passed to the caller

+ * 

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class CallingResourceOnDifferentBundlesTest extends BaseIntegrationTest {

+

+	private static final String LOCATION = "META-INF/";

+

+	public void testCallGetResourceOnADifferentBundle() throws Exception {

+		// find bundles

+		Bundle[] bundles = bundleContext.getBundles();

+		for (int i = 1; i < bundles.length; i++) {

+			Bundle bundle = bundles[i];

+			logger.debug("calling #getResource on bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle));

+			URL url = bundle.getResource(LOCATION);

+			if (!OsgiBundleUtils.isFragment(bundle))

+				assertNotNull("bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle) + " contains no META-INF/",

+						url);

+		}

+	}

+

+	public void testCallGetResourcesOnADifferentBundle() throws Exception {

+		// find bundles

+		Bundle[] bundles = bundleContext.getBundles();

+		for (int i = 1; i < bundles.length; i++) {

+			Bundle bundle = bundles[i];

+			logger.debug("calling #getResources on bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle));

+			Enumeration enm = bundle.getResources(LOCATION);

+			if (!OsgiBundleUtils.isFragment(bundle))

+				assertNotNull("bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle) + " contains no META-INF/",

+						enm);

+		}

+	}

+

+	public void testCallGetResourceOnADifferentBundleRetrievedThroughBundleEvent() throws Exception {

+		String EXTRA_BUNDLE = "org.springframework.core";

+

+		Bundle[] bundles = bundleContext.getBundles();

+		Bundle bundle = null;

+		// find cglib library as we don't use it

+		for (int i = 1; bundle == null && i < bundles.length; i++) {

+			String location = bundles[i].getLocation();

+			if (location != null && location.indexOf(EXTRA_BUNDLE) > -1)

+				bundle = bundles[i];

+		}

+

+		assertNotNull("no bundle found", bundle);

+		final Bundle sampleBundle = bundle;

+

+		final boolean[] listenerCalled = new boolean[] { false };

+

+		// register listener

+		bundleContext.addBundleListener(new SynchronousBundleListener() {

+

+			public void bundleChanged(BundleEvent event) {

+				// call getResource

+				event.getBundle().getResource(LOCATION);

+				// call getResources

+				try {

+					event.getBundle().getResources(LOCATION);

+				} catch (IOException e) {

+					throw new RuntimeException(e);

+				}

+

+				listenerCalled[0] = true;

+			}

+		});

+

+		// update

+		sampleBundle.stop();

+

+		assertTrue("bundle listener hasn't been called", listenerCalled[0]);

+	}

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return ("testCallGetResourceOnADifferentBundle".equals(testMethodName) || "testCallGetResourcesOnADifferentBundle"

+				.equals(testMethodName))

+				&& (isFelix() || isKF());

+	}

+

+	private boolean isFelix() {

+		String platformName = getPlatformName();

+		System.out.println("Platform name is " + platformName);

+		return (platformName.indexOf("Felix") > -1);

+	}

+

+	private boolean isKF() {

+		return (getPlatformName().indexOf("Knopflerfish") > -1);

+	}

+

+	protected List getTestPermissions() {

+		List list = super.getTestPermissions();

+		list.add(new AdminPermission("*", AdminPermission.METADATA));

+		list.add(new AdminPermission("*", AdminPermission.LISTENER));

+		list.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		list.add(new AdminPermission("*", AdminPermission.RESOURCE));

+		return list;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/FragmentTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/FragmentTest.java
new file mode 100644
index 0000000..f3b8ed8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/FragmentTest.java
@@ -0,0 +1,163 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.compliance.io;

+

+import java.net.URL;

+

+import org.eclipse.gemini.blueprint.iandt.io.BaseIoTest;

+import org.osgi.framework.Bundle;

+

+/**

+ * Raw test for discovering the fragments support for each platform. The native

+ * {@link Bundle#findEntries(String, String, boolean)} method is being used to

+ * see if files from the attached fragments are attached.

+ * 

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class FragmentTest extends BaseIoTest {

+

+	//

+	// Folder tests

+	//

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return isFelix();

+	}

+

+	protected String[] getBundleContentPattern() {

+		return new String[] { "**/*" };

+	}

+

+	/**

+	 * Check META-INF folders.

+	 * 

+	 */

+	public void testRootFoldersInFragmentsAndOwner() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "META-INF", false));

+		assertResourceArray(res, 3);

+	}

+

+	public void testRootFolderCommonInFragmentsAlone() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment.folder", false));

+		assertResourceArray(res, 2);

+	}

+

+	public void testRootFolderOnlyInFragment1() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment1.folder", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testNestedFolderOnlyInFragmentsRecursively() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "nested.folder", true));

+		assertResourceArray(res, 2);

+	}

+

+	public void testNestedFolderOnlyInFragments() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment.folder", "nested.folder", false));

+		assertResourceArray(res, 2);

+	}

+

+	public void testRootFolderOnlyInFragment2() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment2.folder", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testNestedFolderOnlyInFragment1() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment1.folder", "nested.folder.1", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testNestedFolderOnlyInFragment2() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment2.folder", "nested.folder.2", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testCommonFolderOnlyInFragmentsButNotInHost() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment.folder", "nested.folder", false));

+		assertResourceArray(res, 2);

+	}

+

+	public void testCommonFolderInFragmentsAndHost() {

+		Object[] res = copyEnumeration(bundle.findEntries("/org/eclipse", "gemini", false));

+		assertResourceArray(res, 3);

+	}

+

+	public void testFolderOnlyInHost() {

+		Object[] res = copyEnumeration(bundle.findEntries("/org/eclipse/gemini/blueprint/iandt", "bundleScope", false));

+		assertResourceArray(res, 1);

+	}

+

+	//

+	// File tests

+	//

+

+	public void testRootFileInBothFragmentsButNotInHost() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment.file", false));

+		assertResourceArray(res, 2);

+	}

+

+	public void testRootFileOnlyInFragment1() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment1.file", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testRootFileOnlyInFragment2() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "fragment2.file", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testRootFileOnlyInHostBundle() {

+		Object[] res = copyEnumeration(bundle.findEntries("/", "log4j.properties", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testNestedFileOnlyInFragments() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment.folder/nested.folder", "nested.file", false));

+		assertResourceArray(res, 2);

+	}

+

+	public void testNestedFileOnlyInFragment1() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment1.folder/nested.folder.1", "nested.file.1.1", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testNestedFileOnlyInFragment2() {

+		Object[] res = copyEnumeration(bundle.findEntries("/fragment2.folder/nested.folder.2", "nested.file.2.2", false));

+		assertResourceArray(res, 1);

+	}

+

+	public void testDuplicateFilesInHostAndFragments() {

+		Object[] res = copyEnumeration(bundle.findEntries("/org/eclipse/gemini/blueprint/iandt/io", "duplicate.file", false));

+		assertResourceArray(res, 3);

+	}

+

+	//

+	// Classpath tests

+	//

+

+	public void testGetResourceOnRootDir() throws Exception {

+		URL root = bundle.getResource("/");

+		System.out.println(root);

+		assertNotNull("root path not considered", root);

+	}

+

+	public void testGetResourceSOnRootDir() throws Exception {

+		Object[] res = copyEnumeration(bundle.getResources("/"));

+		// 3 paths should be found (1 host + 2 fragments)

+		assertResourceArray(res, 3);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/IoTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/IoTest.java
new file mode 100644
index 0000000..9bea3c0
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/io/IoTest.java
@@ -0,0 +1,110 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.compliance.io;

+

+import java.net.URL;

+import java.util.Enumeration;

+

+import org.eclipse.gemini.blueprint.iandt.io.BaseIoTest;

+import org.eclipse.gemini.blueprint.test.platform.Platforms;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Low level access API used for discovering the underlying platform capabilities since there are subtle yet major

+ * differences between each implementation.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class IoTest extends BaseIoTest {

+

+	protected String[] getBundleContentPattern() {

+		return super.getBundleContentPattern();

+	}

+

+	// don't use any extra bundles - just the test jar

+	protected String[] getTestBundlesNames() {

+		return null;

+	}

+

+	// using /META-INF fails on KF 3.0.0.x

+	public void testGetResourceOnMetaInf() throws Exception {

+		URL url = bundle.getResource("/META-INF/");

+		System.out.println(url);

+		assertNotNull(url);

+	}

+

+	// fails on Felix 1.0.1 (fixed in 1.0.3 and KF 2.0.3)

+	public void testGetResourceOnRoot() throws Exception {

+		URL url = bundle.getResource("/");

+		System.out.println("getResource('/') = " + url);

+		assertNotNull("root folder not validated " + url);

+	}

+

+	// fails on Felix 1.0.1 (fixed in 1.0.3 and KF 2.0.3)

+	public void testGetResourceSOnRoot() throws Exception {

+		Enumeration enm = bundle.getResources("/");

+		Object[] res = copyEnumeration(enm);

+		System.out.println("getResources('/') = " + ObjectUtils.nullSafeToString(res));

+		assertEquals("root folder not validated" + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testFindEntriesOnFolders() throws Exception {

+		Enumeration enm = bundle.findEntries("/", null, false);

+		// should get 3 entries - META-INF/, org/ and log4j.properties

+

+		Object[] res = copyEnumeration(enm);

+		assertEquals("folders ignored; found " + ObjectUtils.nullSafeToString(res), 2, res.length);

+	}

+

+	public void testFindEntriesOnSubFolders() throws Exception {

+		Enumeration enm = bundle.findEntries("/META-INF", null, false);

+		Object[] res = copyEnumeration(enm);

+		// should get 1 entry - META-INF/

+		assertEquals("folders ignored; found " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	// Valid jars do not have entries for root folder / - in fact it doesn't

+	// even exist

+	public void testGetEntryOnRoot() throws Exception {

+		URL url = bundle.getEntry("/");

+		assertNotNull(url);

+	}

+

+	// get folders

+	public void testGetEntriesShouldReturnFoldersOnRoot() throws Exception {

+		Enumeration enm = bundle.getEntryPaths("/");

+		Object[] res = copyEnumeration(enm);

+		assertEquals("folders ignored; found " + ObjectUtils.nullSafeToString(res), 2, res.length);

+	}

+

+	public void testGetFolderEntry() throws Exception {

+		URL url = bundle.getEntry("META-INF/");

+		assertNotNull(url);

+	}

+

+	public void testGetFolderEntries() throws Exception {

+		Enumeration enm = bundle.getEntryPaths("META-INF/");

+		Object[] res = copyEnumeration(enm);

+		assertEquals("folders ignored; found " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testURLFolderReturnsProperPathForFolders() throws Exception {

+		Enumeration enm = bundle.findEntries("/", "META-INF", false);

+		assertNotNull(enm);

+		assertTrue(enm.hasMoreElements());

+		assertTrue(((URL) enm.nextElement()).getPath().endsWith("/"));

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/service/ServiceAvailableDuringUnregistrationTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/service/ServiceAvailableDuringUnregistrationTest.java
new file mode 100644
index 0000000..156c9b7
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/compliance/service/ServiceAvailableDuringUnregistrationTest.java
@@ -0,0 +1,64 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.compliance.service;

+

+import java.awt.Polygon;

+import java.awt.Shape;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceEvent;

+import org.osgi.framework.ServiceListener;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.util.OsgiFilterUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+// works on KF 2.0.3+

+public class ServiceAvailableDuringUnregistrationTest extends BaseIntegrationTest {

+

+	private Shape service;

+

+

+	public void testServiceAliveDuringUnregistration() throws Exception {

+		service = new Polygon();

+

+		ServiceRegistration reg = bundleContext.registerService(Shape.class.getName(), service, null);

+

+		String filter = OsgiFilterUtils.unifyFilter(Shape.class, null);

+

+		ServiceListener listener = new ServiceListener() {

+

+			public void serviceChanged(ServiceEvent event) {

+				if (ServiceEvent.UNREGISTERING == event.getType()) {

+					ServiceReference ref = event.getServiceReference();

+					Object aliveService = bundleContext.getService(ref);

+					assertNotNull("services not available during unregistration", aliveService);

+					assertSame(service, aliveService);

+				}

+			}

+		};

+

+		try {

+			bundleContext.addServiceListener(listener, filter);

+			reg.unregister();

+		}

+		finally {

+			bundleContext.removeServiceListener(listener);

+		}

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/config/ConfigTest.jav b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/config/ConfigTest.jav
new file mode 100644
index 0000000..96b8b77
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/config/ConfigTest.jav
@@ -0,0 +1,130 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.config;
+
+import java.io.File;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.eclipse.gemini.blueprint.iandt.configuration.ManagedServiceFactoryListener;
+import org.eclipse.gemini.blueprint.iandt.configuration.ManagedServiceListener;
+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;
+
+/**
+ * @author Hal Hildebrand Date: Jun 14, 2007 Time: 7:16:43 PM
+ */
+
+public abstract class ConfigTest extends BaseIntegrationTest {
+	private ConfigurationAdmin admin;
+
+	private String location;
+
+	private static String CONFIG_DIR = "test-config";
+
+	protected String[] getTestBundlesNames() {
+		System.setProperty("com.gatespace.bundle.cm.store", CONFIG_DIR);
+		initializeDirectory(CONFIG_DIR);
+		return new String[] { "org.knopflerfish.bundles, log_all, 2.0.0", "org.knopflerfish.bundles, cm_all, 2.0.0",
+				"org.eclipse.gemini.blueprint.iandt, configuration," + getSpringDMVersion() };
+	}
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	protected static void initializeDirectory(String dir) {
+		File directory = new File(dir);
+		remove(directory);
+		assertTrue(dir + " directory successfully created", directory.mkdirs());
+	}
+
+	private static void remove(File directory) {
+		if (directory.exists()) {
+			File[] files = directory.listFiles();
+			for (int i = 0; i < files.length; i++) {
+				File file = files[i];
+				if (file.isDirectory()) {
+					remove(file);
+				}
+				else {
+					assertTrue(file + " deleted", file.delete());
+				}
+			}
+			assertTrue(directory + " directory successfully cleared", directory.delete());
+		}
+	}
+
+	protected void onSetUp() throws Exception {
+		ServiceReference ref = OsgiServiceReferenceUtils.getServiceReference(bundleContext,
+			ConfigurationAdmin.class.getName(), null);
+		admin = (ConfigurationAdmin) bundleContext.getService(ref);
+		assertNotNull("Configuration Admin exists", admin);
+		BundleContext bc = bundleContext;
+		Bundle[] bundles = bc.getBundles();
+		for (int i = 0; i < bundles.length; i++) {
+			if ("org.eclipse.gemini.blueprint.iandt.configuration".equals(bundles[i].getSymbolicName())) {
+				location = bundles[i].getLocation();
+				break;
+			}
+		}
+	}
+
+	public void testManagedService() throws Exception {
+		Thread.sleep(10);
+		assertEquals(0, ManagedServiceListener.updates.size());
+		Dictionary test = new Hashtable();
+		test.put("foo", "bar");
+
+		Configuration config = admin.getConfiguration(ManagedServiceListener.SERVICE_FACTORY_PID, location);
+		config.update(test);
+		Thread.sleep(10);
+
+		assertEquals(2, ManagedServiceListener.updates.size());
+		Dictionary props = (Dictionary) ManagedServiceListener.updates.get(0);
+		assertEquals("bar", props.get("foo"));
+		props = (Dictionary) ManagedServiceListener.updates.get(1);
+		assertEquals("bar", props.get("foo"));
+	}
+
+	public void testManagedServiceFactory() throws Exception {
+		Thread.sleep(10);
+		assertEquals(0, ManagedServiceFactoryListener.updates.size());
+		Dictionary test = new Hashtable();
+		test.put("foo", "bar");
+
+		Configuration config = admin.createFactoryConfiguration(ManagedServiceFactoryListener.SERVICE_FACTORY_PID,
+			location);
+		config.update(test);
+		Thread.sleep(10);
+		Thread.sleep(10);
+		assertEquals(2, ManagedServiceFactoryListener.updates.size());
+		Object[] update = (Object[]) ManagedServiceFactoryListener.updates.get(0);
+		assertNotNull("instance Pid exists", update[0]);
+		Dictionary props = (Dictionary) update[1];
+		assertEquals("bar", props.get("foo"));
+
+		update = (Object[]) ManagedServiceFactoryListener.updates.get(1);
+		assertNotNull("instance Pid exists", update[0]);
+		props = (Dictionary) update[1];
+		assertEquals("bar", props.get("foo"));
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncNoWaitTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncNoWaitTest.java
new file mode 100644
index 0000000..49d9b8f
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncNoWaitTest.java
@@ -0,0 +1,59 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+import java.awt.geom.Area;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * Integration test for AsyncNoWait

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class AsyncNoWaitTest extends BehaviorBaseTest {

+

+	private ServiceRegistration registration;

+

+	protected void onTearDown() throws Exception {

+		OsgiServiceUtils.unregisterService(registration);

+	}

+

+	public void testBehaviour() throws Exception {

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, async-nowait-bundle,"

+				+ getSpringDMVersion();

+

+		// start it

+		Bundle bundle = installBundle(bundleId);

+		bundle.start();

+

+		// wait for the bundle to start and fail

+		Thread.sleep(3000);

+

+		// put service up

+		registration = bundleContext.registerService(Shape.class.getName(), new Area(), null);

+

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// check that the appCtx is *not* published 

+		// TODO: this fails sometimes on the build server - find out why

+		// assertContextServiceIs(bundle, false, 1000);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncWaitTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncWaitTest.java
new file mode 100644
index 0000000..9e7327e
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/AsyncWaitTest.java
@@ -0,0 +1,65 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+import java.awt.geom.Area;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * Integration test for Async Wait (the default behavior). Start the bundle

+ * which will wait for the service to come up even though its importer has small

+ * timeout.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class AsyncWaitTest extends BehaviorBaseTest {

+

+	private ServiceRegistration registration;

+

+	protected void onTearDown() throws Exception {

+		OsgiServiceUtils.unregisterService(registration);

+	}

+

+	public void testBehaviour() throws Exception {

+

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, async-wait-bundle,"

+				+ getSpringDMVersion();

+

+		// start it

+		Bundle bundle = installBundle(bundleId);

+		bundle.start();

+

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// make sure the appCtx is not up

+		// check that the appCtx is *not* published (it waits for the service to

+		// appear)

+		assertContextServiceIs(bundle, false, 500);

+

+		// put service up

+		registration = bundleContext.registerService(Shape.class.getName(), new Area(), null);

+

+		// do wait a bit to let the appCtx to fully start

+		// check the appCtx again (should be published)

+		assertContextServiceIs(bundle, true, 4000);

+

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/BehaviorBaseTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/BehaviorBaseTest.java
new file mode 100644
index 0000000..458915a
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/BehaviorBaseTest.java
@@ -0,0 +1,71 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.io.FilePermission;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

+import org.springframework.util.Assert;

+

+/**

+ * Base class with utility methods.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public abstract class BehaviorBaseTest extends BaseIntegrationTest {

+

+	/**

+	 * Does the given bundle, publish an application context or not?

+	 * 

+	 * @param alive

+	 */

+	protected void assertContextServiceIs(Bundle bundle, boolean alive, long maxWait) {

+		Assert.notNull(bundle);

+

+		try {

+			waitOnContextCreation(bundle.getSymbolicName(), maxWait / 1000 + 1);

+			if (!alive)

+				fail("appCtx should have NOT been published for bundle "

+						+ OsgiStringUtils.nullSafeNameAndSymName(bundle));

+		}

+		catch (RuntimeException timeout) {

+			if (alive)

+				fail("appCtx should have been published for bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle));

+		}

+	}

+

+	protected Bundle installBundle(String bundleId) throws Exception {

+		// locate bundle

+		Resource bundleLocation = locateBundle(bundleId);

+		assertTrue("bundle " + bundleId + " could not be found", bundleLocation.exists());

+

+		return bundleContext.installBundle(bundleLocation.getURL().toString());

+	}

+

+	protected List getTestPermissions() {

+		List list = super.getTestPermissions();

+		list.add(new FilePermission("<<ALL FILES>>", "read"));

+		list.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		list.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		list.add(new AdminPermission("*", AdminPermission.RESOLVE));

+		return list;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/ConfigFileWithDotsTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/ConfigFileWithDotsTest.java
new file mode 100644
index 0000000..42be736
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/ConfigFileWithDotsTest.java
@@ -0,0 +1,37 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.eclipse.gemini.blueprint.test.AbstractConfigurableBundleCreatorTests;

+

+/**

+ * Simple test for bundles that provide a configuration file with dots.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ConfigFileWithDotsTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, config-with-dots.bundle," + getSpringDMVersion() };

+	}

+

+	public void testShapeServicePublished() throws Exception {

+		assertNotNull(bundleContext.getServiceReference(Shape.class.getName()));

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/NoPublishTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/NoPublishTest.java
new file mode 100644
index 0000000..d72c6e8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/NoPublishTest.java
@@ -0,0 +1,48 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Point;

+

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Integration test for publish-context directive.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class NoPublishTest extends BehaviorBaseTest {

+

+	public void testBehaviour() throws Exception {

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, nopublish-bundle,"

+				+ getSpringDMVersion();

+

+		// start it

+		Bundle bundle = installBundle(bundleId);

+		bundle.start();

+		// wait for the listener to catch up

+		Thread.sleep(1000);

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// check that the appCtx is not publish

+		assertContextServiceIs(bundle, false, 1000);

+

+		// but the point service is

+		assertNotNull("point service should have been published"

+				+ bundleContext.getServiceReference(Point.class.getName()));

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitTest.java
new file mode 100644
index 0000000..bba0ec8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitTest.java
@@ -0,0 +1,70 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Integration test for Sync NoWait.

+ * 

+ * Start two bundles, one which requires a dependency and one which provides it.

+ * However, since they are started synchronously, the first one will fail.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SyncNoWaitTest extends BehaviorBaseTest {

+

+	private String tailBundleId = "org.eclipse.gemini.blueprint.iandt, sync-tail-bundle,"

+			+ getSpringDMVersion();

+

+	private String bundleId = "org.eclipse.gemini.blueprint.iandt, sync-nowait-bundle,"

+			+ getSpringDMVersion();

+

+	public void testBehaviour() throws Exception {

+

+		// locate bundle

+		Bundle bundle = installBundle(bundleId);

+		Bundle tail = installBundle(tailBundleId);

+

+		// start bundle first

+		bundle.start();

+

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// followed by its tail

+		tail.start();

+		assertTrue("bundle " + tail + "hasn't been fully started", OsgiBundleUtils.isBundleActive(tail));

+

+		// wait for the listener to get the bundles and wait for timeout

+

+		// make sure the appCtx is not up

+		// check that the appCtx is *not* published (it waits for the service to

+		// appear)

+		assertContextServiceIs(bundle, false, 3000);

+

+		// wait for appCtx to timeout

+		//Thread.sleep(3000);

+

+		// check that the dependency service is actually started as the

+		// dependency

+		// bundle has started

+		assertNotNull(bundleContext.getServiceReference(Shape.class.getName()));

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitWithReverseQueueTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitWithReverseQueueTest.java
new file mode 100644
index 0000000..1bee033
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncNoWaitWithReverseQueueTest.java
@@ -0,0 +1,65 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Test the sync behaviour but this time, by first staring the dependency and the

+ * the bundle.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SyncNoWaitWithReverseQueueTest extends BehaviorBaseTest {

+

+	private String tailBundleId = "org.eclipse.gemini.blueprint.iandt, sync-tail-bundle,"

+			+ getSpringDMVersion();

+

+	private String bundleId = "org.eclipse.gemini.blueprint.iandt, sync-nowait-bundle,"

+			+ getSpringDMVersion();

+

+	public void testBehaviour() throws Exception {

+

+		// locate bundle

+		Bundle bundle = installBundle(bundleId);

+		Bundle tail = installBundle(tailBundleId);

+

+		// start dependency first

+		tail.start();

+

+		Thread.sleep(500);

+

+		// followed by the bundle

+		bundle.start();

+

+		assertTrue("bundle " + tail + "hasn't been fully started", OsgiBundleUtils.isBundleActive(tail));

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// wait for the listener to get the bundles and wait for timeout

+

+		assertContextServiceIs(bundle, true, 2000);

+

+		// check that the dependency service is actually started as the

+		// dependency

+		// bundle has started

+		assertNotNull(bundleContext.getServiceReference(Shape.class.getName()));

+

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitTest.java
new file mode 100644
index 0000000..64adaa4
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitTest.java
@@ -0,0 +1,63 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import java.awt.Shape;

+

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Integration test for Sync Wait.

+ * 

+ * Start two bundles, one which requires a dependency and one which provides it

+ * (in inverse order).

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SyncWaitTest extends BehaviorBaseTest {

+

+	public void testBehaviour() throws Exception {

+

+		// locate bundle

+		String tailBundleId = "org.eclipse.gemini.blueprint.iandt, sync-tail-bundle,"

+				+ getSpringDMVersion();

+

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, sync-wait-bundle,"

+				+ getSpringDMVersion();

+

+		// start dependency first

+		Bundle tail = installBundle(tailBundleId);

+		tail.start();

+		assertTrue("bundle " + tail + "hasn't been fully started", OsgiBundleUtils.isBundleActive(tail));

+

+		// followed by the bundle

+		Bundle bundle = installBundle(bundleId);

+		bundle.start();

+

+		assertTrue("bundle " + bundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(bundle));

+

+		// wait for the listener to get the bundles

+

+		assertContextServiceIs(bundle, true, 2000);

+

+		// check that the dependency service is actually started as the

+		// dependency bundle has started

+		assertNotNull(bundleContext.getServiceReference(Shape.class.getName()));

+

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitWithoutDependencyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitWithoutDependencyTest.java
new file mode 100644
index 0000000..33a2925
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/configopt/SyncWaitWithoutDependencyTest.java
@@ -0,0 +1,62 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.configopt;

+

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Integration test for Sync Wait but this time, by checking the waiting by

+ * satisfying the dependency through this test.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SyncWaitWithoutDependencyTest extends BehaviorBaseTest {

+

+	public void testBehaviour() throws Exception {

+

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, sync-wait-bundle,"

+				+ getSpringDMVersion();

+

+		// locate bundle

+		String tailBundleId = "org.eclipse.gemini.blueprint.iandt, sync-tail-bundle,"

+				+ getSpringDMVersion();

+

+		// start bundle first (no dependency)

+		Bundle bundle = installBundle(bundleId);

+

+		bundle.start();

+

+		assertTrue("bundle " + bundle + "should have started", OsgiBundleUtils.isBundleActive(bundle));

+		// start bundle dependency

+		Bundle tailBundle = installBundle(tailBundleId);

+		tailBundle.start();

+

+		assertTrue("bundle " + tailBundle + "hasn't been fully started", OsgiBundleUtils.isBundleActive(tailBundle));

+

+		// check appCtx hasn't been published

+		assertContextServiceIs(bundle, false, 500);

+		// check the dependency ctx

+		assertContextServiceIs(tailBundle, true, 500);

+

+		// restart the bundle (to catch the tail)

+		bundle.stop();

+		bundle.start();

+

+		// check appCtx has been published

+		assertContextServiceIs(bundle, true, 500);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/BundleContextAwareTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/BundleContextAwareTest.java
new file mode 100644
index 0000000..0707c7e
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/BundleContextAwareTest.java
@@ -0,0 +1,64 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.context;

+

+import java.io.Serializable;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.BundleContext;

+import org.eclipse.gemini.blueprint.context.BundleContextAware;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+

+/**

+ * Test injection of BundleContextAware.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BundleContextAwareTest extends BaseIntegrationTest {

+

+	public static class BundleContextAwareHolder implements BundleContextAware {

+

+		private BundleContext bundleContext;

+

+		public BundleContext getBundleContext() {

+			return bundleContext;

+		}

+

+		public void setBundleContext(BundleContext bundleContext) {

+			this.bundleContext = bundleContext;

+		}

+

+		private static class AnotherInnerClass implements Serializable {

+

+		}

+	}

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/context/bundleContextAwareTest.xml" };

+	}

+

+	public void testBundleContextAware() throws Exception {

+		BundleContextAwareHolder holder = (BundleContextAwareHolder) applicationContext.getBean("bean");

+		assertNotNull(holder.getBundleContext());

+		assertSame(bundleContext, holder.getBundleContext());

+		assertSame(applicationContext.getBean(ConfigurableOsgiBundleApplicationContext.BUNDLE_CONTEXT_BEAN_NAME),

+			holder.getBundleContext());

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/OsgiAppContextTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/OsgiAppContextTest.java
new file mode 100644
index 0000000..7479ab3
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/OsgiAppContextTest.java
@@ -0,0 +1,52 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.context;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.BundleContext;

+import org.springframework.context.ApplicationContext;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+

+/**

+ * Integration test on the functionality offered by OSGi app context.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class OsgiAppContextTest extends BaseIntegrationTest {

+

+	private BundleContext bundleContext;

+

+

+	public void testBundleContextAvailableAsBean() {

+		ApplicationContext ctx = applicationContext;

+		assertNotNull(ctx);

+		assertTrue("bundleContext not available as a bean",

+			applicationContext.containsBean(ConfigurableOsgiBundleApplicationContext.BUNDLE_CONTEXT_BEAN_NAME));

+	}

+

+	public void testBundleContextInjected() {

+		assertNotNull("bundleContext hasn't been injected into the test", bundleContext);

+	}

+

+	public void setBundleContext(BundleContext bundleContext) {

+		this.bundleContext = bundleContext;

+	}

+

+	public void testBundleContextIsTheSame() {

+		assertSame(bundleContext,

+			applicationContext.getBean(ConfigurableOsgiBundleApplicationContext.BUNDLE_CONTEXT_BEAN_NAME));

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/PublishedInterfacesTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/PublishedInterfacesTest.java
new file mode 100644
index 0000000..6197488
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/context/PublishedInterfacesTest.java
@@ -0,0 +1,60 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.context;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Constants;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.Version;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

+

+/**

+ * Test checking the context published interfaces.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class PublishedInterfacesTest extends BaseIntegrationTest {

+

+	public void testEmptyApplicationContext() throws Exception {

+		checkedPublishedOSGiService(1);

+	}

+

+	public void testXmlOsgiContext() throws Exception {

+		OsgiBundleXmlApplicationContext context = new OsgiBundleXmlApplicationContext(

+			new String[] { "/org/eclipse/gemini/blueprint/iandt/context/no-op-context.xml" });

+		context.setBundleContext(bundleContext);

+		context.refresh();

+

+		checkedPublishedOSGiService(2);

+		context.close();

+	}

+

+	private void checkedPublishedOSGiService(int expectedContexts) throws Exception {

+		ServiceReference[] refs = bundleContext.getServiceReferences(

+			ConfigurableOsgiBundleApplicationContext.class.getName(), null);

+		assertEquals("different number of published contexts encountered", expectedContexts, refs.length);

+

+		for (int i = 0; i < refs.length; i++) {

+			ServiceReference serviceReference = refs[i];

+			String[] interfaces = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);

+			assertEquals("not enough interfaces published", 13, interfaces.length);

+			assertEquals(Version.emptyVersion, serviceReference.getProperty(Constants.BUNDLE_VERSION));

+			assertEquals(bundleContext.getBundle().getSymbolicName(),

+				serviceReference.getProperty(Constants.BUNDLE_SYMBOLICNAME));

+		}

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/BaseImporterCycleTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/BaseImporterCycleTest.java
new file mode 100644
index 0000000..1b79dcb
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/BaseImporterCycleTest.java
@@ -0,0 +1,52 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+import java.awt.Polygon;

+import java.awt.Shape;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class BaseImporterCycleTest extends BaseIntegrationTest {

+

+	protected ListenerA listenerA;

+	protected ListenerB listenerB;

+	private Shape service;

+	private ServiceRegistration registration;

+

+	protected void onSetUp() throws Exception {

+		service = new Polygon();

+		registration = bundleContext.registerService(Shape.class.getName(), service, null);

+	}

+

+	protected void onTearDown() throws Exception {

+		service = null;

+		OsgiServiceUtils.unregisterService(registration);

+	}

+

+	public void setListenerA(ListenerA listener) {

+		this.listenerA = listener;

+	}

+

+	public void setListenerB(ListenerB nestedListener) {

+		this.listenerB = nestedListener;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/CollectionCycleTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/CollectionCycleTest.java
new file mode 100644
index 0000000..83e276f
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/CollectionCycleTest.java
@@ -0,0 +1,56 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+import java.util.Collection;

+

+/**

+ * Integration test for checking cyclic injection between an importer and its

+ * listeners.

+ * 

+ * @author Costin Leau

+ */

+public class CollectionCycleTest extends BaseImporterCycleTest {

+

+	private Collection importer;

+

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/cycles/top-level-collection-importer.xml" };

+	}

+

+	protected void onSetUp() throws Exception {

+		super.onSetUp();

+		importer = (Collection) applicationContext.getBean("importer");

+		assertTrue(applicationContext.isSingleton("importer"));

+		assertTrue(applicationContext.isSingleton("&importer"));

+	}

+

+	

+	public void testListenerA() throws Exception {

+		assertEquals(importer.toString(), listenerA.getTarget().toString());

+	}

+

+	public void testListenerB() throws Exception {

+		assertEquals(importer.toString(), listenerB.getTarget().toString());

+	}

+

+	public void testListenersBetweenThem() throws Exception {

+		Object a = listenerA.getTarget();

+		Object b = listenerB.getTarget();

+		assertSame(listenerA.getTarget(), listenerB.getTarget());

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ExporterCycleTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ExporterCycleTest.java
new file mode 100644
index 0000000..a7c6922
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ExporterCycleTest.java
@@ -0,0 +1,62 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.test.AbstractConfigurableBundleCreatorTests;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ExporterCycleTest extends BaseIntegrationTest {

+

+	private ListenerA listenerA;

+	private ListenerB listenerB;

+	private ServiceRegistration registration;

+

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/cycles/top-level-exporter.xml" };

+	}

+

+	public void testListenerA() throws Exception {

+		assertSame(registration, listenerA.getTarget());

+	}

+	

+	public void testListenerB() throws Exception {

+		assertSame(registration, listenerB.getTarget());

+	}

+

+	

+	public void testListenersBetweenThem() throws Exception {

+		assertSame(listenerB.getTarget(), listenerA.getTarget());

+	}

+

+

+	public void setListenerA(ListenerA listener) {

+		this.listenerA = listener;

+	}

+

+	public void setListenerB(ListenerB nestedListener) {

+		this.listenerB = nestedListener;

+	}

+

+	public void setRegistration(ServiceRegistration registration) {

+		this.registration = registration;

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/Listener.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/Listener.java
new file mode 100644
index 0000000..2256d4a
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/Listener.java
@@ -0,0 +1,46 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+import java.util.Map;

+

+/**

+ * Simple custom listener used for testing cyclic injection.

+ * 

+ * @author Costin Leau

+ */

+public abstract class Listener {

+

+	private Object target;

+

+	public void bind(Object service, Map properties) {

+	}

+

+	/**

+	 * Returns the target.

+	 * 

+	 * @return Returns the target

+	 */

+	public Object getTarget() {

+		return target;

+	}

+

+	/**

+	 * @param target The target to set.

+	 */

+	public void setTarget(Object target) {

+		this.target = target;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerA.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerA.java
new file mode 100644
index 0000000..5140d07
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerA.java
@@ -0,0 +1,23 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ListenerA extends Listener {

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerB.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerB.java
new file mode 100644
index 0000000..f0541f7
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ListenerB.java
@@ -0,0 +1,23 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ListenerB extends Listener {

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ReferenceCycleTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ReferenceCycleTest.java
new file mode 100644
index 0000000..b35f521
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/cycles/ReferenceCycleTest.java
@@ -0,0 +1,50 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.cycles;

+

+import java.awt.Shape;

+

+/**

+ * Integration test for checking cyclic injection between an importer and its

+ * listeners.

+ * 

+ * @author Costin Leau

+ */

+public class ReferenceCycleTest extends BaseImporterCycleTest {

+

+	private Shape importer;

+

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/cycles/top-level-reference-importer.xml" };

+	}

+

+	public void testListenerA() throws Exception {

+		assertEquals(importer.toString(), listenerA.getTarget().toString());

+	}

+

+	public void testListenerB() throws Exception {

+		assertEquals(importer.toString(), listenerB.getTarget().toString());

+	}

+

+	public void testListenersBetweenThem() throws Exception {

+		assertSame(listenerA.getTarget(), listenerB.getTarget());

+	}

+

+	public void setImporter(Shape importer) {

+		this.importer = importer;

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/deadlocks/DeadlockHandlingTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/deadlocks/DeadlockHandlingTest.java
new file mode 100644
index 0000000..472ff7c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/deadlocks/DeadlockHandlingTest.java
@@ -0,0 +1,82 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.deadlocks;
+
+import java.io.FilePermission;
+import java.util.List;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.util.tracker.ServiceTracker;
+import org.springframework.context.support.AbstractRefreshableApplicationContext;
+import org.springframework.core.io.Resource;
+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;
+
+/**
+ * @author Hal Hildebrand Date: Jun 5, 2007 Time: 9:10:11 PM
+ */
+public class DeadlockHandlingTest extends BaseIntegrationTest {
+
+	// Specifically do not wait
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return false;
+	}
+
+	/**
+	 * While it may appear that this test is doing nothing, what it is doing is
+	 * testing what happens when the OSGi framework is shutdown while the
+	 * Spring/OSGi extender is deadlocked. If all goes well, the test will
+	 * gracefully end. If not, it will hang for quite a while.
+	 */
+	public void testErrorHandling() throws Exception {
+		Resource errorResource = getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "deadlock",
+			getSpringDMVersion());
+		assertNotNull("bundle resource exists", errorResource);
+		Bundle errorBundle = bundleContext.installBundle(errorResource.getURL().toExternalForm());
+		assertNotNull("bundle exists", errorBundle);
+		errorBundle.start();
+		StringBuilder filter = new StringBuilder();
+
+		filter.append("(&");
+		filter.append("(").append(Constants.OBJECTCLASS).append("=").append(
+			AbstractRefreshableApplicationContext.class.getName()).append(")");
+		filter.append("(").append(ConfigurableOsgiBundleApplicationContext.APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME);
+		filter.append("=").append("org.eclipse.gemini.blueprint.iandt.deadlock").append(")");
+		filter.append(")");
+		ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter.toString()), null);
+
+		try {
+			tracker.open();
+
+			AbstractRefreshableApplicationContext appContext = (AbstractRefreshableApplicationContext) tracker.waitForService(3000);
+			assertNull("Deadlock context should not be published", appContext);
+		}
+		finally {
+			tracker.close();
+		}
+	}
+
+	protected List getTestPermissions() {
+		List list = super.getTestPermissions();
+		list.add(new FilePermission("<<ALL FILES>>", "read"));
+		list.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		list.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		list.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		return list;
+	}
+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.java
new file mode 100644
index 0000000..b2c7b2a
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.java
@@ -0,0 +1,165 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependency;
+
+import java.io.FilePermission;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;
+
+/**
+ * Crucial test for the asych, service-dependency waiting. Installs several
+ * bundles which depend on each other services making sure that none of them
+ * starts unless the dependent bundle (and its services) are also started.
+ * 
+ * @author Hal Hildebrand Date: Dec 1, 2006 Time: 3:56:43 PM
+ * @author Costin Leau
+ */
+public class DependencyTest extends BaseIntegrationTest {
+
+	private static final String DEPENDENT_CLASS_NAME = "org.eclipse.gemini.blueprint.iandt.dependencies.Dependent";
+
+
+	// private static final String SERVICE_2_FILTER = "(service=2)";
+	// private static final String SERVICE_3_FILTER = "(service=3)";
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	// dependency bundle - depends on service2, service3 and, through a nested reference, to service1
+	// simple.service2 - publishes service2
+	// simple.service3 - publishes service3
+	// simple 		   - publishes service
+	public void testDependencies() throws Exception {
+		// waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice");
+
+		Bundle dependencyTestBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "dependencies", getSpringDMVersion()).getURL().toExternalForm());
+
+		Bundle simpleService2Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle simpleService3Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service3", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle simpleServiceBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service", getSpringDMVersion()).getURL().toExternalForm());
+
+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
+		assertNotNull("Cannot find the simple service 2 bundle", simpleService2Bundle);
+		assertNotNull("Cannot find the simple service 3 bundle", simpleService3Bundle);
+		assertNotNull("dependencyTest can't be resolved", dependencyTestBundle);
+
+		assertNotSame("simple service bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleServiceBundle.getState()));
+
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService2Bundle.getState()));
+
+		assertNotSame("simple service 3 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService3Bundle.getState()));
+
+		startDependencyAsynch(dependencyTestBundle);
+		Thread.sleep(2000); // Yield to give bundle time to get into waiting
+		// state.
+		ServiceReference dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService3Bundle);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService2Bundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		startDependency(simpleServiceBundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.dependencies");
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNotNull("Service has not been started!", dependentRef);
+
+		Object dependent = bundleContext.getService(dependentRef);
+
+		assertNotNull("Service is not available!", dependent);
+
+	}
+
+	private void startDependency(Bundle bundle) throws BundleException, InterruptedException {
+		bundle.start();
+		waitOnContextCreation(bundle.getSymbolicName());
+		System.out.println("started bundle [" + OsgiStringUtils.nullSafeSymbolicName(bundle) + "]");
+	}
+
+	private void startDependencyAsynch(final Bundle bundle) {
+		System.out.println("starting dependency test bundle");
+		Runnable runnable = new Runnable() {
+
+			public void run() {
+				try {
+					bundle.start();
+					System.out.println("started dependency test bundle");
+				}
+				catch (BundleException ex) {
+					System.err.println("can't start bundle " + ex);
+				}
+			}
+		};
+		Thread thread = new Thread(runnable);
+		thread.setDaemon(false);
+		thread.setName("dependency test bundle");
+		thread.start();
+	}
+
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return true;
+	}
+
+	protected long getDefaultWaitTime() {
+		return 60L;
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new PropertyPermission("*", AdminPermission.EXECUTE));
+		perms.add(new FilePermission("<<ALL FILES>>", "read"));
+		return perms;
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/DependencyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/DependencyTest.java
new file mode 100644
index 0000000..9128cac
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/DependencyTest.java
@@ -0,0 +1,171 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependencyWithDelay;
+
+import java.io.FilePermission;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundlePermission;
+import org.osgi.framework.PackagePermission;
+import org.osgi.framework.ServicePermission;
+import org.osgi.framework.ServiceReference;
+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;
+
+/**
+ * Crucial test for the asych, service-dependency waiting. Installs several
+ * bundles which depend on each other services making sure that none of them
+ * starts unless the dependent bundle (and its services) are also started.
+ * 
+ * @author Hal Hildebrand Date: Dec 1, 2006 Time: 3:56:43 PM
+ * @author Costin Leau
+ */
+public class DependencyTest extends BaseIntegrationTest {
+
+	private static final String DEPENDENT_CLASS_NAME = "org.eclipse.gemini.blueprint.iandt.dependencies.Dependent";
+
+
+	// private static final String SERVICE_2_FILTER = "(service=2)";
+	// private static final String SERVICE_3_FILTER = "(service=3)";
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	// dependency bundle - depends on service2, service3 and, through a nested
+	// reference, to service1
+	// simple.service2 - publishes service2
+	// simple.service3 - publishes service3
+	// simple - publishes service1
+	public void testDependencies() throws Exception {
+		System.setProperty("org.eclipse.gemini.blueprint.iandt.simpleservice.impl.delay", "10000");
+		// waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice");
+
+		Bundle dependencyTestBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "dependencies", getSpringDMVersion()).getURL().toExternalForm());
+
+		Bundle simpleService2Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle simpleService3Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service3", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle simpleServiceBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service", getSpringDMVersion()).getURL().toExternalForm());
+
+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
+		assertNotNull("Cannot find the simple service 2 bundle", simpleService2Bundle);
+		assertNotNull("Cannot find the simple service 3 bundle", simpleService3Bundle);
+		assertNotNull("dependencyTest can't be resolved", dependencyTestBundle);
+
+		assertNotSame("simple service bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleServiceBundle.getState()));
+
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService2Bundle.getState()));
+
+		assertNotSame("simple service 3 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService3Bundle.getState()));
+
+		startDependencyAsynch(dependencyTestBundle);
+		Thread.sleep(2000); // Yield to give bundle time to get into waiting
+		// state.
+		ServiceReference dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService3Bundle);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService2Bundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		startDependency(simpleServiceBundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.dependencies");
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNotNull("Service has not been started!", dependentRef);
+
+		Object dependent = bundleContext.getService(dependentRef);
+
+		assertNotNull("Service is not available!", dependent);
+
+	}
+
+	private void startDependency(Bundle bundle) throws BundleException, InterruptedException {
+		bundle.start();
+		waitOnContextCreation(bundle.getSymbolicName());
+		System.out.println("started bundle [" + OsgiStringUtils.nullSafeSymbolicName(bundle) + "]");
+	}
+
+	private void startDependencyAsynch(final Bundle bundle) {
+		System.out.println("starting dependency test bundle");
+		Runnable runnable = new Runnable() {
+
+			public void run() {
+				try {
+					bundle.start();
+					System.out.println("started dependency test bundle");
+				}
+				catch (BundleException ex) {
+					System.err.println("can't start bundle " + ex);
+				}
+			}
+		};
+		Thread thread = new Thread(runnable);
+		thread.setDaemon(false);
+		thread.setName("dependency test bundle");
+		thread.start();
+	}
+
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return true;
+	}
+
+	protected long getDefaultWaitTime() {
+		return 60L;
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		perms.add(new FilePermission("<<ALL FILES>>", "read"));
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		perms.add(new AdminPermission("*", AdminPermission.METADATA));
+		return perms;
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/FactoryDependencyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/FactoryDependencyTest.java
new file mode 100644
index 0000000..9d72cb1
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/dependencyWithDelay/FactoryDependencyTest.java
@@ -0,0 +1,153 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.dependencyWithDelay;
+
+import java.io.FilePermission;
+import java.util.List;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;
+
+/**
+ * @author Hal Hildebrand Date: Aug 27, 2007 Time: 9:36:23 AM
+ */
+
+public class FactoryDependencyTest extends BaseIntegrationTest {
+
+	private static final String DEPENDENT_CLASS_NAME = "org.eclipse.gemini.blueprint.iandt.dependencies.Dependent";
+
+	private static final String DELAY_PROP = "org.eclipse.gemini.blueprint.iandt.dependencies.factory.delay";
+
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	// dependency bundle - depends on service2, service3 and, through a nested
+	// reference, to service1
+	// simple.service2 - publishes service2
+	// simple.service3 - publishes service3
+	// simple - publishes service1
+	public void testDependencies() throws Exception {
+		System.setProperty(DELAY_PROP, "10000");
+
+		Bundle dependencyTestBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "dependencies", getSpringDMVersion()).getURL().toExternalForm());
+
+		Bundle simpleService2Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle simpleService3Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service3", getSpringDMVersion()).getURL().toExternalForm());
+		Bundle factoryServiceBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "dependendencies.factory", getSpringDMVersion()).getURL().toExternalForm());
+
+		assertNotNull("Cannot find the factory service bundle", factoryServiceBundle);
+		assertNotNull("Cannot find the simple service 2 bundle", simpleService2Bundle);
+		assertNotNull("Cannot find the simple service 3 bundle", simpleService3Bundle);
+		assertNotNull("dependencyTest can't be resolved", dependencyTestBundle);
+
+		assertNotSame("factory service bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			factoryServiceBundle.getState()));
+
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService2Bundle.getState()));
+
+		assertNotSame("simple service 3 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService3Bundle.getState()));
+
+		startDependencyAsynch(dependencyTestBundle);
+		Thread.sleep(2000); // Yield to give bundle time to get into waiting
+		// state.
+		ServiceReference dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService3Bundle);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		startDependency(simpleService2Bundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		startDependency(factoryServiceBundle);
+
+		assertNull("Service with unsatisfied dependencies has been started!", dependentRef);
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.dependencies");
+
+		dependentRef = bundleContext.getServiceReference(DEPENDENT_CLASS_NAME);
+
+		assertNotNull("Service has not been started!", dependentRef);
+
+		Object dependent = bundleContext.getService(dependentRef);
+
+		assertNotNull("Service is not available!", dependent);
+
+	}
+
+	private void startDependency(Bundle bundle) throws BundleException, InterruptedException {
+		bundle.start();
+		waitOnContextCreation(bundle.getSymbolicName());
+		System.out.println("started bundle [" + OsgiStringUtils.nullSafeSymbolicName(bundle) + "]");
+	}
+
+	private void startDependencyAsynch(final Bundle bundle) {
+		System.out.println("starting dependency test bundle");
+		Runnable runnable = new Runnable() {
+
+			public void run() {
+				try {
+					bundle.start();
+					System.out.println("started dependency test bundle");
+				}
+				catch (BundleException ex) {
+					System.err.println("can't start bundle " + ex);
+				}
+			}
+		};
+		Thread thread = new Thread(runnable);
+		thread.setDaemon(false);
+		thread.setName("dependency test bundle");
+		thread.start();
+	}
+
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return true;
+	}
+
+	protected long getDefaultWaitTime() {
+		return 60L;
+	}
+
+	protected List getTestPermissions() {
+		List list = super.getTestPermissions();
+		list.add(new FilePermission("<<ALL FILES>>", "read"));
+		list.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		list.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		list.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		list.add(new AdminPermission("*", AdminPermission.METADATA));
+		return list;
+	}
+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.java
new file mode 100644
index 0000000..e002422
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.java
@@ -0,0 +1,144 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.duplicateClass;
+
+import java.io.FilePermission;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;
+
+/**
+ * Test which installs twice a bundle with the same symbolic name but with
+ * different classes to check that proper reloading occurs.
+ * 
+ * @author Andy Piper
+ */
+public class DuplicateClassTest extends BaseIntegrationTest {
+
+	private static final String DEPENDENT_CLASS_NAME = "org.eclipse.gemini.blueprint.iandt.simpleservice.MyService";
+
+
+	protected String getManifestLocation() {
+		return "classpath:org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.MF";
+	}
+
+	public void testDependencies() throws Exception {
+
+		// Simple Service bundle (provides the base package + 1 service)
+		Bundle simpleServiceBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service", getSpringDMVersion()).getURL().toExternalForm());
+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
+
+		assertNotSame("simple service bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleServiceBundle.getState()));
+		startDependency(simpleServiceBundle);
+
+		// Identical Simple Service bundle (+1 service)
+		Bundle simpleServiceDuplicateBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service.identical", getSpringDMVersion()).getURL().toExternalForm());
+		assertNotNull("Cannot find the simple service duplicate bundle", simpleServiceDuplicateBundle);
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleServiceDuplicateBundle.getState()));
+		startDependency(simpleServiceDuplicateBundle);
+
+		ServiceReference[] refs = bundleContext.getServiceReferences(DEPENDENT_CLASS_NAME, null);
+
+		assertEquals(2, refs.length);
+
+		MyService service1 = (MyService) bundleContext.getService(refs[0]);
+		MyService service2 = (MyService) bundleContext.getService(refs[1]);
+
+		assertNotNull(service1);
+		assertNotNull(service2);
+
+		String msg1 = service1.stringValue();
+		String msg2 = service2.stringValue();
+
+		String jmsg = "Bond.  James Bond.";
+		String cmsg = "Connery.  Sean Connery #1";
+		System.out.println(msg1);
+		System.out.println(msg2);
+		assertNotSame(msg1, msg2);
+		assertTrue(msg1.equals(jmsg) || msg1.equals(cmsg));
+		assertTrue(msg2.equals(jmsg) || msg2.equals(cmsg));
+
+		bundleContext.ungetService(refs[0]);
+		bundleContext.ungetService(refs[1]);
+
+		// Uninstall duplicate 1
+		simpleServiceDuplicateBundle.uninstall();
+		// stop base bundle so that the package is still around but its service
+		// is not
+		simpleServiceBundle.stop();
+
+		// Install something subtley different
+		simpleServiceDuplicateBundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service.2.identical", getSpringDMVersion()).getURL().toExternalForm());
+		assertNotNull("Cannot find the simple service duplicate 2 bundle", simpleServiceDuplicateBundle);
+		startDependency(simpleServiceDuplicateBundle);
+
+		refs = bundleContext.getServiceReferences(DEPENDENT_CLASS_NAME, null);
+
+		assertEquals(1, refs.length);
+
+		service1 = (MyService) bundleContext.getService(refs[0]);
+
+		assertNotNull(service1);
+
+		msg1 = service1.stringValue();
+
+		System.out.println(msg1);
+		assertTrue(msg1.equals("Dalton.  Timothy Dalton #1"));
+	}
+
+	private void startDependency(Bundle bundle) throws BundleException, InterruptedException {
+		bundle.start();
+		waitOnContextCreation(bundle.getSymbolicName());
+		System.out.println("started bundle [" + OsgiStringUtils.nullSafeSymbolicName(bundle) + "]");
+	}
+
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return true;
+	}
+
+	protected long getDefaultWaitTime() {
+		return 60L;
+	}
+
+	protected List getTestPermissions() {
+		List list = super.getTestPermissions();
+		list.add(new FilePermission("<<ALL FILES>>", "read"));
+		list.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		list.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		list.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		list.add(new AdminPermission("*", AdminPermission.METADATA));
+		return list;
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/errors/ErrorHandlingTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/errors/ErrorHandlingTest.java
new file mode 100644
index 0000000..12d3ed1
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/errors/ErrorHandlingTest.java
@@ -0,0 +1,83 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.errors;
+
+import java.io.FilePermission;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.springframework.core.io.Resource;
+
+/**
+ * @author Hal Hildebrand Date: May 29, 2007 Time: 5:07:01 PM
+ */
+public class ErrorHandlingTest extends BaseIntegrationTest {
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	// Specifically do not wait
+	protected boolean shouldWaitForSpringBundlesContextCreation() {
+		return false;
+	}
+
+	/**
+	 * While it may appear that this test is doing nothing, what it is doing is
+	 * testing what happens when the OSGi framework is shutdown while the
+	 * Spring/OSGi extender is still running threads which are trying to clean
+	 * up after an error condition in creating the context. When running under
+	 * the Felix platform, this test will produce deadlock or, if things are
+	 * really going south, serious CDNFE when handling the error (e.g.
+	 * java.lang.InputStream, java.lang.Integer, etc.). The reason for the
+	 * latter is that the OSGi framework is shutdown and the class loaders being
+	 * used by extender threads are no longer valid. The deadlock case stems
+	 * from a similar condition in that the system is deadlocked around the
+	 * synchronization of the context.create()/close() because the underlying
+	 * framework is deadlocked around resource resolution. As we process the
+	 * close of the context synchronously, we're blocked waiting for the
+	 * resource resolution which is blocked because the framework is shutting
+	 * down. We can't unblock because we're still waiting for the lock on the
+	 * context to shutdown and unblock the event notification from the
+	 * underlying framework.
+	 * 
+	 * Consequently, please do not remove or modify this test unless you talk to
+	 * Hal. :)
+	 */
+	public void testErrorHandling() throws Exception {
+		Resource errorResource = getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "error",
+			getSpringDMVersion());
+		assertNotNull("Error bundle resource exists", errorResource);
+		Bundle errorBundle = bundleContext.installBundle(errorResource.getURL().toExternalForm());
+		assertNotNull("Errro bundle exists", errorBundle);
+
+		errorBundle.start();
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		perms.add(new FilePermission("<<ALL FILES>>", "read"));
+		return perms;
+	}
+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/AbstractEventTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/AbstractEventTest.java
new file mode 100644
index 0000000..31bcd17
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/AbstractEventTest.java
@@ -0,0 +1,91 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.event;

+

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextEvent;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextListener;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class AbstractEventTest extends BaseIntegrationTest {

+

+	protected OsgiBundleApplicationContextListener listener;

+

+	private ServiceRegistration registration;

+	/** list of events */

+	protected List eventList = Collections.synchronizedList(new ArrayList());;

+	/** lock */

+	protected final Object lock = new Object();

+

+	/** wait X minutes max */

+	protected final long TIME_OUT = 3* 60 * 1000;

+

+

+	protected void onSetUp() throws Exception {

+		eventList.clear();

+

+		listener = new OsgiBundleApplicationContextListener() {

+

+			public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {

+				eventList.add(event);

+				synchronized (lock) {

+					lock.notify();

+				}

+			}

+		};

+	}

+

+	protected void onTearDown() throws Exception {

+		OsgiServiceUtils.unregisterService(registration);

+		eventList.clear();

+	}

+

+	protected void registerEventListener() {

+		// publish listener

+		registration = bundleContext.registerService(

+			new String[] { OsgiBundleApplicationContextListener.class.getName() }, listener, null);

+	}

+

+	/**

+	 * Returns true if the wait ended through a notification, false otherwise.

+	 * 

+	 * @param maxWait

+	 * @return

+	 * @throws Exception

+	 */

+	protected boolean waitForEvent(long maxWait) {

+		long start = System.currentTimeMillis();

+		synchronized (lock) {

+			try {

+				lock.wait(maxWait);

+			}

+			catch (Exception ex) {

+				return false;

+			}

+		}

+		long stop = System.currentTimeMillis();

+		boolean waitSuccessed = (stop - start <= maxWait);

+		return waitSuccessed;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/DepedencyEventTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/DepedencyEventTest.java
new file mode 100644
index 0000000..d843f5d
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/DepedencyEventTest.java
@@ -0,0 +1,173 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.event;

+

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextEvent;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextListener;

+import org.eclipse.gemini.blueprint.extender.event.BootstrappingDependenciesEvent;

+import org.eclipse.gemini.blueprint.extender.event.BootstrappingDependencyEvent;

+import org.eclipse.gemini.blueprint.service.importer.OsgiServiceDependency;

+import org.eclipse.gemini.blueprint.service.importer.event.OsgiServiceDependencyEvent;

+import org.eclipse.gemini.blueprint.service.importer.event.OsgiServiceDependencyWaitEndedEvent;

+import org.eclipse.gemini.blueprint.service.importer.event.OsgiServiceDependencyWaitStartingEvent;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class DepedencyEventTest extends AbstractEventTest {

+

+	private List refreshEvents = Collections.synchronizedList(new ArrayList(10));

+	private List<BootstrappingDependenciesEvent> graceEvents =

+			Collections.synchronizedList(new ArrayList<BootstrappingDependenciesEvent>(10));

+

+	protected void onSetUp() throws Exception {

+		refreshEvents.clear();

+

+		// override the listener with another implementation that waits until the appCtx are fully started

+		listener = new OsgiBundleApplicationContextListener() {

+

+			public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {

+				System.out.println("receiving event " + event.getClass());

+				if (event instanceof BootstrappingDependencyEvent) {

+					eventList.add(event);

+				}

+				if (event instanceof BootstrappingDependenciesEvent) {

+					graceEvents.add((BootstrappingDependenciesEvent) event);

+				} else {

+					refreshEvents.add(event);

+				}

+				synchronized (lock) {

+					lock.notify();

+				}

+			}

+		};

+	}

+

+	public void testEventsForCtxThatWork() throws Exception {

+		// publish listener

+		registerEventListener();

+

+		assertTrue("should start with an empty list", eventList.isEmpty());

+

+		// install the dependency bundle

+		Resource bundle =

+				getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "dependencies", getSpringDMVersion());

+

+		Resource dependency1 =

+				getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "simple.service", getSpringDMVersion());

+

+		Resource dependency2 =

+				getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion());

+

+		Resource dependency3 =

+				getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "simple.service3", getSpringDMVersion());

+

+		Bundle bnd = bundleContext.installBundle(bundle.getURL().toExternalForm());

+

+		// install the bundles but don't start them

+		Bundle bnd1 = bundleContext.installBundle(dependency1.getURL().toExternalForm());

+		Bundle bnd2 = bundleContext.installBundle(dependency2.getURL().toExternalForm());

+		Bundle bnd3 = bundleContext.installBundle(dependency3.getURL().toExternalForm());

+

+		try {

+

+			bnd.start();

+

+			// expect at least 3 events

+			while (eventList.size() < 3) {

+				if (!waitForEvent(TIME_OUT)) {

+					fail("not enough events received after " + TIME_OUT + " ms");

+				}

+			}

+

+			// check the event type and their name (plus the order)

+

+			// simple service 3

+			assertEquals("&simpleService3", getDependencyAt(0).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitStartingEvent.class, getNestedEventAt(0).getClass());

+			// simple service 2

+			assertEquals("&simpleService2", getDependencyAt(1).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitStartingEvent.class, getNestedEventAt(0).getClass());

+			// simple service 1

+			assertEquals("&nested", getDependencyAt(2).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitStartingEvent.class, getNestedEventAt(0).getClass());

+

+			waitForContextStartEvent(bnd1);

+			assertEquals("&nested", getDependencyAt(3).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitEndedEvent.class, getNestedEventAt(3).getClass());

+

+			waitForContextStartEvent(bnd3);

+			assertEquals("&simpleService3", getDependencyAt(4).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitEndedEvent.class, getNestedEventAt(4).getClass());

+			// bnd3 context started event

+

+			waitForContextStartEvent(bnd2);

+			assertEquals("&simpleService2", getDependencyAt(5).getBeanName());

+			assertEquals(OsgiServiceDependencyWaitEndedEvent.class, getNestedEventAt(5).getClass());

+			// bnd2 context started event

+			// wait until the bundle fully starts

+			waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.dependencies");

+			// double check context started event

+

+			// bnd1 context started event

+			System.out.println("Refresh events received are " + refreshEvents);

+

+			while (eventList.size() < 3) {

+				if (!waitForEvent(TIME_OUT)) {

+					fail("not enough events received after " + TIME_OUT + " ms");

+				}

+			}

+			// at least 3 events have to be received

+			assertTrue(refreshEvents.size() >= 3);

+

+			for (BootstrappingDependenciesEvent event : graceEvents) {

+				System.out.println(event.getDependenciesAsFilter());

+			}

+

+		} finally {

+			bnd.uninstall();

+

+			bnd1.uninstall();

+			bnd2.uninstall();

+			bnd3.uninstall();

+		}

+	}

+

+	private OsgiServiceDependency getDependencyAt(int index) {

+		return getNestedEventAt(index).getServiceDependency();

+	}

+

+	private OsgiServiceDependencyEvent getNestedEventAt(int index) {

+		Object obj = eventList.get(index);

+		System.out.println("received object " + obj.getClass() + "|" + obj);

+		BootstrappingDependencyEvent event = (BootstrappingDependencyEvent) obj;

+		return event.getDependencyEvent();

+	}

+

+	private void waitForContextStartEvent(Bundle bundle) throws Exception {

+		int eventNumber = eventList.size();

+		bundle.start();

+		waitOnContextCreation(bundle.getSymbolicName());

+		while (eventList.size() < eventNumber + 1)

+			waitForEvent(TIME_OUT);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/OsgiLifecycleNotificationTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/OsgiLifecycleNotificationTest.java
new file mode 100644
index 0000000..7f8441d
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/event/OsgiLifecycleNotificationTest.java
@@ -0,0 +1,124 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.event;

+

+import java.io.FilePermission;

+import java.util.ArrayList;

+import java.util.List;

+import java.util.PropertyPermission;

+

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextEvent;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleApplicationContextListener;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleContextFailedEvent;

+import org.eclipse.gemini.blueprint.context.event.OsgiBundleContextRefreshedEvent;

+

+/**

+ * Integration test for the appCtx notification mechanism.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class OsgiLifecycleNotificationTest extends AbstractEventTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, extender.listener.bundle," + getSpringDMVersion() };

+	}

+

+	protected void onSetUp() throws Exception {

+		super.onSetUp();

+

+	}

+

+	public void testEventsForCtxThatWork() throws Exception {

+

+		listener = new OsgiBundleApplicationContextListener() {

+

+			public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {

+				if (event instanceof OsgiBundleContextRefreshedEvent) {

+					eventList.add(event);

+					synchronized (lock) {

+						lock.notify();

+					}

+				}

+			}

+		};

+

+		registerEventListener();

+

+		assertTrue("should start with an empty list", eventList.isEmpty());

+		// install a simple osgi bundle and check the list of events

+

+		Resource bundle = getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "simple.service",

+			getSpringDMVersion());

+

+		Bundle bnd = bundleContext.installBundle(bundle.getURL().toExternalForm());

+		try {

+

+			bnd.start();

+

+			assertTrue("no event received", waitForEvent(TIME_OUT));

+			System.out.println("events received " + eventList);

+		}

+		finally {

+			bnd.uninstall();

+		}

+	}

+

+	public void testEventsForCtxThatFail() throws Exception {

+

+		listener = new OsgiBundleApplicationContextListener() {

+

+			public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {

+				if (event instanceof OsgiBundleContextFailedEvent) {

+					eventList.add(event);

+					synchronized (lock) {

+						lock.notify();

+					}

+				}

+			}

+		};

+

+		registerEventListener();

+

+		assertTrue("should start with an empty list", eventList.isEmpty());

+		// install a simple osgi bundle and check the list of events

+

+		Resource bundle = getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "error", getSpringDMVersion());

+

+		Bundle bnd = bundleContext.installBundle(bundle.getURL().toExternalForm());

+

+		try {

+			bnd.start();

+

+			assertTrue("event not received", waitForEvent(TIME_OUT));

+		}

+		finally {

+			bnd.uninstall();

+		}

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));

+		perms.add(new FilePermission("<<ALL FILES>>", "read"));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/ExportImportTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/ExportImportTest.java
new file mode 100644
index 0000000..9df2163
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/ExportImportTest.java
@@ -0,0 +1,42 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.exportimport;

+

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**

+ * @author Costin Leau

+ */

+public class ExportImportTest extends BaseIntegrationTest {

+

+	@Override

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/exportimport/export-import.xml" };

+	}

+

+	public void testCollectionSize() throws Exception {

+		List list = (List) applicationContext.getBean("list");

+		assertEquals(2, list.size());

+		assertEquals(2, Listener.bind);

+	}

+	

+	public void testExportNA() throws Exception {

+		applicationContext.getBean("export-na");

+		System.out.println(Listener.unbind);

+		assertEquals(1, Listener.unbind);		

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/Listener.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/Listener.java
new file mode 100644
index 0000000..2dcd8ba
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/exportimport/Listener.java
@@ -0,0 +1,36 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.exportimport;

+

+import java.util.Map;

+

+/**

+ * 

+ * @author Costin Leau

+ */

+public class Listener {

+	static int bind = 0;

+	static int unbind = 0;

+

+	public void bind(Object service, Map properties) {

+		System.out.println("Binding service hash " + System.identityHashCode(service) + " w/ props " + properties);

+		bind++;

+	}

+

+	public void unbind(Object service, Map properties) {

+		System.out.println("Unbinding service hash " + System.identityHashCode(service) + " w/ props " + properties);

+		unbind++;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderTest.java
new file mode 100644
index 0000000..3e063ac
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderTest.java
@@ -0,0 +1,122 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.extender;

+

+import java.io.FilePermission;

+import java.util.ArrayList;

+import java.util.Iterator;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.Constants;

+import org.osgi.util.tracker.ServiceTracker;

+import org.springframework.context.ApplicationContext;

+import org.springframework.core.io.Resource;

+import org.springframework.util.CollectionUtils;

+

+/**

+ * @author Hal Hildebrand Date: May 21, 2007 Time: 4:43:52 PM

+ */

+public class ExtenderTest extends BaseIntegrationTest {

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	// Overridden to remove the spring extender bundle!
+	protected String[] getTestFrameworkBundlesNames() {

+		String[] bundles = super.getTestFrameworkBundlesNames();

+		List list = new ArrayList(bundles.length);

+

+		// remove extender
+		CollectionUtils.mergeArrayIntoCollection(bundles, list);

+		// additionally remove the annotation bundle as well (if included)
+

+		int bundlesFound = 0;

+		for (Iterator iter = list.iterator(); (iter.hasNext() && (bundlesFound < 2));) {

+			String element = (String) iter.next();

+			if (element.indexOf("extender") >= 0 || element.indexOf("osgi-annotation") >= 0) {

+				iter.remove();

+				bundlesFound++;

+			}

+		}

+

+		return (String[]) list.toArray(new String[list.size()]);

+	}

+

+	// Specifically cannot wait - test scenario has bundles which are spring
+	// powered, but will not be started.
+	protected boolean shouldWaitForSpringBundlesContextCreation() {

+		return false;

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, lifecycle," + getSpringDMVersion() };

+	}

+

+	public void testLifecycle() throws Exception {

+		assertNull("Guinea pig has already been started", System

+				.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.close"));

+

+		StringBuilder filter = new StringBuilder();

+		filter.append("(&");

+		filter.append("(").append(Constants.OBJECTCLASS).append("=").append(ApplicationContext.class.getName()).append(

+				")");

+		filter.append("(").append("org.springframework.context.service.name");

+		filter.append("=").append("org.eclipse.gemini.blueprint.iandt.lifecycle").append(")");

+		filter.append(")");

+		ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter.toString()), null);

+		tracker.open();

+

+		ApplicationContext appContext = (ApplicationContext) tracker.waitForService(1);

+

+		assertNull("lifecycle application context does not exist", appContext);

+

+		Resource extenderResource =

+				getLocator().locateArtifact("org.eclipse.gemini.blueprint", "gemini-blueprint-extender",

+						getSpringDMVersion());

+		assertNotNull("Extender bundle resource", extenderResource);

+		Bundle extenderBundle = bundleContext.installBundle(extenderResource.getURL().toExternalForm());

+		assertNotNull("Extender bundle", extenderBundle);

+

+		extenderBundle.start();

+

+		tracker.open();

+

+		appContext = (ApplicationContext) tracker.waitForService(60000);

+

+		assertNotNull("lifecycle application context exists", appContext);

+

+		assertNotSame("Guinea pig hasn't already been shutdown", "true", System

+				.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.close"));

+

+		assertEquals("Guinea pig started up", "true", System

+				.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.startUp"));

+

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));

+		perms.add(new FilePermission("<<ALL FILES>>", "read"));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderVersionTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderVersionTest.java
new file mode 100644
index 0000000..daab0c0
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/ExtenderVersionTest.java
@@ -0,0 +1,61 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.extender;

+

+import java.awt.Point;

+import java.io.FilePermission;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ExtenderVersionTest extends BaseIntegrationTest {

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	// given bundle should not be picked up by the extender since it expects a

+	// certain version

+	public void testBundleIgnoredBasedOnSpringExtenderVersion() throws Exception {

+

+		String bundleId = "org.eclipse.gemini.blueprint.iandt, extender-version-bundle," + getSpringDMVersion();

+		Resource location = locateBundle(bundleId);

+

+		Bundle bundle = bundleContext.installBundle(location.getURL().toString());

+		assertNotNull(bundle);

+		bundle.start();

+

+		assertTrue(OsgiBundleUtils.isBundleActive(bundle));

+		assertNull("no point should be published ", bundleContext.getServiceReference(Point.class.getName()));

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));

+		perms.add(new FilePermission("<<ALL FILES>>", "read"));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/configuration/ExtenderConfigurationTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/configuration/ExtenderConfigurationTest.java
new file mode 100644
index 0000000..3823dc7
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/extender/configuration/ExtenderConfigurationTest.java
@@ -0,0 +1,96 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.extender.configuration;

+

+import java.util.List;

+import java.util.Properties;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.ServiceReference;

+import org.osgi.service.packageadmin.PackageAdmin;

+import org.springframework.context.ApplicationContext;

+import org.springframework.core.task.TaskExecutor;

+import org.eclipse.gemini.blueprint.test.platform.Platforms;

+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

+import org.springframework.scheduling.timer.TimerTaskExecutor;

+

+/**

+ * Extender configuration fragment.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ExtenderConfigurationTest extends BaseIntegrationTest {

+

+	private ApplicationContext context;

+

+	protected void onSetUp() throws Exception {

+		context = (ApplicationContext) applicationContext.getBean("appCtx");

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,extender-fragment-bundle," + getSpringDMVersion() };

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/extender/configuration/config.xml" };

+	}

+

+	public void testExtenderConfigAppCtxPublished() throws Exception {

+		ServiceReference[] refs =

+				bundleContext.getAllServiceReferences("org.springframework.context.ApplicationContext", null);

+		for (int i = 0; i < refs.length; i++) {

+			System.out.println(OsgiStringUtils.nullSafeToString(refs[i]));

+		}

+		assertNotNull(context);

+	}

+

+	public void tstPackageAdminReferenceBean() throws Exception {

+		if (PackageAdmin.class.hashCode() != 0)

+			;

+		logger.info("Calling package admin bean");

+		assertNotNull(context.getBean("packageAdmin"));

+	}

+

+	public void testShutdownTaskExecutor() throws Exception {

+		assertTrue(context.containsBean("shutdownTaskExecutor"));

+		Object bean = context.getBean("shutdownTaskExecutor");

+		assertTrue("unexpected type", bean instanceof TimerTaskExecutor);

+	}

+

+	public void testTaskExecutor() throws Exception {

+		assertTrue(context.containsBean("taskExecutor"));

+		Object bean = context.getBean("shutdownTaskExecutor");

+		assertTrue("unexpected type", bean instanceof TaskExecutor);

+	}

+

+	public void testCustomProperties() throws Exception {

+		assertTrue(context.containsBean("extenderProperties"));

+		Object bean = context.getBean("extenderProperties");

+		assertTrue("unexpected type", bean instanceof Properties);

+	}

+

+	// felix doesn't support fragments, so disable this test

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return getPlatformName().indexOf("elix") > -1;

+	}

+

+	protected List getTestPermissions() {

+		List list = super.getTestPermissions();

+		list.add(new AdminPermission("*", AdminPermission.METADATA));

+		return list;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/CollectionTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/CollectionTest.java
new file mode 100644
index 0000000..5b3c17a
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/CollectionTest.java
@@ -0,0 +1,45 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.importer;

+

+import java.awt.Shape;

+import java.awt.geom.Area;

+import java.util.Date;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**

+ * @author Costin Leau

+ */

+public class CollectionTest extends BaseIntegrationTest {

+

+	@Override

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/importer/collection.xml" };

+	}

+

+	public void testServiceReferenceCollection() throws Exception {

+		List list = applicationContext.getBean("reference-list", List.class);

+		assertEquals(0, list.size());

+

+		Listener listener = applicationContext.getBean("listener", Listener.class);

+		assertEquals(0, listener.bind.size());

+		Shape shape = new Area();

+		bundleContext.registerService(Shape.class.getName(), shape, null);

+		System.out.println("List is " + list);

+		assertEquals(1, listener.bind.size());

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/Listener.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/Listener.java
new file mode 100644
index 0000000..38db9c1
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/Listener.java
@@ -0,0 +1,43 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.importer;

+

+import java.util.Date;

+import java.util.LinkedHashMap;

+import java.util.Map;

+

+/**

+ * 

+ * @author Costin Leau

+ */

+public class Listener {

+	final Map<Object, Map> bind = new LinkedHashMap<Object, Map>();

+	final Map<Object, Map> unbind = new LinkedHashMap<Object, Map>();

+

+	public void bind(Object service, Map properties) {

+		System.out.println("Binding service hash " + System.identityHashCode(service) + " w/ props " + properties);

+		bind.put(service, properties);

+	}

+	

+	public void bind(Date service, Map properties) {

+		System.out.println("Binding service hash " + System.identityHashCode(service) + " w/ props " + properties);

+		bind.put(service, properties);

+	}

+

+	public void unbind(Object service, Map properties) {

+		System.out.println("Unbinding service hash " + System.identityHashCode(service) + " w/ props " + properties);

+		unbind.put(service, properties);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/ServiceComparatorTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/ServiceComparatorTest.java
new file mode 100644
index 0000000..1a6515c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/importer/ServiceComparatorTest.java
@@ -0,0 +1,179 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.importer;

+

+import java.io.Serializable;

+import java.util.Iterator;

+import java.util.Set;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ServiceComparatorTest extends BaseIntegrationTest {

+

+	private ServiceRegistration registration1, registration2, reg3;

+

+	private Object service1, service2, service3;

+

+	/** load context on each test run */

+	private ConfigurableOsgiBundleApplicationContext context;

+

+

+	public static interface MyInterface extends Comparable, Serializable, Cloneable {

+

+		String value();

+	}

+

+	static class MyClass implements MyInterface, Serializable, Cloneable {

+

+		private String value;

+

+

+		protected Object clone() throws CloneNotSupportedException {

+			return null;

+		}

+

+		public int compareTo(Object o) {

+			MyInterface other = (MyInterface) o;

+			return value.compareTo(other.value());

+		}

+

+		public String value() {

+			return value;

+		}

+

+		MyClass(String value) {

+			this.value = value;

+		}

+

+		public String toString() {

+			return value;

+		}

+

+		public boolean equals(Object obj) {

+			if (obj instanceof MyInterface)

+				return this.compareTo(obj) == 0;

+			return false;

+		}

+

+	}

+

+	static class TestBean {

+

+		private Serializable prop1;

+		private Cloneable prop2;

+		private MyInterface prop3;

+

+

+		public void setProp1(Serializable prop1) {

+			this.prop1 = prop1;

+		}

+

+		public void setProp2(Cloneable prop2) {

+			this.prop2 = prop2;

+		}

+

+		public void setProp3(MyInterface prop3) {

+			this.prop3 = prop3;

+		}

+

+		public Serializable getProp1() {

+			return prop1;

+		}

+

+		public Cloneable getProp2() {

+			return prop2;

+		}

+

+		public MyInterface getProp3() {

+			return prop3;

+		}

+	}

+

+

+	protected void onSetUp() throws Exception {

+		// publish service

+		String[] intfs = new String[] { MyInterface.class.getName(), Serializable.class.getName(),

+			Cloneable.class.getName() };

+

+		service1 = new MyClass("abc");

+		service2 = new MyClass("xyz");

+		service3 = new MyClass("mnp");

+

+		// register the services

+		registration1 = bundleContext.registerService(intfs, service1, null);

+		registration2 = bundleContext.registerService(intfs, service2, null);

+		reg3 = bundleContext.registerService(intfs, service3, null);

+

+		context = loadAppContext();

+	}

+

+	protected void onTearDown() throws Exception {

+		context.close();

+		OsgiServiceUtils.unregisterService(registration1);

+		OsgiServiceUtils.unregisterService(registration2);

+		OsgiServiceUtils.unregisterService(reg3);

+	}

+

+	private ConfigurableOsgiBundleApplicationContext loadAppContext() {

+		OsgiBundleXmlApplicationContext appContext = new OsgiBundleXmlApplicationContext(

+			new String[] { "/org/eclipse/gemini/blueprint/iandt/importer/importer-ordering.xml" });

+		appContext.setBundleContext(bundleContext);

+		appContext.refresh();

+		return appContext;

+	}

+

+	public void testComparableImportedObjects() throws Exception {

+		assertNotNull(context);

+		assertTrue("service 1 is greater then service2", ((Comparable) service1).compareTo(service2) < 0);

+

+		Set set = (Set) context.getBean("setWithServiceOrder");

+		assertEquals(3, set.size());

+		Iterator iter = set.iterator();

+

+		System.out.println(set);

+		assertEquals(service1, iter.next());

+		assertEquals(service3, iter.next());

+		assertEquals(service2, iter.next());

+		assertTrue(service1 instanceof Serializable);

+	}

+

+	public void testServiceReferenceOrderingOnImportedObjects() throws Exception {

+		Set set = (Set) context.getBean("setWithServiceReference");

+		assertNotNull(set);

+		assertEquals(3, set.size());

+		Iterator iter = set.iterator();

+

+		assertEquals(service3, iter.next());

+		assertEquals(service2, iter.next());

+		assertEquals(service1, iter.next());

+	}

+

+	public void testReferenceInjection() throws Exception {

+		TestBean bean = (TestBean) context.getBean("testBean");

+		assertNotNull(bean.getProp1());

+		assertNotNull(bean.getProp2());

+		assertNotNull(bean.getProp3());

+		assertSame(bean.getProp1(), bean.getProp2());

+		assertSame(bean.getProp2(), bean.getProp3());

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BaseIoTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BaseIoTest.java
new file mode 100644
index 0000000..6148e46
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BaseIoTest.java
@@ -0,0 +1,131 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.FilePermission;

+import java.util.ArrayList;

+import java.util.Enumeration;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.ContextResource;

+import org.springframework.core.io.DefaultResourceLoader;

+import org.springframework.core.io.Resource;

+import org.springframework.core.io.ResourceLoader;

+import org.springframework.core.io.support.ResourcePatternResolver;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourceLoader;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Common base test class for IO integration testing.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public abstract class BaseIoTest extends BaseIntegrationTest {

+

+	protected final static String PACKAGE = "org/eclipse/gemini/blueprint/iandt/io/";

+	private static final String FRAGMENT_1 = "org.eclipse.gemini.blueprint.iandt.io.fragment.1";

+	private static final String FRAGMENT_2 = "org.eclipse.gemini.blueprint.iandt.io.fragment.2";

+

+	protected Resource thisClass;

+

+	protected ResourceLoader loader, defaultLoader;

+

+	protected ResourcePatternResolver patternLoader;

+

+	protected Bundle bundle;

+

+

+	protected String[] getBundleContentPattern() {

+		return (String[]) ObjectUtils.addObjectToArray(super.getBundleContentPattern(),

+			"org/eclipse/gemini/blueprint/iandt/io/BaseIoTest.class");

+	}

+

+	protected void onSetUp() throws Exception {

+		// load file using absolute path

+		defaultLoader = new DefaultResourceLoader();

+		thisClass = defaultLoader.getResource(getClass().getName().replace('.', '/').concat(".class"));

+		bundle = bundleContext.getBundle();

+		loader = new OsgiBundleResourceLoader(bundle);

+		patternLoader = new OsgiBundleResourcePatternResolver(loader);

+

+	}

+

+	protected void onTearDown() throws Exception {

+		thisClass = null;

+	}

+

+	protected String getManifestLocation() {

+		// reuse the manifest from Fragment Io Tests

+		return "org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.MF";

+	}

+

+	/**

+	 * Add a bundle fragment.

+	 */

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,io.fragment.1.bundle," + getSpringDMVersion(),

+			"org.eclipse.gemini.blueprint.iandt,io.fragment.2.bundle," + getSpringDMVersion() };

+	}

+

+	protected Object[] copyEnumeration(Enumeration enm) {

+		List list = new ArrayList();

+		while (enm != null && enm.hasMoreElements())

+			list.add(enm.nextElement());

+		return list.toArray();

+	}

+

+	protected void assertResourceArray(Object[] array, int expectedSize) {

+		System.out.println(ObjectUtils.nullSafeToString(array));

+		assertTrue("found only " + ObjectUtils.nullSafeToString(array), array.length == expectedSize);

+	}

+

+	protected boolean isKF() {

+		return (createPlatform().toString().startsWith("Knopflerfish"));

+	}

+

+	protected boolean isEquinox() {

+		return (createPlatform().toString().startsWith("Equinox"));

+	}

+

+	protected boolean isFelix() {

+		return (createPlatform().toString().startsWith("Felix"));

+	}

+

+	protected List getTestPermissions() {

+		List list = super.getTestPermissions();

+		list.add(new FilePermission("<<ALL FILES>>", "read"));

+		// log files

+		list.add(new FilePermission("<<ALL FILES>>", "delete"));

+		list.add(new FilePermission("<<ALL FILES>>", "write"));

+		list.add(new AdminPermission("*", AdminPermission.LISTENER));

+		list.add(new AdminPermission("(name=" + FRAGMENT_1 + ")", AdminPermission.RESOURCE));

+		list.add(new AdminPermission("(name=" + FRAGMENT_2 + ")", AdminPermission.RESOURCE));

+		return list;

+	}

+

+	protected void printPathWithinContext(Resource[] resources) {

+		for (int i = 0; i < resources.length; i++) {

+			Resource resource = resources[i];

+			assertTrue(resource instanceof ContextResource);

+			// Disabled print out

+			//System.out.println("Path within context " + ((ContextResource) resource).getPathWithinContext());

+		}

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleClassPathWildcardTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleClassPathWildcardTest.java
new file mode 100644
index 0000000..7a2d137
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleClassPathWildcardTest.java
@@ -0,0 +1,260 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.IOException;

+import java.io.InputStream;

+import java.net.JarURLConnection;

+import java.net.URL;

+import java.net.URLConnection;

+import java.util.Enumeration;

+import java.util.List;

+import java.util.jar.JarFile;

+import java.util.jar.Manifest;

+

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.Constants;

+import org.springframework.core.io.Resource;

+import org.springframework.core.io.support.ResourcePatternResolver;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Test wildcard matching on bundles with a defined bundle classpath. This is

+ * one of the heaviest IO tests as it involves both a bundle classpath and

+ * fragments.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BundleClassPathWildcardTest extends BaseIoTest {

+

+	private static boolean noRootCPTestBundleInstalled = false;

+	private static final String NO_ROOT_BND_SYM = "org.eclipse.gemini.blueprint.bundle.osgi.io.test.no.root.classpath";

+

+

+	protected Manifest getManifest() {

+		Manifest mf = super.getManifest();

+		// add bundle classpath

+		mf.getMainAttributes().putValue(Constants.BUNDLE_CLASSPATH,

+			".,bundleclasspath/folder/,bundleclasspath/simple.jar,foo");

+		return mf;

+	}

+

+	protected void preProcessBundleContext(BundleContext platformBundleContext) throws Exception {

+		super.preProcessBundleContext(platformBundleContext);

+		if (!noRootCPTestBundleInstalled) {

+			logger.info("Installing no root cp bundle...");

+			InputStream stream = getClass().getResourceAsStream("/norootcpbundle.jar");

+			Bundle bundle = platformBundleContext.installBundle("norootcpbundle", stream);

+			bundle.start();

+			noRootCPTestBundleInstalled = true;

+		}

+	}

+

+	protected String[] getBundleContentPattern() {

+		return (String[]) ObjectUtils.addObjectToArray(super.getBundleContentPattern(), "bundleclasspath/**/*");

+	}

+

+	public void testClassPathFilesOnBundleClassPath() throws Exception {

+		// use org to make sure the bundle class is properly considered (especially for folder based classpath)

+		Resource[] res = patternLoader.getResources("classpath:org/**/*.file");

+		System.out.println("array count is " + res.length);

+		System.out.println(ObjectUtils.nullSafeToString(res));

+		printPathWithinContext(res);

+		assertTrue("bundle classpath jar not considered", containsString(res, "jar-folder.file"));

+	}

+

+	public void testAllClassPathFilesOnBundleClassPath() throws Exception {

+		// use org to make sure the bundle class is properly considered (especially for folder based classpath)

+		Resource[] res = patternLoader.getResources("classpath*:org/**/*.file");

+		System.out.println("array count is " + res.length);

+		System.out.println(ObjectUtils.nullSafeToString(res));

+		printPathWithinContext(res);

+		assertTrue("bundle classpath jar not considered", containsString(res, "jar-folder.file"));

+	}

+

+	public void testRootFileOnBundleClassPath() throws Exception {

+		// use org to make sure the bundle class is properly considered (especially for folder based classpath)

+		Resource[] res = patternLoader.getResources("classpath:*.file");

+		System.out.println("array count is " + res.length);

+		System.out.println(ObjectUtils.nullSafeToString(res));

+		printPathWithinContext(res);

+		assertTrue("bundle classpath jar not considered", containsString(res, "jar.file"));

+	}

+

+	public void testRootFileOnAllBundleClassPath() throws Exception {

+		// use org to make sure the bundle class is properly considered (especially for folder based classpath)

+		Resource[] res = patternLoader.getResources("classpath:*.file");

+		System.out.println("array count is " + res.length);

+

+		System.out.println(ObjectUtils.nullSafeToString(res));

+		printPathWithinContext(res);

+		assertTrue("bundle classpath jar not considered", containsString(res, "jar.file"));

+	}

+

+	private boolean containsString(Resource[] array, String str) throws IOException {

+		for (int i = 0; i < array.length; i++) {

+			Resource resource = array[i];

+			if (resource.getURL().toExternalForm().indexOf(str) > -1)

+				return true;

+		}

+		return false;

+	}

+

+	public void testURLConnectionToJarInsideBundle() throws Exception {

+		Resource jar = patternLoader.getResource("bundleclasspath/simple.jar");

+		testJarConnectionOn(jar);

+	}

+

+	private void testJarConnectionOn(Resource jar) throws Exception {

+		String toString = jar.getURL().toExternalForm();

+		// force JarURLConnection

+		String urlString = "jar:" + toString + "!/";

+		URL newURL = new URL(urlString);

+		System.out.println(newURL);

+		System.out.println(newURL.toExternalForm());

+		URLConnection con = newURL.openConnection();

+		System.out.println(con);

+		System.out.println(con instanceof JarURLConnection);

+		JarURLConnection jarCon = (JarURLConnection) con;

+

+		JarFile jarFile = jarCon.getJarFile();

+		System.out.println(jarFile.getName());

+		Enumeration enm = jarFile.entries();

+		while (enm.hasMoreElements())

+			System.out.println(enm.nextElement());

+	}

+

+	public void testResourceAvailableOnlyInsideJarClasspath() throws Exception {

+		Resource[] resources = patternLoader.getResources("classpath*:jar.file");

+		assertNotNull(resources);

+		System.out.println("Arrays inside the jar");

+		printPathWithinContext(resources);

+		assertEquals(1, resources.length);

+		assertTrue(resources[0].exists());

+	}

+

+	public void testResourceAvailableOnlyInsideFolderClasspath() throws Exception {

+		Resource[] resources = patternLoader.getResources("classpath*:org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file");

+		assertNotNull(resources);

+		assertEquals(1, resources.length);

+		assertTrue(resources[0].exists());

+		System.out.println("Arrays inside the classpath folder");

+		System.out.println(ObjectUtils.nullSafeToString((resources)));

+		printPathWithinContext(resources);

+	}

+

+	public void testResourceAvailableWithPatternOnPathsOnlyInsideFolderClasspath() throws Exception {

+		Resource[] resources = patternLoader.getResources("classpath*:org/eclipse/gemini/blueprint/iandt/**/folder-test.file");

+		assertNotNull(resources);

+		assertEquals(1, resources.length);

+		assertTrue(resources[0].exists());

+		System.out.println(ObjectUtils.nullSafeToString((resources)));

+		printPathWithinContext(resources);

+	}

+

+	public void testResourceAvailableWithPatternOnlyInsideFolderClasspath() throws Exception {

+		Resource[] resources = patternLoader.getResources("classpath:org/eclipse/gemini/blueprint/iandt/**/folder-test.file");

+		assertNotNull(resources);

+		assertEquals(1, resources.length);

+		assertTrue(resources[0].exists());

+		System.out.println(ObjectUtils.nullSafeToString((resources)));

+		printPathWithinContext(resources);

+	}

+

+	private ResourcePatternResolver getNoRootCpBundleResourceResolver() {

+		Bundle bnd = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, NO_ROOT_BND_SYM);

+		assertNotNull("noRootClassPath bundle was not found", bnd);

+		return new OsgiBundleResourcePatternResolver(bnd);

+	}

+

+	public void testNoRootCpBundleResourceInRootNotFound() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath:root.file");

+		// since there is no pattern matching, the loader will return a non-existing resource

+		assertFalse("resource should not be found since / is not in the classpath", res[0].exists());

+		System.out.println("classpath:root.file resources");

+		printPathWithinContext(res);

+	}

+

+	public void testNoRootCpBundleResourceInRootNotFoundOnAllClasspaths() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:root.file");

+		assertTrue("resource should not be found since / is not in the classpath", ObjectUtils.isEmpty(res));

+		System.out.println("root.file resources");

+		System.out.println("classpath*:root.file resources");

+		printPathWithinContext(res);

+	}

+

+	public void testNoRootCpBundleResourceInClassPathFound() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:cp.file");

+		assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));

+		assertTrue("resource should be found since it's on the classpath", res[0].exists());

+		System.out.println("classpath*:cp.file resources");

+		printPathWithinContext(res);

+	}

+

+	public void testNoRootCpBundleResourceNestedInClassPathFound() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:/some/nested/nested.file");

+		assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));

+		assertTrue("resource should be found since it's on the classpath", res[0].exists());

+		System.out.println("classpath*:/some/nested/nested.file resources");

+		printPathWithinContext(res);

+	}

+

+	public void testNoRootCpBundleResourceNestedInPkgInClassPathFound() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:/some/nested/pkg/pkg.file");

+		assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));

+		assertTrue("resource should be found since it's on the classpath", res[0].exists());

+	}

+

+	public void testNoRootCpBundleResourcePatternMatching() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath:/**/*.file");

+		assertEquals("incorrect number of resources found", 3, res.length);

+	}

+

+	public void testNoRootCpBundleResourceMultipleRoots() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:/**/*.file");

+		assertEquals("incorrect number of resources found", 3, res.length);

+	}

+

+	public void testNoRootCpBundleResourcePatternMatchingWithSpecifiedFolder() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath:/some/**/*.file");

+		assertEquals("incorrect number of resources found", 2, res.length);

+	}

+

+	public void testNoRootCpBundleResourceMultipleRootsSpecifiedFolder() throws Exception {

+		ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();

+		Resource[] res = resolver.getResources("classpath*:/some/**/*.file");

+		assertEquals("incorrect number of resources found", 2, res.length);

+	}

+

+	protected List getTestPermissions() {

+		List list = super.getTestPermissions();

+		list.add(new AdminPermission("(name=" + NO_ROOT_BND_SYM + ")", AdminPermission.METADATA));

+		list.add(new AdminPermission("(name=" + NO_ROOT_BND_SYM + ")", AdminPermission.RESOURCE));

+		return list;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest.java
new file mode 100644
index 0000000..2a5cec9
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest.java
@@ -0,0 +1,66 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import org.springframework.core.io.Resource;

+

+/**

+ * Bundle jar tests.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BundleJarTest extends BaseIoTest {

+

+	public void testResourceFromJarOnly() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:/org/eclipse/gemini/blueprint/iandt/io/duplicate.file");

+		assertEquals(1, res.length);

+	}

+

+	public void testResourceFromJarOnlyWithFolderLevelWildcard() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:/**/duplicat*.file");

+		assertEquals(1, res.length);

+	}

+

+	public void testResourceFromFragmentsIgnored() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:/fragment*.file");

+		assertEquals(0, res.length);

+

+	}

+

+	public void testResourceWithWildcardAtFileLevelFromFragmentsIgnored() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:/*.file");

+		assertEquals(0, res.length);

+	}

+

+	// same as above

+	public void testResourceWithWildcardAtFolderLevelFromFragmentsIgnored() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:/**/fragment*.file");

+		assertEquals(0, res.length);

+	}

+

+	// check last modified

+	public void testLastModifiedWhileUsingJustTheOSGiAPI() throws Exception {

+		Resource resource = patternLoader.getResource("osgibundlejar:/org/eclipse/gemini/blueprint/iandt/io/duplicate.file");

+		assertTrue(resource.lastModified() > 0);

+	}

+

+	// wild pattern matching

+	public void testResourcesFromWildCardWithAndWithoutLeadingSlash() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundlejar:**/*");

+		Resource[] res2 = patternLoader.getResources("osgibundlejar:/**/*");

+		assertEquals(res2.length, res.length);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceTest.java
new file mode 100644
index 0000000..0324178
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceTest.java
@@ -0,0 +1,47 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import org.springframework.core.io.Resource;

+

+/**

+ * Classpath tests.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ClassSpaceTest extends BaseIoTest {

+

+	public void testFolder() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/org/eclipse/gemini/blueprint");

+		// EQ returns the fragments paths also

+		assertTrue(res.length >= 1);

+	}

+

+	// META-INF seems to be a special case, since the manifest is added

+	// automatically by the jar stream

+	// but it's the JarCreator which creates the META-INF folder

+	public void testMetaInfFolder() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/META-INF");

+		// Equinox returns more entries (bootpath delegation)

+		assertTrue(res.length >= 1);

+	}

+

+	public void testClass() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceTest.class");

+		assertEquals(1, res.length);

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceWildcardTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceWildcardTest.java
new file mode 100644
index 0000000..fc77f31
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceWildcardTest.java
@@ -0,0 +1,155 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import org.osgi.framework.Constants;

+import org.springframework.core.io.Resource;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ClassSpaceWildcardTest extends BaseIoTest {

+

+	//

+	// Wild-card tests

+	//

+

+	public void testBundleClassPath() throws Exception {

+		System.out.println("*** Bundle-ClassPath is " + bundle.getHeaders().get(Constants.BUNDLE_CLASSPATH));

+		Resource res[] = patternLoader.getResources("classpath*:/org/eclipse/gemini/blueprint/iandt/io/ClassSpaceWildcardTest.class");

+		assertEquals("invalid bundle-classpath entries should be skipped", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	// finds all files at root level

+	public void testWildcardAtRootFileLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/*");

+		// only the bundle and its fragments should be considered (since no other META-INF/ is available on the classpath)

+		assertEquals("not enough packages found", 3, res.length);

+		printPathWithinContext(res);

+	}

+

+	// similar as the root test but inside META-INF

+	public void testWildcardAtFolderLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/META-INF/*");

+		assertEquals("not enough packages found", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testSingleClassWithWildcardAtFileLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/org/eclipse/gemini/blueprint/iandt/io/Class*Test.class");

+		assertTrue("not enough packages found", res.length >= 1);

+		printPathWithinContext(res);

+	}

+

+	public void testClassPathRootWildcard() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/**/blueprint/iandt/io/Class*Test.class");

+		assertTrue("not enough packages found", res.length >= 1);

+	}

+

+	public void testAllClassPathWildcardAtFolderLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:/META-INF/*");

+		// only the bundle and its fragments should be considered (since no other META-INF/ is available on the classpath)

+		assertEquals("not enough packages found", 3, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testAllClassPathWOWildcardAtFolderLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:META-INF/");

+		// only the bundle and its fragments should be considered (since no other META-INF/ is available on the classpath)

+		assertEquals("not enough packages found", 3, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testAllClassPathWithWildcardAtFileLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/org/eclipse/gemini/blueprint/iandt/io/Class*WildcardTest.class");

+		assertEquals("not enough packages found", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testAllClassPathWithWithWildcardAtFileLevel() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:/org/eclipse/gemini/blueprint/iandt/io/Class*WildcardTest.class");

+		assertEquals("not enough packages found", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testAllClassPathRootWildcard() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath:/**/gemini/blueprint/**/ClassSpaceWildcardTest.class");

+		assertEquals("not enough packages found", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	public void testAllClassPathRootWithWildcard() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:/**/gemini/blueprint/**/ClassSpaceWildcardTest.class");

+		assertEquals("not enough packages found", 1, res.length);

+		printPathWithinContext(res);

+	}

+

+	//

+	// Stress tests (as they pull a lot of content)

+	//

+

+	public void testMatchingALotOfClasses() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:/**/gemini/blueprint/iandt/io/*.class");

+		// at least 2 classes should be in there

+		assertTrue("not enough packages found", res.length > 1);

+		printPathWithinContext(res);

+	}

+

+	// EQ = 48

+	// KF = 48

+	// FX = 38

+	public void testMatchingALotOfFolders() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:/**/gemini/blueprint/**");

+		System.out.println("resources count " + res.length);

+		assertTrue("not enough packages found", res.length > 10);

+		printPathWithinContext(res);

+	}

+

+	// ask for everything springframework :)

+	// EQ = 147

+	// KF = 147

+	// FX = 135 (no fragment support)

+	public void testMatchingABulkOfResources() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:**/springframework/**");

+		Resource resWitSlash[] = patternLoader.getResources("classpath*:/**/springframework/**");

+		System.out.println("resources w/o slash count " + res.length);

+		System.out.println("resources w/ slash count " + resWitSlash.length);

+		assertEquals("slash should not make a difference", res.length, resWitSlash.length);

+		assertTrue("not enough packages found", res.length > 50);

+		printPathWithinContext(res);

+	}

+

+	// ask for everything org :)

+	// EQ = 271 (since it considers the system bundle also)

+	// KF = 147 (doesn't consider system bundle)

+	// FX = 135

+	public void testMatchingAHugeSetOfResources() throws Exception {

+		Resource res[] = patternLoader.getResources("classpath*:org/**");

+		Resource resWitSlash[] = patternLoader.getResources("classpath*:/org/**");

+		System.out.println("resources w/o slash count " + res.length);

+		System.out.println("resources w/ slash count " + resWitSlash.length);

+		assertEquals("slash should not make a difference", res.length, resWitSlash.length);

+		assertTrue("not enough packages found", res.length > 100);

+		printPathWithinContext(res);

+	}

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		// felix doesn't support fragments yet

+		return (isFelix() && (testMethodName.equals("testAllClassPathWildcardAtFolderLevel")

+				|| testMethodName.equals("testWildcardAtRootFileLevel") || testMethodName.equals("testAllClassPathWOWildcardAtFolderLevel")));

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/EquinoxFileTests.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/EquinoxFileTests.java
new file mode 100644
index 0000000..0ebe5a3
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/EquinoxFileTests.java
@@ -0,0 +1,64 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.File;

+import java.net.URL;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.springframework.core.io.Resource;

+import org.springframework.core.io.support.ResourcePatternResolver;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class EquinoxFileTests extends BaseIoTest {

+

+	private static final String REFERENCE_PROTOCOL = "reference:file:";

+	private static final String EXPANDED_BUNDLE_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.io.expanded.bundle";

+

+

+	public void testResolveResourceWithFilePrefix() throws Exception {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, EXPANDED_BUNDLE_SYM_NAME);

+		assertTrue(bundle.getLocation().startsWith(REFERENCE_PROTOCOL));

+		ResourcePatternResolver resolver = new OsgiBundleResourcePatternResolver(bundle);

+		Resource res = resolver.getResource("resource.res");

+		assertTrue(res.getFile().exists());

+	}

+

+	public void testResolveResourceWithReferenceFilePrefix() throws Exception {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, EXPANDED_BUNDLE_SYM_NAME);

+		assertTrue(bundle.getLocation().startsWith(REFERENCE_PROTOCOL));

+		assertNotNull(new URL(bundle.getLocation()).getFile());

+		ResourcePatternResolver resolver = new OsgiBundleResourcePatternResolver(bundle);

+		Resource res = resolver.getResource("/META-INF/MANIFEST.MF");

+		assertTrue(res.getFile().exists());

+	}

+

+	protected void postProcessBundleContext(BundleContext context) throws Exception {

+		super.postProcessBundleContext(context);

+		File expandedBundle = new File(".", "target/test-classes/expanded-bundle.jar");

+		System.out.println("Installing expanded bundle from " + expandedBundle.getCanonicalPath());

+		context.installBundle(REFERENCE_PROTOCOL + expandedBundle.getCanonicalPath());

+	}

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return !isEquinox();

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.java
new file mode 100644
index 0000000..f84cb71
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.java
@@ -0,0 +1,195 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.util.Dictionary;

+

+import org.osgi.framework.Bundle;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * IO tests related to fragments.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class FragmentIoTests extends BaseIoTest {

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return isFelix();

+	}

+

+	public void testFileWithTheSameNameInOwningBundleAndAttachedFragment() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "duplicate.file");

+		assertTrue("file with the same name available in bundles are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameInOwningBundleAndAttachedFragmentWithMatchingAtFileLevel() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "dupli*.file");

+		System.out.println(ObjectUtils.nullSafeToString(fragmentResource));

+		assertTrue("file with the same name available in bundles are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameInOwningBundleAndAttachedFragmentWithMatchingAtFileLevelOn1Char()

+			throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "duplic?te.file");

+		assertTrue("file with the same name available in bundles are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameInOwningBundleAndAttachedFragmentWithMatchingAtFolderLevel() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/org/eclipse/gemini/**/*.file");

+		assertTrue("file with the same name available in bundles are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileLevelWildCardMatchingIncludingFragmentResources() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "*.file");

+

+		// 1 in each attached bundle

+		assertTrue(fragmentResource.length > 1);

+	}

+

+	public void testFileLevelMatchingJustFragments() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/fragment*.file");

+

+		// we have at least one duplicates in two bundles

+		assertTrue(fragmentResource.length > 1);

+	}

+

+	public void testFileOnlyInOneFragment() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/fragment1.file");

+		assertEquals(1, fragmentResource.length);

+	}

+

+	public void testFileOnlyInAnotherFragment() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/fragment2.file");

+		assertEquals(1, fragmentResource.length);

+	}

+

+	public void testFileWithTheSameNameOnlyInAttachedFragmentsOnly() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "fragment-duplicate.file");

+		// should find at least 2

+		assertTrue("files with the same name available in attached fragments are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameOnlyInAttachedFragmentsOnlyWithMatchingAtFileLevel() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "fragment-dupli*.file");

+		// should find at least 2

+		assertTrue("files with the same name available in attached fragments are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameOnlyInAttachedFragmentsOnlyWithMatchingAtFileLevelOnOneChar() throws Exception {

+		Resource[] fragmentResource = patternLoader.getResources("osgibundle:/" + PACKAGE + "fragment-duplic?t?.file");

+		// should find at least 2

+		assertTrue("files with the same name available in attached fragments are ignored", fragmentResource.length > 1);

+	}

+

+	public void testFileWithTheSameNameOnlyInAttachedFragmentsOnlyWithMatchingAtFolderLevel() throws Exception {

+		Resource[] fragmentResource =

+				patternLoader.getResources("osgibundle:/org/eclipse/**/fragment-duplicate.file");

+		// should find at least 2

+		assertTrue("files with the same name available in attached fragments are ignored", fragmentResource.length > 1);

+	}

+

+	public void testGetRootInBundleAndFragments() throws Exception {

+		Resource[] res = patternLoader.getResources("/");

+		assertTrue(res.length > 1);

+		res = patternLoader.getResources("osgibundle:/");

+		assertTrue("found only " + ObjectUtils.nullSafeToString(res), res.length > 1);

+	}

+

+	public void testFileLevelWildcardMatching() throws Exception {

+		// find res files

+		Resource[] res = patternLoader.getResources("osgibundle:/" + PACKAGE + "*.res");

+		assertEquals("found only " + ObjectUtils.nullSafeToString(res), 2, res.length);

+	}

+

+	public void testFileLevelPatternMatching() throws Exception {

+		// find just this class

+		Resource[] res = patternLoader.getResources("osgibundle:/" + PACKAGE + "IoTe*.class");

+		// should find only 1

+		assertEquals("found only " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testFileLevelCharPatternMatchingForOneChar() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundle:" + PACKAGE + "IoTe*ts.class");

+		// should find only 1

+		assertEquals("found only " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testFileLevelCharMatching() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundle:" + PACKAGE + "IoTe?ts.class");

+		// should find only 1

+		assertEquals("found only " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testFileLevelDoubleCharMatching() throws Exception {

+		Resource[] res = patternLoader.getResources("osgibundle:" + PACKAGE + "IoTe??s.class");

+		// should find only 1

+		assertEquals("found only " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+	public void testFolderLevelWildcardMatching() throws Exception {

+		// find all classes

+		Resource[] res = patternLoader.getResources("osgibundle:/**/io/*.class");

+		assertTrue("found only " + ObjectUtils.nullSafeToString(res), res.length > 3);

+	}

+

+	public void testNoPrefixMeansBundlePrefixOnClasses() throws Exception {

+		Resource[] wPrefix = patternLoader.getResources("osgibundle:**/*.class");

+		Resource[] woPrefix = patternLoader.getResources("**/*.class");

+

+		assertTrue(ObjectUtils.nullSafeEquals(wPrefix, woPrefix));

+	}

+

+	public void testNoPrefixMeansBundlePrefixOnFiles() throws Exception {

+		Resource[] wPrefix = patternLoader.getResources("osgibundle:**/*.res");

+		Resource[] woPrefix = patternLoader.getResources("**/*.res");

+

+		assertTrue(ObjectUtils.nullSafeEquals(wPrefix, woPrefix));

+	}

+

+	public void testClassPathFileLevelMatching() throws Exception {

+		// find this classe

+		Resource[] res = patternLoader.getResources("classpath:/" + PACKAGE + "FragmentIoTests.class");

+		assertEquals(1, res.length);

+	}

+

+	public void testFragmentAndHostHeaderMerging() throws Exception {

+		Dictionary hostHeaders = bundle.getHeaders();

+		assertNull(hostHeaders.get("Fragment-Header"));

+		assertNull(hostHeaders.get("Fragment1-Header"));

+		assertNull(hostHeaders.get("Fragment2-Header"));

+	}

+

+	public void testFragment1Headers() throws Exception {

+		Bundle fragment1 =

+				OsgiBundleUtils.findBundleBySymbolicName(bundleContext, "org.eclipse.gemini.blueprint.iandt.io.fragment.1");

+		Dictionary fragment1Headers = fragment1.getHeaders();

+		assertNotNull(fragment1Headers.get("Fragment-Header"));

+		assertNotNull(fragment1Headers.get("Fragment1-Header"));

+		assertNull(fragment1Headers.get("Fragment2-Header"));

+	}

+	

+	public void testFragment2Headers() throws Exception {

+		Bundle fragment1 =

+				OsgiBundleUtils.findBundleBySymbolicName(bundleContext, "org.eclipse.gemini.blueprint.iandt.io.fragment.2");

+		Dictionary fragment1Headers = fragment1.getHeaders();

+		assertNotNull(fragment1Headers.get("Fragment-Header"));

+		assertNull(fragment1Headers.get("Fragment1-Header"));

+		assertNotNull(fragment1Headers.get("Fragment2-Header"));

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/InvalidLocationsTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/InvalidLocationsTest.java
new file mode 100644
index 0000000..a08bb86
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/InvalidLocationsTest.java
@@ -0,0 +1,85 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.IOException;

+

+import org.springframework.core.io.DefaultResourceLoader;

+import org.springframework.core.io.Resource;

+import org.springframework.core.io.ResourceLoader;

+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

+import org.springframework.core.io.support.ResourcePatternResolver;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourceLoader;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class InvalidLocationsTest extends BaseIoTest {

+	private static final String NON_EXISTING = "/non-existing";

+

+	private ResourceLoader osgiRL;

+

+	private ResourcePatternResolver osgiRPR;

+

+	protected void onSetUp() throws Exception {

+		super.onSetUp();

+		osgiRL = new OsgiBundleResourceLoader(bundle);

+		osgiRPR = new OsgiBundleResourcePatternResolver(bundle);

+	}

+

+	protected void onTearDown() throws Exception {

+		super.onTearDown();

+		osgiRL = null;

+		osgiRPR = null;

+	}

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	protected String[] getTestBundlesNames() {

+		return null;

+	}

+

+	public void testDefaultClassLoader() throws Exception {

+		testOneResource(new DefaultResourceLoader());

+	}

+

+	public void testOsgiResourceLoader() throws Exception {

+		testOneResource(osgiRL);

+	}

+

+	private void testOneResource(ResourceLoader loader) {

+		Resource res = loader.getResource(NON_EXISTING);

+		assertFalse(res.exists());

+	}

+

+	public void testDefaultPatternResourceLoader() throws Exception {

+		testMultipleResources(new PathMatchingResourcePatternResolver());

+	}

+

+	public void testPatternResourceLoader() throws Exception {

+		testMultipleResources(osgiRPR);

+	}

+

+	private void testMultipleResources(ResourcePatternResolver loader) throws IOException {

+		Resource[] res = loader.getResources(NON_EXISTING);

+		assertEquals("invalid resource array " + ObjectUtils.nullSafeToString(res), 1, res.length);

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/IoTests.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/IoTests.java
new file mode 100644
index 0000000..ea90f07
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/IoTests.java
@@ -0,0 +1,67 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import org.springframework.core.io.Resource;

+

+/**

+ * Test to check if loading of files outside of the OSGi world (directly from

+ * the filesystem is possible).

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class IoTests extends BaseIoTest {

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	/**

+	 * Add a bundle fragment.

+	 */

+	protected String[] getTestBundlesNames() {

+		return null;

+	}

+

+	public void testFileOutsideOSGi() throws Exception {

+		String fileLocation = "file:///" + thisClass.getFile().getAbsolutePath();

+		// use file system resource defaultLoader

+		Resource fileResource = defaultLoader.getResource(fileLocation);

+		assertTrue(fileResource.exists());

+

+		// try loading the file using OsgiBundleResourceLoader

+		Resource osgiResource = resourceLoader.getResource(fileLocation);

+		// check existence of the same file when loading through the

+		// OsgiBundleRL

+		// NOTE andyp -- we want this to work!!

+		assertTrue(osgiResource.exists());

+

+		assertEquals(fileResource.getURL(), osgiResource.getURL());

+	}

+

+	public void testNonExistentFileOutsideOSGi() throws Exception {

+		String nonExistingLocation = thisClass.getURL().toExternalForm().concat("-bogus-extension");

+

+		Resource nonExistingFile = defaultLoader.getResource(nonExistingLocation);

+		assertNotNull(nonExistingFile);

+		assertFalse(nonExistingFile.exists());

+

+		Resource nonExistingFileOutsideOsgi = resourceLoader.getResource(nonExistingLocation);

+		assertNotNull(nonExistingFileOutsideOsgi);

+		assertFalse(nonExistingFileOutsideOsgi.exists());

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI723Test.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI723Test.java
new file mode 100644
index 0000000..3ad427b
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI723Test.java
@@ -0,0 +1,117 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.File;

+import java.io.FileOutputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.OutputStream;

+import java.net.URL;

+import java.util.Enumeration;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.eclipse.gemini.blueprint.test.platform.OsgiPlatform;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiStringUtils;

+import org.springframework.util.FileCopyUtils;

+

+/**

+ * @author Costin Leau

+ */

+public class OSGI723Test extends BaseIoTest {

+

+	private static boolean bundleInstalled = false;

+	private static final String SLASH = "/";

+

+

+	/**

+	 * Add a bundle fragment.

+	 */

+	protected String[] getTestBundlesNames() {

+		return new String[0];

+	}

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	protected void preProcessBundleContext(BundleContext platformBundleContext) throws Exception {

+		super.preProcessBundleContext(platformBundleContext);

+		if (!bundleInstalled) {

+			logger.info("Installing OSGi-723 bundle...");

+			InputStream stream = getClass().getResourceAsStream("/osgi-723.jar");

+			Bundle bundle = platformBundleContext.installBundle("osgi-723", stream);

+			bundle.start();

+			bundleInstalled = true;

+		}

+	}

+

+	public static void unpackBundle(Bundle bundle, File targetFolder) {

+		// no need to use a recursive method since we get all resources directly

+		Enumeration enm = bundle.findEntries(SLASH, null, true);

+		while (enm != null && enm.hasMoreElements()) {

+

+			// get only the path

+			URL url = (URL) enm.nextElement();

+			String entryPath = url.getPath();

+			if (entryPath.startsWith(SLASH))

+				entryPath = entryPath.substring(1);

+

+			File targetFile = new File(targetFolder, entryPath);

+			// folder are a special case, we have to create them rather then copy

+			if (entryPath.endsWith("/"))

+				targetFile.mkdirs();

+			else {

+				try {

+					File parent = targetFile.getParentFile();

+					if (!parent.exists()) {

+						parent.mkdirs();

+					}

+					System.out.println(parent);

+

+					OutputStream targetStream = new FileOutputStream(targetFile);

+					System.err.println("Copying " + url + " to " + targetFile);

+					FileCopyUtils.copy(url.openStream(), targetStream);

+				}

+				catch (IOException ex) {

+					//

+					System.err.println("Cannot copy resource " + entryPath + ex);

+					throw (RuntimeException) new IllegalStateException("IO exception while unpacking bundle "

+							+ OsgiStringUtils.nullSafeNameAndSymName(bundle)).initCause(ex);

+				}

+				// no need to close the streams - the utils already handles that

+			}

+		}

+	}

+

+	public void testSpecialBundle() throws Exception {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, "issue.osgi-723");

+		System.out.println(bundle);

+

+		File tmpFile = File.createTempFile("tomcat-bla", ".osgi");

+		tmpFile.delete();

+		tmpFile.mkdir();

+

+		unpackBundle(bundle, tmpFile);

+	}

+

+	protected OsgiPlatform createPlatform() {

+		OsgiPlatform platform = super.createPlatform();

+		platform.getConfigurationProperties().setProperty("felix.fragment.validation", "warning");

+		return platform;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI799Test.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI799Test.java
new file mode 100644
index 0000000..ef8ac0c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/io/OSGI799Test.java
@@ -0,0 +1,136 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.io;

+

+import java.io.InputStream;

+import java.net.URL;

+import java.util.Arrays;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.springframework.core.io.Resource;

+import org.springframework.core.io.ResourceLoader;

+import org.springframework.core.io.support.ResourcePatternResolver;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourceLoader;

+import org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Integration test based on the bug report OSGI-799 regarding discovery of imported packages from the exporting bundle

+ * w/o considering their bundle classpath.

+ * 

+ * The test will install two bundle, one with a custom classpath exporting a package and the other importing that

+ * particular package.

+ * 

+ * @author Costin Leau

+ */

+public class OSGI799Test extends BaseIoTest {

+

+	private static boolean customBundlesInstalled = false;

+	private static final String EXPORT_BND = "org.eclipse.gemini.blueprint.bundle.osgi.io.test.osgi799.exp";

+	private static final String IMPORT_BND = "org.eclipse.gemini.blueprint.bundle.osgi.io.test.osgi799.imp";

+

+	/**

+	 * No dependencies installed (we'll do this manually for this test).

+	 */

+	protected String[] getTestBundlesNames() {

+		return new String[0];

+	}

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	protected void preProcessBundleContext(BundleContext platformBundleContext) throws Exception {

+		super.preProcessBundleContext(platformBundleContext);

+		if (!customBundlesInstalled) {

+			logger.info("Installing custom bundles...");

+			InputStream stream = getClass().getResourceAsStream("/osgi-799-exp.jar");

+			assertNotNull(stream);

+			Bundle bundle = platformBundleContext.installBundle("osgi-799-exp", stream);

+			bundle.start();

+

+			stream = getClass().getResourceAsStream("/osgi-799-imp.jar");

+			bundle = platformBundleContext.installBundle("osgi-799-imp", stream);

+			bundle.start();

+

+			customBundlesInstalled = true;

+		}

+	}

+

+	protected String[] getBundleContentPattern() {

+		return (String[]) ObjectUtils.addObjectToArray(super.getBundleContentPattern(), "bundleclasspath/**/*");

+	}

+

+	/**

+	 * Resolves the pattern resolved for the exporting bundle using a custom classpath.

+	 * 

+	 * @return

+	 */

+	protected ResourcePatternResolver getExporterPatternLoader() {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, EXPORT_BND);

+		ResourceLoader loader = new OsgiBundleResourceLoader(bundle);

+		return new OsgiBundleResourcePatternResolver(loader);

+	}

+

+	protected ResourcePatternResolver getImporterPatternLoader() {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, IMPORT_BND);

+		ResourceLoader loader = new OsgiBundleResourceLoader(bundle);

+		return new OsgiBundleResourcePatternResolver(loader);

+	}

+

+	public void testExportedCustomCP() throws Exception {

+		ResourcePatternResolver resolver = getExporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:/some/**/*.res");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(3, resources.length);

+	}

+

+	public void testImportedCustomCP() throws Exception {

+		ResourcePatternResolver resolver = getImporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:some/**/*.res");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(3, resources.length);

+	}

+	

+	public void testExportedCustomFoldersCP() throws Exception {

+		ResourcePatternResolver resolver = getExporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:/**/path/**/*");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(8, resources.length);

+	}

+	

+	public void testImporterCustomFoldersCP() throws Exception {

+		ResourcePatternResolver resolver = getImporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:/**/path/**/*");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(5, resources.length);

+	}

+

+	public void testExportedCustomPatternFoldersCP() throws Exception {

+		ResourcePatternResolver resolver = getExporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:/**/p?th/**/*");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(8, resources.length);

+	}

+	

+	public void testImporterCustomPatternFoldersCP() throws Exception {

+		ResourcePatternResolver resolver = getImporterPatternLoader();

+		Resource[] resources = resolver.getResources("classpath:/**/p?th/**/*");

+		System.out.println(Arrays.toString(resources));

+		assertEquals(5, resources.length);

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/BridgeMethodTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/BridgeMethodTest.java
new file mode 100644
index 0000000..74b04e8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/BridgeMethodTest.java
@@ -0,0 +1,51 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.bridgemethods;

+

+import java.awt.Shape;

+import java.awt.geom.Area;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+

+/**

+ * Integration test for listeners with bridge methods.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BridgeMethodTest extends BaseIntegrationTest {

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/config.xml" };

+	}

+

+	public void testGenerifiedListener() throws Exception {

+		assertEquals(Listener.BIND_CALLS, 0);

+		assertEquals(Listener.UNBIND_CALLS, 1);

+

+		// register a point

+		ServiceRegistration reg = bundleContext.registerService(Shape.class.getName(), new Area(), null);

+		List list = (List) applicationContext.getBean("collection");

+		assertEquals(1, list.size());

+		assertEquals(Listener.BIND_CALLS, 1);

+		assertEquals(Listener.UNBIND_CALLS, 1);

+

+		reg.unregister();

+		assertEquals(Listener.BIND_CALLS, 1);

+		assertEquals(Listener.UNBIND_CALLS, 2);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/GenerifiedListenerInterface.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/GenerifiedListenerInterface.java
new file mode 100644
index 0000000..4ccfc05
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/GenerifiedListenerInterface.java
@@ -0,0 +1,24 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.bridgemethods;

+

+import java.util.Map;

+

+public interface GenerifiedListenerInterface<T> {

+

+	void bind(T service, Map<String, ?> properties);

+

+	void unbind(T service, Map<String, ?> properties);

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/Listener.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/Listener.java
new file mode 100644
index 0000000..7eb5efb
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/Listener.java
@@ -0,0 +1,40 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.bridgemethods;

+

+import java.awt.Shape;

+import java.util.Map;

+

+/**

+ * Generified listener causing bridged methods to be created.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class Listener implements GenerifiedListenerInterface<Shape> {

+

+	public static int BIND_CALLS = 0;

+	public static int UNBIND_CALLS = 0;

+

+	public void bind(Shape service, Map<String, ?> properties) {

+		System.out.println("calling bind");

+		BIND_CALLS++;

+	}

+

+	public void unbind(Shape service, Map<String, ?> properties) {

+		System.out.println("calling unbind");

+		UNBIND_CALLS++;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/ComponentBean.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/ComponentBean.java
new file mode 100644
index 0000000..5099fbb
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/ComponentBean.java
@@ -0,0 +1,79 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.componentscanning;

+

+import java.awt.Shape;

+

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Component;

+

+/**

+ * Just a Spring component that relies on Spring annotations for injection.

+ * 

+ * @author Costin Leau

+ */

+@Component

+public class ComponentBean {

+

+	private Shape constructorInjection;

+	@Autowired

+	private Shape fieldInjection;

+

+	private Shape setterInjection;

+

+	@Autowired

+	public ComponentBean(Shape Shape) {

+		this.constructorInjection = Shape;

+	}

+

+	public ComponentBean() {

+		// this.constructorShape = Shape;

+	}

+

+	/**

+	 * Returns the constructorInjection.

+	 * 

+	 * @return Returns the constructorInjection

+	 */

+	public Shape getConstructorInjection() {

+		return constructorInjection;

+	}

+

+	/**

+	 * Returns the fieldInjection.

+	 * 

+	 * @return Returns the fieldInjection

+	 */

+	public Shape getFieldInjection() {

+		return fieldInjection;

+	}

+

+	/**

+	 * Returns the setterInjection.

+	 * 

+	 * @return Returns the setterInjection

+	 */

+	public Shape getSetterInjection() {

+		return setterInjection;

+	}

+

+	/**

+	 * @param setterInjection The setterInjection to set.

+	 */

+	@Autowired

+	public void setSetterInjection(Shape injection) {

+		this.setterInjection = injection;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/OrderedComponentScanningTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/OrderedComponentScanningTest.java
new file mode 100644
index 0000000..1dfc94c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/OrderedComponentScanningTest.java
@@ -0,0 +1,77 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.componentscanning;

+

+import java.awt.Shape;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**

+ * @author Costin Leau

+ */

+public class OrderedComponentScanningTest extends BaseIntegrationTest {

+

+	private static final String BEAN_NAME = "componentBean";

+

+	private ComponentBean bean;

+

+	private Shape shape;

+

+	@Override

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, sync-tail-bundle," + getSpringDMVersion() };

+	}

+

+	public void testComponentExistence() throws Exception {

+		assertTrue("component not found", applicationContext.containsBean(BEAN_NAME));

+		assertNotNull("component not injected in the test", bean);

+		assertNotNull("shape not injected in the test", shape);

+	}

+

+	public void testAutowireInjection() throws Exception {

+		assertNotNull(bean.getSetterInjection());

+		assertNotNull(bean.getConstructorInjection());

+		assertNotNull(bean.getFieldInjection());

+	}

+

+	public void testInjectionIdentity() throws Exception {

+		assertSame(shape, bean.getSetterInjection());

+		assertSame(shape, bean.getConstructorInjection());

+		assertSame(shape, bean.getFieldInjection());

+	}

+

+	@Override

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/context.xml" };

+	}

+

+	/**

+	 * @param bean The bean to set.

+	 */

+	public void setBean(ComponentBean bean) {

+		this.bean = bean;

+	}

+

+	/**

+	 * @param shape The shape to set.

+	 */

+	public void setShape(Shape shape) {

+		this.shape = shape;

+	}

+

+	protected boolean createManifestOnlyFromTestClass() {

+		return false;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/io/ComponentScanTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/io/ComponentScanTest.java
new file mode 100644
index 0000000..329fab8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/jdk5/io/ComponentScanTest.java
@@ -0,0 +1,42 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.jdk5.io;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.eclipse.gemini.blueprint.iandt.io.component.ComponentBean;

+

+/**

+ * Integration test for Spring 2.5 component scan.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ComponentScanTest extends BaseIntegrationTest {

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/jdk5/io/component-scan.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,component.scan.bundle," + getSpringDMVersion() };

+	}

+

+	public void testComponentScan() throws Exception {

+		// force an import on component bean

+		assertNotNull(ComponentBean.class);

+		assertTrue("component scan did not pick up all classes", applicationContext.containsBean("bean"));

+		assertTrue("component scan did not pick up all classes", applicationContext.containsBean("componentBean"));

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/lifecycle/LifecycleTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/lifecycle/LifecycleTest.java
new file mode 100644
index 0000000..bd6a224
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/lifecycle/LifecycleTest.java
@@ -0,0 +1,95 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.util.tracker.ServiceTracker;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractRefreshableApplicationContext;
+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;
+
+/**
+ * @author Hal Hildebrand Date: Oct 15, 2006 Time: 5:51:36 PM
+ */
+public class LifecycleTest extends BaseIntegrationTest {
+
+	protected String getManifestLocation() {
+		return null;
+	}
+
+	protected String[] getTestBundlesNames() {
+		return new String[] { "org.eclipse.gemini.blueprint.iandt,lifecycle," + getSpringDMVersion() };
+	}
+
+	public void testLifecycle() throws Exception {
+		assertNotSame("Guinea pig has already been shutdown", "true",
+			System.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.close"));
+
+		assertEquals("Guinea pig didn't startup", "true",
+			System.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.startUp"));
+		Bundle[] bundles = bundleContext.getBundles();
+		Bundle testBundle = null;
+		for (int i = 0; i < bundles.length; i++) {
+			if ("org.eclipse.gemini.blueprint.iandt.lifecycle".equals(bundles[i].getSymbolicName())) {
+				testBundle = bundles[i];
+				break;
+			}
+		}
+
+		assertNotNull("Could not find the test bundle", testBundle);
+		StringBuilder filter = new StringBuilder();
+		filter.append("(&");
+		filter.append("(").append(Constants.OBJECTCLASS).append("=").append(ApplicationContext.class.getName()).append(
+			")");
+		filter.append("(").append(ConfigurableOsgiBundleApplicationContext.APPLICATION_CONTEXT_SERVICE_PROPERTY_NAME);
+		filter.append("=").append(testBundle.getSymbolicName()).append(")");
+		filter.append(")");
+		ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter(filter.toString()), null);
+		try {
+
+			tracker.open();
+
+			AbstractRefreshableApplicationContext appContext = (AbstractRefreshableApplicationContext) tracker.waitForService(30000);
+			assertNotNull("test application context", appContext);
+			assertTrue("application context is active", appContext.isActive());
+
+			testBundle.stop();
+			while (testBundle.getState() == Bundle.STOPPING) {
+				Thread.sleep(10);
+			}
+			assertEquals("Guinea pig didn't shutdown", "true",
+				System.getProperty("org.eclipse.gemini.blueprint.iandt.lifecycle.GuineaPig.close"));
+
+			assertFalse("application context is inactive", appContext.isActive());
+		}
+		finally {
+			tracker.close();
+		}
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.java
new file mode 100644
index 0000000..dbad470
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.java
@@ -0,0 +1,111 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.mavenArtifact;
+
+import java.io.FilePermission;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.MyListener;
+import org.eclipse.gemini.blueprint.iandt.cardinality0to1.test.ReferenceContainer;
+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;
+
+/**
+ * @author Hal Hildebrand
+ *         Date: Mar 5, 2007
+ *         Time: 6:00:39 PM
+ */
+
+/**
+ * This test ensures that Maven artifact lookup is maintained. Note that all
+ * Maven artifact lookups are explicity using the type of the artifact - a
+ * property of the artifact resolution that we need to preserve.
+ */
+public class MavenArtifactLookupTest extends BaseIntegrationTest {
+
+	protected String getManifestLocation() {
+		// return
+		// "classpath:org.eclipse.gemini.blueprint.test/mavenArtifact/MavenArtifactLookupTest.MF";
+		return null;
+	}
+
+	protected String[] getTestBundlesNames() {
+		return new String[] { "org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion(),
+			"org.eclipse.gemini.blueprint.iandt, cardinality0to1," + getSpringDMVersion() };
+	}
+
+	public void test0to1Cardinality() throws Exception {
+
+		Bundle simpleService2Bundle = bundleContext.installBundle(getLocator().locateArtifact(
+			"org.eclipse.gemini.blueprint.iandt", "simple.service2", getSpringDMVersion(), "jar").getURL().toExternalForm());
+
+		assertNotNull("Cannot find the simple service 2 bundle", simpleService2Bundle);
+
+		assertNotSame("simple service 2 bundle is in the activated state!", new Integer(Bundle.ACTIVE), new Integer(
+			simpleService2Bundle.getState()));
+
+		assertEquals("Unxpected initial binding of service", 0, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected initial unbinding of service", 1, MyListener.UNBOUND_COUNT);
+		assertNotNull("Service reference should be not null", ReferenceContainer.service);
+
+		try {
+			ReferenceContainer.service.stringValue();
+			fail("Service should be unavailable");
+		}
+		catch (ServiceUnavailableException e) {
+			// expected
+		}
+
+		startDependency(simpleService2Bundle);
+
+		assertEquals("Expected initial binding of service", 1, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected initial unbinding of service", 1, MyListener.UNBOUND_COUNT);
+		assertNotNull("Service reference should be not null", ReferenceContainer.service);
+
+		assertNotNull(ReferenceContainer.service.stringValue());
+
+	}
+
+	private void startDependency(Bundle simpleService2Bundle) throws BundleException, InterruptedException {
+		System.out.println("Starting dependency");
+		simpleService2Bundle.start();
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice2");
+
+		System.out.println("Dependency started");
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new FilePermission("<<ALL FILES>>", "read"));
+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));
+		return perms;
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/namespace/EmbeddedNamespaceLibraryTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/namespace/EmbeddedNamespaceLibraryTest.java
new file mode 100644
index 0000000..4205d87
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/namespace/EmbeddedNamespaceLibraryTest.java
@@ -0,0 +1,70 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.namespace;

+

+import java.net.URL;

+import java.util.jar.Manifest;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.Constants;

+import org.springframework.beans.factory.xml.NamespaceHandlerResolver;

+import org.springframework.util.ObjectUtils;

+

+/**

+ * Integration test for libraries (that contain Spring namespaces) that are

+ * embedded inside bundles which use their namespaces. Since the library is not

+ * deployed as a bundle, other bundles should not see the namespace but the

+ * bundle embedding it, should.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class EmbeddedNamespaceLibraryTest extends BaseIntegrationTest {

+

+	protected Manifest getManifest() {

+		Manifest mf = super.getManifest();

+		// add namespace on the test classpath

+		mf.getMainAttributes().putValue(Constants.BUNDLE_CLASSPATH, ".,namespace/ns.jar");

+		return mf;

+	}

+

+	protected String[] getBundleContentPattern() {

+		return (String[]) ObjectUtils.addObjectToArray(super.getBundleContentPattern(), "namespace/**/*");

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/namespace/context.xml" };

+	}

+

+	public void testApplicationContextWasProperlyStarted() throws Exception {

+		assertNotNull(applicationContext);

+		assertNotNull(applicationContext.getBean("bean"));

+	}

+

+	public void testNamespaceFilesOnTheClassPath() throws Exception {

+		// simple code to trigger an import for this package

+		assertNotNull(NamespaceHandlerResolver.class);

+

+		Bundle bundle = bundleContext.getBundle();

+		URL handlers = bundle.getResource("META-INF/spring.handlers");

+		URL schemas = bundle.getResource("META-INF/spring.schemas");

+

+		assertNotNull(handlers);

+		assertNotNull(schemas);

+

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/nonosgicl/NonOSGiLoaderProxyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/nonosgicl/NonOSGiLoaderProxyTest.java
new file mode 100644
index 0000000..54e2eb1
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/nonosgicl/NonOSGiLoaderProxyTest.java
@@ -0,0 +1,105 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.nonosgicl;

+

+import java.io.PrintWriter;

+import java.sql.Connection;

+import java.sql.SQLException;

+import java.util.Comparator;

+import java.util.Hashtable;

+

+import javax.sql.DataSource;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Constants;

+import org.springframework.beans.factory.InitializingBean;

+import org.springframework.context.ConfigurableApplicationContext;

+import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

+

+/**

+ * Integration test that checks whether the non-osgi classloader for JDK/OSGi

+ * classes are properly considered when creating service proxies.

+ * 

+ * @author Costin Leau

+ */

+public class NonOSGiLoaderProxyTest extends BaseIntegrationTest {

+

+	// a service that implements several custom classes

+	private class Service implements DataSource, Comparator, InitializingBean, Constants {

+

+		public Connection getConnection() throws SQLException {

+			return null;

+		}

+

+		public Connection getConnection(String username, String password) throws SQLException {

+			return null;

+		}

+

+		public int getLoginTimeout() throws SQLException {

+			return 0;

+		}

+

+		public PrintWriter getLogWriter() throws SQLException {

+			return null;

+		}

+

+		public void setLoginTimeout(int seconds) throws SQLException {

+		}

+

+		public void setLogWriter(PrintWriter out) throws SQLException {

+		}

+

+		public void afterPropertiesSet() throws Exception {

+		}

+

+		public int compare(Object arg0, Object arg1) {

+			return 0;

+		}

+

+		public boolean isWrapperFor(Class<?> iface) {

+			return false;

+		}

+

+		public <T> T unwrap(Class<T> iface) throws SQLException {

+			return null;

+		}

+	}

+

+

+	public void testProxy() throws Exception {

+		// publish service

+		bundleContext.registerService(new String[] { DataSource.class.getName(), Comparator.class.getName(),

+			InitializingBean.class.getName(), Constants.class.getName() }, new Service(), new Hashtable());

+

+		ConfigurableApplicationContext ctx = getNestedContext();

+		assertNotNull(ctx);

+		Object proxy = ctx.getBean("service");

+		assertNotNull(proxy);

+		assertTrue(proxy instanceof DataSource);

+		assertTrue(proxy instanceof Comparator);

+		assertTrue(proxy instanceof Constants);

+		assertTrue(proxy instanceof InitializingBean);

+		ctx.close();

+	}

+

+	private ConfigurableApplicationContext getNestedContext() throws Exception {

+		OsgiBundleXmlApplicationContext ctx = new OsgiBundleXmlApplicationContext(

+			new String[] { "org/eclipse/gemini/blueprint/iandt/nonosgicl/context.xml" });

+

+		ctx.setBundleContext(bundleContext);

+		ctx.refresh();

+		return ctx;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/ns/NamespaceProviderAndConsumerTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/ns/NamespaceProviderAndConsumerTest.java
new file mode 100644
index 0000000..0d54e32
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/ns/NamespaceProviderAndConsumerTest.java
@@ -0,0 +1,85 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.ns;

+

+import java.awt.Shape;

+import java.net.URL;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.Constants;

+import org.osgi.framework.ServiceReference;

+import org.springframework.context.ApplicationContext;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;

+

+/**

+ * Integration test that provides a namespace that is also used internally.

+ * 

+ * @author Costin Leau

+ */

+public class NamespaceProviderAndConsumerTest extends BaseIntegrationTest {

+

+	private Shape nsBean;

+

+	private static final String BND_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.ns.own.provider";

+

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, ns.own.consumer," + getSpringDMVersion() };

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/ns/context.xml" };

+	}

+

+	public void testApplicationContextWasProperlyStarted() throws Exception {

+		assertNotNull(applicationContext);

+		assertNotNull(applicationContext.getBean("nsDate"));

+		assertNotNull(applicationContext.getBean("nsBean"));

+	}

+

+	public void testTestAutowiring() throws Exception {

+		assertNotNull(nsBean);

+	}

+

+	public void tstNamespaceFilesOnTheClassPath() throws Exception {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, BND_SYM_NAME);

+		assertNotNull("cannot find handler bundle", bundle);

+		URL handlers = bundle.getResource("META-INF/spring.handlers");

+		URL schemas = bundle.getResource("META-INF/spring.schemas");

+

+		assertNotNull("cannot find a handler inside the custom bundle", handlers);

+		assertNotNull("cannot find a schema inside the custom bundle", schemas);

+	}

+

+	public void testNSBundlePublishedOkay() throws Exception {

+		ServiceReference ref = OsgiServiceReferenceUtils.getServiceReference(bundleContext,

+			ApplicationContext.class.getName(), "(" + Constants.BUNDLE_SYMBOLICNAME + "=" + BND_SYM_NAME + ")");

+		assertNotNull(ref);

+		ApplicationContext ctx = (ApplicationContext) bundleContext.getService(ref);

+		assertNotNull(ctx);

+		assertNotNull(ctx.getBean("nsBean"));

+		assertNotNull(ctx.getBean("nsDate"));

+

+	}

+

+	/**

+	 * @param nsBean The nsBean to set.

+	 */

+	public void setNsBean(Shape nsBean) {

+		this.nsBean = nsBean;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest.java
new file mode 100644
index 0000000..55ae9d8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest.java
@@ -0,0 +1,131 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.propertyplaceholder;

+

+import java.io.File;

+import java.io.FilePermission;

+import java.util.Dictionary;

+import java.util.Hashtable;

+import java.util.List;

+import java.util.PropertyPermission;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.ServiceReference;

+import org.osgi.service.cm.Configuration;

+import org.osgi.service.cm.ConfigurationAdmin;

+import org.osgi.service.cm.ConfigurationPermission;

+import org.eclipse.gemini.blueprint.context.ConfigurableOsgiBundleApplicationContext;

+import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;

+

+/**

+ * Integration test for OsgiPropertyPlaceholder.

+ * 

+ * @author Costin Leau

+ */

+public class PropertyPlaceholderTest extends BaseIntegrationTest {

+

+	private final static String ID = "PropertyPlaceholderTest-123";

+

+	private final static Dictionary DICT = new Hashtable();

+

+	private ConfigurableOsgiBundleApplicationContext ctx;

+

+	private static String CONFIG_DIR = "test-config";

+

+

+	protected static void initializeDirectory(String dir) {

+		File directory = new File(dir);

+		remove(directory);

+		assertTrue(dir + " directory successfully created", directory.mkdirs());

+	}

+

+	private static void remove(File directory) {

+		if (directory.exists()) {

+			File[] files = directory.listFiles();

+			for (int i = 0; i < files.length; i++) {

+				File file = files[i];

+				if (file.isDirectory()) {

+					remove(file);

+				}

+				else {

+					assertTrue(file + " deleted", file.delete());

+				}

+			}

+			assertTrue(directory + " directory successfully cleared", directory.delete());

+		}

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] {

+		// required by cm_all for logging

+		"org.apache.felix, org.apache.felix.configadmin, 1.0.10" };

+	}

+

+	protected void onSetUp() throws Exception {

+		DICT.put("foo", "bar");

+		DICT.put("white", "horse");

+		// Set up the bundle storage dirctory

+		System.setProperty("com.gatespace.bundle.cm.store", CONFIG_DIR);

+		System.setProperty("felix.cm.dir", CONFIG_DIR);

+		initializeDirectory(CONFIG_DIR);

+		prepareConfiguration();

+

+		String[] locations = new String[] { "org/eclipse/gemini/blueprint/iandt/propertyplaceholder/placeholder.xml" };

+		ctx = new OsgiBundleXmlApplicationContext(locations);

+		ctx.setBundleContext(bundleContext);

+		ctx.refresh();

+	}

+

+	protected void onTearDown() throws Exception {

+		if (ctx != null)

+			ctx.close();

+	}

+

+	// add a default table into OSGi

+	private void prepareConfiguration() throws Exception {

+

+		ServiceReference ref = OsgiServiceReferenceUtils.getServiceReference(bundleContext,

+			ConfigurationAdmin.class.getName(), null);

+

+		ConfigurationAdmin admin = (ConfigurationAdmin) bundleContext.getService(ref);

+		Configuration config = admin.getConfiguration(ID);

+		config.update(DICT);

+	}

+

+	public void testFoundProperties() throws Exception {

+		String bean = (String) ctx.getBean("bean1");

+		assertEquals("horse", bean);

+	}

+

+	public void testFallbackProperties() throws Exception {

+		String bean = (String) ctx.getBean("bean2");

+		assertEquals("treasures", bean);

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		perms.add(new PropertyPermission("*", "write"));

+		perms.add(new PropertyPermission("*", "read"));

+		perms.add(new FilePermission("<<ALL FILES>>", "read"));

+		perms.add(new FilePermission("<<ALL FILES>>", "delete"));

+		perms.add(new FilePermission("<<ALL FILES>>", "write"));

+		perms.add(new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE));

+		return perms;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxied/listener/ProxiedListenerTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxied/listener/ProxiedListenerTest.java
new file mode 100644
index 0000000..573ab8d
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxied/listener/ProxiedListenerTest.java
@@ -0,0 +1,43 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxied.listener;

+

+import java.awt.Shape;

+import java.awt.geom.Area;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.iandt.proxy.listener.Listener;

+

+/**

+ * @author Costin Leau

+ */

+public class ProxiedListenerTest extends BaseIntegrationTest {

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/proxied/listener/service-import.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, proxy.listener," + getSpringDMVersion() };

+	}

+

+	public void testListenerProxy() throws Exception {

+		System.out.println(Listener.class.getName());

+		Object obj = new Area();

+		ServiceRegistration reg = bundleContext.registerService(Shape.class.getName(), obj, null);

+		reg.unregister();

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ClassDependenciesVisibilityTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ClassDependenciesVisibilityTest.java
new file mode 100644
index 0000000..2aff6b2
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ClassDependenciesVisibilityTest.java
@@ -0,0 +1,112 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+import java.lang.reflect.InvocationHandler;

+import java.lang.reflect.Method;

+import java.lang.reflect.Proxy;

+import java.util.ArrayList;

+import java.util.List;

+

+import javax.swing.event.DocumentEvent;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.ImportContextClassLoader;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceProxyFactoryBean;

+

+/**

+ * Integration test for bug OSGI-597.

+ * 

+ * This test tries to create a proxy for DocumentEvent w/o importing its

+ * dependency, namely javax.swing.text.Element.

+ * 

+ * @author Costin Leau

+ */

+public class ClassDependenciesVisibilityTest extends BaseIntegrationTest {

+

+	private static String DEPENDENCY_CLASS = "javax.swing.text.Element";

+

+

+	public void testPackageDependency() throws Exception {

+		ClassLoader cl = applicationContext.getClassLoader();

+		System.out.println(cl);

+		OsgiServiceProxyFactoryBean fb = new OsgiServiceProxyFactoryBean();

+		fb.setBundleContext(bundleContext);

+		fb.setCardinality(Cardinality.C_0__1);

+		fb.setContextClassLoader(ImportContextClassLoader.UNMANAGED);

+		fb.setInterfaces(new Class<?>[] { DocumentEvent.class });

+		fb.setBeanClassLoader(cl);

+		fb.setApplicationEventPublisher(applicationContext);

+		fb.afterPropertiesSet();

+

+		checkPackageVisibility(cl);

+

+		Object proxy = fb.getObject();

+		assertNotNull(proxy);

+		assertTrue(proxy instanceof DocumentEvent);

+		System.out.println(proxy.getClass());

+

+	}

+

+	public void testJdkProxy() throws Exception {

+		InvocationHandler ih = new InvocationHandler() {

+

+			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

+				return null;

+			}

+		};

+		ClassLoader cl = applicationContext.getClassLoader();

+		checkPackageVisibility(cl);

+

+		try {

+			Object proxy = Proxy.newProxyInstance(cl, new Class<?>[] { DocumentEvent.class }, ih);

+			assertNotNull(proxy);

+			System.out.println(proxy.getClass());

+

+			fail("should have failed");

+		}

+		catch (Throwable cnfe) {

+			// expected

+		}

+	}

+

+	private void checkPackageVisibility(ClassLoader cl) throws Exception {

+

+		try {

+			cl.loadClass(DEPENDENCY_CLASS);

+			fail("should not be able to load " + DEPENDENCY_CLASS);

+		}

+		catch (ClassNotFoundException cnfe) {

+			// expected

+		}

+	}

+

+	// remove the javax.* boot delegation

+	protected List getBootDelegationPackages() {

+		List packages = super.getBootDelegationPackages();

+		packages.remove("javax.*");

+		packages.remove("javax.swing.*");

+		return packages;

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new RuntimePermission("*", "getClassLoader"));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/JdkProxyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/JdkProxyTest.java
new file mode 100644
index 0000000..c84c925
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/JdkProxyTest.java
@@ -0,0 +1,70 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+import java.lang.reflect.InvocationHandler;

+import java.lang.reflect.Proxy;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceReference;

+

+/**

+ * Integration test checking the JDK proxy creation on invocation handlers that

+ * cannot be seen by the proxy creator.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class JdkProxyTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,jdk.proxy," + getSpringDMVersion() };

+	}

+

+	public void testJDKProxyCreationUsingTheInterfaceClassLoaderInsteadOfTheHandlerOne() throws Exception {

+		// get the invocation handler directly

+		InvocationHandler handler = getInvocationHandler();

+		SomeInterfaceImplementation target = new SomeInterfaceImplementation();

+		SomeInterface proxy = createJDKProxy(handler, target);

+

+		SomeInterfaceImplementation.INVOCATION = 0;

+		// invoke method on the proxy

+		String str = proxy.doSmth();

+		// print out the proxy message

+		System.out.println("Proxy returned " + str);

+		// assert the target wasn't touched

+		assertEquals(0, SomeInterfaceImplementation.INVOCATION);

+		// check proxy again

+		assertSame(handler, Proxy.getInvocationHandler(proxy));

+

+	}

+

+	/**

+	 * Poor man's solution.

+	 * 

+	 * @return

+	 */

+	private InvocationHandler getInvocationHandler() {

+		ServiceReference ref = bundleContext.getServiceReference(InvocationHandler.class.getName());

+		if (ref == null)

+			throw new IllegalStateException("no invocation handler found");

+		return (InvocationHandler) bundleContext.getService(ref);

+	}

+

+	private SomeInterface createJDKProxy(InvocationHandler handler, SomeInterface target) {

+		return (SomeInterface) Proxy.newProxyInstance(target.getClass().getClassLoader(),

+			new Class<?>[] { SomeInterface.class }, handler);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ProxyCreatorTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ProxyCreatorTest.java
new file mode 100644
index 0000000..97ea08b
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/ProxyCreatorTest.java
@@ -0,0 +1,67 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+import java.util.ArrayList;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Integration test that checks that a new classloader is created when the

+ * bundle is refreshed. The test updates a bundle that internally creates JDK

+ * and CGLIB proxies which, will fail in case the old CL is preserved.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ProxyCreatorTest extends BaseIntegrationTest {

+

+	private static final String PROXY_CREATOR_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.proxy.creator";

+

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,proxy.creator," + getSpringDMVersion(),

+			"net.sourceforge.cglib, com.springsource.net.sf.cglib, 2.1.3" };

+	}

+

+	public void testNewProxiesCreatedOnBundleRefresh() throws Exception {

+		// get a hold of the bundle proxy creator bundle and update it

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, PROXY_CREATOR_SYM_NAME);

+

+		assertNotNull("proxy creator bundle not found", bundle);

+		// update bundle (and thus create a new version of the classes)

+		bundle.update();

+

+		// make sure it starts-up

+		try {

+			waitOnContextCreation(PROXY_CREATOR_SYM_NAME, 60);

+		}

+		catch (Exception ex) {

+			fail("updating the bundle failed");

+		}

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		perms.add(new AdminPermission("*", AdminPermission.RESOLVE));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java
new file mode 100644
index 0000000..9773a43
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterface.java
@@ -0,0 +1,31 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+/**

+ * Simple interface used for creating a JDK proxy.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public interface SomeInterface {

+

+	/**

+	 * Just do something.

+	 * 

+	 * @return a string

+	 */

+	String doSmth();

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterfaceImplementation.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterfaceImplementation.java
new file mode 100644
index 0000000..f886b6f
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/proxycreator/SomeInterfaceImplementation.java
@@ -0,0 +1,32 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.proxycreator;

+

+/**

+ * Default implementation.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SomeInterfaceImplementation implements SomeInterface {

+

+	public static int INVOCATION = 0;

+

+

+	public String doSmth() {

+		INVOCATION++;

+		throw new UnsupportedOperationException("the original target should not be invoked");

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ProxyDestructionTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ProxyDestructionTest.java
new file mode 100644
index 0000000..096ca6f
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ProxyDestructionTest.java
@@ -0,0 +1,114 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.referenceProxy;

+

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleException;

+import org.eclipse.gemini.blueprint.iandt.reference.proxy.ServiceReferer;

+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;

+import org.eclipse.gemini.blueprint.service.importer.ServiceProxyDestroyedException;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * @author Glyn Normington

+ */

+public class ProxyDestructionTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion(),

+			"org.eclipse.gemini.blueprint.iandt, proxy.destruction," + getSpringDMVersion() };

+	}

+

+	/**

+	 * Install the bundles, stop the one providing the service and then the one

+	 * consuming the service, *after*, an invocation has been made. The test

+	 * checks that shutting down the application context, causes all proxies

+	 * waiting to be destroyed properly.

+	 * 

+	 * @throws Exception

+	 */

+	public void testProxyDestruction() throws Exception {

+

+		MyService reference = ServiceReferer.serviceReference;

+

+		assertNotNull("reference not initialized", reference);

+		assertNotNull("no value specified in the reference", reference.stringValue());

+

+		Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,

+			"org.eclipse.gemini.blueprint.iandt.simpleservice");

+

+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);

+		System.out.println("stopping service bundle");

+		simpleServiceBundle.stop();

+

+		while (simpleServiceBundle.getState() == Bundle.STOPPING) {

+			System.out.println("waiting for service bundle to stop...");

+			Thread.sleep(500);

+		}

+		System.out.println("service bundle stopped");

+

+		final Bundle proxyDestructionBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,

+			"org.eclipse.gemini.blueprint.iandt.proxy.destruction");

+

+		Thread t = new Thread() {

+

+			public void run() {

+				try {

+					// wait a bit so the proxy invocation executes

+					Thread.sleep(3000);

+				}

+				catch (InterruptedException e) {

+					e.printStackTrace();

+				}

+				try {

+					System.out.println("Stopping referring bundle...");

+					proxyDestructionBundle.stop();

+				}

+				catch (BundleException e) {

+					e.printStackTrace();

+				}

+			}

+

+		};

+		t.start();

+

+		// Service should be unavailable

+		try {

+			System.out.println("Invoking method on OSGi service proxy...");

+			reference.stringValue();

+			fail("ServiceProxyDestroyedException should have been thrown!");

+		}

+		catch (ServiceProxyDestroyedException e) {

+			// Expected

+		}

+	}

+

+	protected long getDefaultWaitTime() {

+		return 60L;

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceInterruptTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceInterruptTest.java
new file mode 100644
index 0000000..4c39f7c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceInterruptTest.java
@@ -0,0 +1,72 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.referenceProxy;

+

+import java.awt.Shape;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.ImportContextClassLoader;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceProxyFactoryBean;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ReferenceInterruptTest extends BaseIntegrationTest {

+

+	public void testProxyInterrupt() throws Exception {

+		long initialWait = 20 * 1000;

+		final OsgiServiceProxyFactoryBean proxyFactory = new OsgiServiceProxyFactoryBean();

+		proxyFactory.setBeanClassLoader(getClass().getClassLoader());

+		proxyFactory.setBundleContext(bundleContext);

+		proxyFactory.setCardinality(Cardinality.C_0__1);

+		proxyFactory.setContextClassLoader(ImportContextClassLoader.UNMANAGED);

+		proxyFactory.setInterfaces(new Class<?>[] { Shape.class });

+		proxyFactory.setTimeout(initialWait);

+		proxyFactory.afterPropertiesSet();

+

+		Runnable resetProxy = new Runnable() {

+

+			public void run() {

+				try {

+					Thread.sleep(3 * 1000);

+				}

+				catch (InterruptedException e) {

+					throw new RuntimeException(e);

+				}

+				proxyFactory.setTimeout(0);

+			}

+		};

+

+		Object proxy = proxyFactory.getObject();

+		assertNotNull(proxy);

+		Thread stopThread = new Thread(resetProxy, "reset-proxy-thread");

+		stopThread.start();

+

+		long start = System.currentTimeMillis();

+		logger.info("Invoking proxy...");

+		try {

+			proxy.toString();

+			fail("no service should have been found...");

+		}

+		catch (ServiceUnavailableException sue) {

+		}

+

+		long stop = System.currentTimeMillis();

+		assertTrue(stop - start < initialWait);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.java
new file mode 100644
index 0000000..676a06e
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.java
@@ -0,0 +1,97 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.referenceProxy;
+
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.eclipse.gemini.blueprint.iandt.reference.proxy.ServiceReferer;
+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;
+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;
+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;
+
+/**
+ * @author Hal Hildebrand Date: Nov 25, 2006 Time: 12:42:30 PM
+ */
+public class ReferenceProxyTest extends BaseIntegrationTest {
+
+	protected String[] getTestBundlesNames() {
+		return new String[] { "org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion(),
+			"org.eclipse.gemini.blueprint.iandt, reference.proxy," + getSpringDMVersion() };
+	}
+
+	public void testReferenceProxyLifecycle() throws Exception {
+
+		MyService reference = ServiceReferer.serviceReference;
+
+		assertNotNull("reference not initialized", reference);
+		assertNotNull("no value specified in the reference", reference.stringValue());
+
+		Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
+			"org.eclipse.gemini.blueprint.iandt.simpleservice");
+
+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
+		System.out.println("stopping bundle");
+		simpleServiceBundle.stop();
+
+		while (simpleServiceBundle.getState() == Bundle.STOPPING) {
+			System.out.println("waiting for bundle to stop");
+			Thread.sleep(10);
+		}
+		System.out.println("bundle stopped");
+
+		// Service should be unavailable
+		try {
+			reference.stringValue();
+			fail("ServiceUnavailableException should have been thrown!");
+		}
+		catch (ServiceUnavailableException e) {
+			// Expected
+		}
+
+		System.out.println("starting bundle");
+		simpleServiceBundle.start();
+
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice");
+
+		System.out.println("bundle started");
+		// Service should be running
+		assertNotNull(reference.stringValue());
+	}
+
+	protected long getDefaultWaitTime() {
+		return 15L;
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		perms.add(new AdminPermission("*", AdminPermission.LIFECYCLE));
+		return perms;
+	}
+
+	protected List getIAndTPermissions() {
+		List perms = super.getIAndTPermissions();
+		perms.add(new PropertyPermission("*", "read"));
+		perms.add(new PropertyPermission("*", "write"));
+		return perms;
+	}
+
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.java
new file mode 100644
index 0000000..b09cc57
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.java
@@ -0,0 +1,78 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceListener;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.PropertyPermission;
+
+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.eclipse.gemini.blueprint.iandt.service.listener.MyListener;
+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;
+
+/**
+ * @author Hal Hildebrand Date: Nov 14, 2006 Time: 8:18:15 AM
+ */
+public class ServiceListenerTest extends BaseIntegrationTest {
+
+	protected String[] getTestBundlesNames() {
+		return new String[] { "org.eclipse.gemini.blueprint.iandt,simple.service," + getSpringDMVersion(),
+			"org.eclipse.gemini.blueprint.iandt, service.listener," + getSpringDMVersion() };
+	}
+
+	public void testServiceListener() throws Exception {
+		assertEquals("Expected initial binding of service", 1, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected initial unbinding of service", 0, MyListener.UNBOUND_COUNT);
+
+		Bundle simpleServiceBundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext,
+			"org.eclipse.gemini.blueprint.iandt.simpleservice");
+
+		assertNotNull("Cannot find the simple service bundle", simpleServiceBundle);
+
+		simpleServiceBundle.stop();
+		while (simpleServiceBundle.getState() == Bundle.STOPPING) {
+			Thread.sleep(100);
+		}
+
+		assertEquals("Expected one binding of service", 1, MyListener.BOUND_COUNT);
+		assertTrue("Expected only one unbinding of service", MyListener.UNBOUND_COUNT < 2);
+		assertEquals("Expected unbinding of service not seen", 1, MyListener.UNBOUND_COUNT);
+
+		logger.debug("about to restart simple service");
+		simpleServiceBundle.start();
+		waitOnContextCreation("org.eclipse.gemini.blueprint.iandt.simpleservice");
+		// wait some more to let the listener binding propagate
+		Thread.sleep(1000);
+
+		logger.debug("simple service succesfully restarted");
+		assertTrue("Expected only two bindings of service", MyListener.BOUND_COUNT < 3);
+		assertEquals("Expected binding of service not seen", 2, MyListener.BOUND_COUNT);
+		assertEquals("Unexpected unbinding of service", 1, MyListener.UNBOUND_COUNT);
+	}
+
+	protected long getDefaultWaitTime() {
+		return 10L;
+	}
+
+	protected List getTestPermissions() {
+		List perms = super.getTestPermissions();
+		// export package
+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));
+		return perms;
+	}
+}
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/MultiServiceProxyFactoryBeanTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/MultiServiceProxyFactoryBeanTest.java
new file mode 100644
index 0000000..0eae523
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/MultiServiceProxyFactoryBeanTest.java
@@ -0,0 +1,228 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceProxyFactoryBean;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.Date;

+import java.util.Iterator;

+import java.util.List;

+import java.util.NoSuchElementException;

+import java.util.Properties;

+

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.core.InfrastructureProxy;

+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;

+import org.eclipse.gemini.blueprint.service.importer.ImportedOsgiServiceProxy;

+import org.eclipse.gemini.blueprint.service.importer.ServiceProxyDestroyedException;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceCollectionProxyFactoryBean;

+

+public class MultiServiceProxyFactoryBeanTest extends ServiceBaseTest {

+

+	private OsgiServiceCollectionProxyFactoryBean fb;

+

+

+	protected void onSetUp() throws Exception {

+		fb = new OsgiServiceCollectionProxyFactoryBean();

+		fb.setBundleContext(bundleContext);

+		fb.setBeanClassLoader(getClass().getClassLoader());

+	}

+

+	protected void onTearDown() throws Exception {

+		fb.destroy();

+		fb = null;

+	}

+

+	// causes CGLIB problems

+	public void testFactoryBeanForMultipleServicesAsInterfaces() throws Exception {

+

+		fb.setCardinality(Cardinality.C_0__N);

+		// look for collections

+		fb.setInterfaces(new Class<?>[] { ArrayList.class });

+		fb.afterPropertiesSet();

+

+		List registrations = new ArrayList(3);

+

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Collection);

+			Collection col = (Collection) result;

+

+			assertTrue(col.isEmpty());

+			Iterator iter = col.iterator();

+

+			assertFalse(iter.hasNext());

+

+			ArrayList a = new ArrayList();

+			a.add(new Long(10));

+

+			registrations.add(publishService(a, ArrayList.class.getName()));

+

+			assertTrue(iter.hasNext());

+			Object service = iter.next();

+

+			assertTrue(service instanceof ArrayList);

+			assertEquals(10, ((Number) ((Collection) service).toArray()[0]).intValue());

+

+			assertFalse(iter.hasNext());

+			a = new ArrayList();

+			a.add(new Long(100));

+			registrations.add(publishService(a, ArrayList.class.getName()));

+			assertTrue(iter.hasNext());

+			service = iter.next();

+			assertTrue(service instanceof ArrayList);

+			assertEquals(100, ((Number) ((Collection) service).toArray()[0]).intValue());

+		}

+		finally {

+			cleanRegistrations(registrations);

+		}

+	}

+

+	public void testFactoryBeanForMultipleServicesAsClasses() throws Exception {

+

+		fb.setCardinality(Cardinality.C_0__N);

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		List registrations = new ArrayList(3);

+

+		long time = 321;

+		Date dateA = new Date(time);

+

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Collection);

+			Collection col = (Collection) result;

+

+			assertTrue(col.isEmpty());

+			Iterator iter = col.iterator();

+

+			assertFalse(iter.hasNext());

+			registrations.add(publishService(dateA));

+			try {

+				iter.next();

+				fail("should have thrown exception");

+			}

+			catch (NoSuchElementException ex) {

+				// expected

+			}

+			assertTrue(iter.hasNext());

+			Object service = iter.next();

+			assertTrue(service instanceof Date);

+			assertEquals(time, ((Date) service).getTime());

+			assertEquals(dateA, ((InfrastructureProxy) service).getWrappedObject());

+

+			assertFalse(iter.hasNext());

+			time = 111;

+			Date dateB = new Date(time);

+			registrations.add(publishService(dateB));

+			assertTrue(iter.hasNext());

+			service = iter.next();

+			assertTrue(service instanceof Date);

+			assertEquals(time, ((Date) service).getTime());

+			assertFalse(dateA.equals(((InfrastructureProxy) service).getWrappedObject()));

+			assertEquals(dateB, ((InfrastructureProxy) service).getWrappedObject());

+		}

+		finally {

+			cleanRegistrations(registrations);

+		}

+	}

+

+	public void testIteratorWhenServiceGoesDown() throws Exception {

+		fb.setCardinality(Cardinality.C_0__N);

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		long time = 123;

+		Date date = new Date(time);

+		Properties props = new Properties();

+		props.put("Moroccan", "Sunset");

+

+		List registrations = new ArrayList(3);

+		try {

+			Collection col = (Collection) fb.getObject();

+			Iterator iter = col.iterator();

+

+			assertFalse(iter.hasNext());

+			registrations.add(publishService(date, props));

+			assertTrue(iter.hasNext());

+

+			// deregister service

+			((ServiceRegistration) registrations.remove(0)).unregister();

+

+			// has to successed

+			Object obj = iter.next();

+

+			assertTrue(obj instanceof ImportedOsgiServiceProxy);

+			assertTrue(obj instanceof Date);

+			assertTrue(obj instanceof InfrastructureProxy);

+			// the properties will contain the ObjectClass also

+			assertEquals(((ImportedOsgiServiceProxy) obj).getServiceReference().getProperty("Moroccan"), "Sunset");

+			try {

+				// make sure the service is dead

+				((Date) obj).getTime();

+				fail("should have thrown exception");

+			}

+			catch (ServiceUnavailableException ex) {

+				// proxy is dead

+			}

+		}

+		finally {

+			cleanRegistrations(registrations);

+		}

+	}

+

+	public void testProxyDestruction() throws Exception {

+		fb.setCardinality(Cardinality.C_0__N);

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		long time = 123;

+		Date date = new Date(time);

+		Properties props = new Properties();

+		props.put("Moroccan", "Sunset");

+

+		ServiceRegistration reg = publishService(date, props);

+		try {

+			Collection col = (Collection) fb.getObject();

+			Iterator iter = col.iterator();

+

+			assertTrue(iter.hasNext());

+			Date proxy = (Date) iter.next();

+

+			assertEquals(proxy.toString(), date.toString());

+

+			fb.destroy();

+

+			try {

+				proxy.getTime();

+				fail("should have thrown exception");

+			}

+			catch (ServiceProxyDestroyedException spde) {

+				// expected 

+			}

+		}

+		finally {

+			reg.unregister();

+		}

+	}

+

+	private void cleanRegistrations(Collection list) {

+		for (Iterator iter = list.iterator(); iter.hasNext();) {

+			((ServiceRegistration) iter.next()).unregister();

+		}

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceBaseTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceBaseTest.java
new file mode 100644
index 0000000..2297aa8
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceBaseTest.java
@@ -0,0 +1,52 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceProxyFactoryBean;

+

+import java.util.Dictionary;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceRegistration;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class ServiceBaseTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "net.sourceforge.cglib, com.springsource.net.sf.cglib, 2.1.3" };

+	}

+

+	protected ServiceRegistration publishService(Object obj, String name) throws Exception {

+		return bundleContext.registerService(name, obj, null);

+	}

+

+	protected ServiceRegistration publishService(Object obj, String names[]) throws Exception {

+		return bundleContext.registerService(names, obj, null);

+	}

+

+	protected ServiceRegistration publishService(Object obj, String names[], Dictionary dict) throws Exception {

+		return bundleContext.registerService(names, obj, null);

+	}

+

+	protected ServiceRegistration publishService(Object obj) throws Exception {

+		return publishService(obj, obj.getClass().getName());

+	}

+

+	protected ServiceRegistration publishService(Object obj, Dictionary dict) throws Exception {

+		return bundleContext.registerService(obj.getClass().getName(), obj, dict);

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceProxyFactoryBeanTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceProxyFactoryBeanTest.java
new file mode 100644
index 0000000..2ad5505
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceProxyFactoryBeanTest.java
@@ -0,0 +1,99 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceProxyFactoryBean;

+

+import java.io.Serializable;

+import java.util.Date;

+

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceProxyFactoryBean;

+import org.eclipse.gemini.blueprint.util.OsgiFilterUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ServiceProxyFactoryBeanTest extends ServiceBaseTest {

+

+	private OsgiServiceProxyFactoryBean fb;

+

+

+	protected void onSetUp() throws Exception {

+		fb = new OsgiServiceProxyFactoryBean();

+		fb.setBundleContext(bundleContext);

+		// execute retries fast

+		fb.setTimeout(1);

+		fb.setBeanClassLoader(getClass().getClassLoader());

+	}

+

+	protected void onTearDown() throws Exception {

+		fb = null;

+	}

+

+	public void testFactoryBeanForOneServiceAsClass() throws Exception {

+		long time = 1234;

+		Date date = new Date(time);

+		ServiceRegistration reg = publishService(date);

+

+		fb.setCardinality(Cardinality.C_1__1);

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Date);

+			assertEquals(time, ((Date) result).getTime());

+		}

+		finally {

+			if (reg != null)

+				reg.unregister();

+		}

+	}

+

+	public void testFactoryBeanForOneServiceAsInterface() throws Exception {

+		long time = 1234;

+		Date date = new Date(time);

+

+		Class<?>[] intfs = new Class<?>[] { Comparable.class, Serializable.class, Cloneable.class };

+

+		String[] classes = new String[] { Comparable.class.getName(), Serializable.class.getName(),

+			Cloneable.class.getName(), Date.class.getName() };

+

+		ServiceRegistration reg = publishService(date, classes);

+

+		fb.setCardinality(Cardinality.C_1__1);

+		fb.setInterfaces(intfs);

+		fb.setFilter(OsgiFilterUtils.unifyFilter(Date.class, null));

+		fb.afterPropertiesSet();

+

+		try {

+			Object result = fb.getObject();

+			// the interfaces are implemented

+			assertTrue(result instanceof Comparable);

+			assertTrue(result instanceof Serializable);

+			assertTrue(result instanceof Cloneable);

+			// but not the class

+			assertFalse(result instanceof Date);

+			// compare the strings

+			assertEquals(result.toString(), date.toString());

+		}

+		finally {

+			if (reg != null)

+				reg.unregister();

+		}

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithMultiServiceTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithMultiServiceTest.java
new file mode 100644
index 0000000..aebb544
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithMultiServiceTest.java
@@ -0,0 +1,97 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceProxyFactoryBean;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.Date;

+import java.util.Iterator;

+import java.util.List;

+

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.core.InfrastructureProxy;

+import org.eclipse.gemini.blueprint.service.importer.ImportedOsgiServiceProxy;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceCollectionProxyFactoryBean;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ServiceRefAwareWithMultiServiceTest extends ServiceBaseTest {

+

+	private OsgiServiceCollectionProxyFactoryBean fb;

+

+

+	protected void onSetUp() throws Exception {

+		fb = new OsgiServiceCollectionProxyFactoryBean();

+		fb.setBundleContext(bundleContext);

+		fb.setBeanClassLoader(getClass().getClassLoader());

+	}

+

+	protected void onTearDown() throws Exception {

+		fb = null;

+	}

+

+	public void testProxyForMultipleCardinality() throws Exception {

+		fb.setCardinality(Cardinality.C_0__N);

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		List registrations = new ArrayList(3);

+

+		long time = 321;

+		Date dateA = new Date(time);

+

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Collection);

+			Collection col = (Collection) result;

+

+			assertTrue(col.isEmpty());

+			Iterator iter = col.iterator();

+

+			assertFalse(iter.hasNext());

+			registrations.add(publishService(dateA));

+			assertTrue(iter.hasNext());

+			Object service = iter.next();

+			assertTrue(service instanceof Date);

+			assertEquals(time, ((Date) service).getTime());

+

+			assertTrue(service instanceof ImportedOsgiServiceProxy);

+			assertNotNull(((ImportedOsgiServiceProxy) service).getServiceReference());

+			assertSame(dateA, ((InfrastructureProxy) service).getWrappedObject());

+

+			assertFalse(iter.hasNext());

+			time = 111;

+			Date dateB = new Date(time);

+			registrations.add(publishService(dateB));

+			assertTrue(iter.hasNext());

+			service = iter.next();

+			assertTrue(service instanceof Date);

+			assertEquals(time, ((Date) service).getTime());

+			assertTrue(service instanceof ImportedOsgiServiceProxy);

+			assertNotNull(((ImportedOsgiServiceProxy) service).getServiceReference());

+

+			assertTrue(service instanceof InfrastructureProxy);

+			assertSame(dateB, ((InfrastructureProxy) service).getWrappedObject());

+		}

+		finally {

+			for (int i = 0; i < registrations.size(); i++) {

+				((ServiceRegistration) registrations.get(i)).unregister();

+			}

+		}

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithSingleServiceTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithSingleServiceTest.java
new file mode 100644
index 0000000..b5e5871
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceProxyFactoryBean/ServiceRefAwareWithSingleServiceTest.java
@@ -0,0 +1,138 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceProxyFactoryBean;

+

+import java.util.Date;

+import java.util.Dictionary;

+import java.util.Enumeration;

+import java.util.Map;

+import java.util.Properties;

+

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.aop.SpringProxy;

+import org.springframework.core.InfrastructureProxy;

+import org.eclipse.gemini.blueprint.service.importer.ImportedOsgiServiceProxy;

+import org.eclipse.gemini.blueprint.service.importer.support.Cardinality;

+import org.eclipse.gemini.blueprint.service.importer.support.OsgiServiceProxyFactoryBean;

+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class ServiceRefAwareWithSingleServiceTest extends ServiceBaseTest {

+

+	private OsgiServiceProxyFactoryBean fb;

+

+

+	protected void onSetUp() throws Exception {

+		fb = new OsgiServiceProxyFactoryBean();

+		fb.setBundleContext(bundleContext);

+		// execute retries fast

+		fb.setTimeout(1);

+		fb.setBeanClassLoader(getClass().getClassLoader());

+	}

+

+	protected void onTearDown() throws Exception {

+		fb = null;

+	}

+

+	public void testProxyForUnaryCardinality() throws Exception {

+		long time = 1234;

+		Date date = new Date(time);

+		ServiceRegistration reg = publishService(date);

+

+		fb.setCardinality(Cardinality.C_1__1);

+

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		ImportedOsgiServiceProxy refAware = null;

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Date);

+			// check it's our object

+			assertEquals(time, ((Date) result).getTime());

+			assertTrue(result instanceof SpringProxy);

+			assertTrue(result instanceof ImportedOsgiServiceProxy);

+			assertTrue(result instanceof InfrastructureProxy);

+

+			refAware = (ImportedOsgiServiceProxy) result;

+			assertNotNull(refAware.getServiceReference());

+

+			assertEquals("wrong target returned", date, ((InfrastructureProxy) result).getWrappedObject());

+		}

+		finally {

+			if (reg != null)

+				reg.unregister();

+		}

+

+		// test reference after the service went down

+		assertNotNull(refAware.getServiceReference());

+		assertNull(refAware.getServiceReference().getBundle());

+	}

+	

+	public void testServiceReferenceProperties() throws Exception {

+		long time = 1234;

+		Date date = new Date(time);

+		Dictionary dict = new Properties();

+		dict.put("foo", "bar");

+		dict.put("george", "michael");

+

+		ServiceRegistration reg = publishService(date, dict);

+

+		fb.setCardinality(Cardinality.C_1__1);

+		fb.setFilter("(&(foo=bar)(george=michael))");

+		fb.setInterfaces(new Class<?>[] { Date.class });

+		fb.afterPropertiesSet();

+

+		try {

+			Object result = fb.getObject();

+			assertTrue(result instanceof Date);

+			// check it's our object

+			assertEquals(time, ((Date) result).getTime());

+

+			ImportedOsgiServiceProxy refAware = (ImportedOsgiServiceProxy) result;

+

+			assertTrue(doesMapContainsDictionary(dict,

+				OsgiServiceReferenceUtils.getServicePropertiesAsMap(refAware.getServiceReference())));

+

+			InfrastructureProxy targetAware = (InfrastructureProxy) result;

+			assertEquals(date, targetAware.getWrappedObject());

+		}

+		finally {

+			if (reg != null)

+				reg.unregister();

+		}

+	}

+

+	/**

+	 * Check if the 'test' map contains the original Dictionary.

+	 * 

+	 * @param original

+	 * @param test

+	 * @return

+	 */

+	private boolean doesMapContainsDictionary(Dictionary original, Map test) {

+		Enumeration enm = original.keys();

+		while (enm.hasMoreElements()) {

+			if (!test.containsKey(enm.nextElement()))

+				return false;

+		}

+

+		return true;

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/CollectionImporterTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/CollectionImporterTest.java
new file mode 100644
index 0000000..35a7271
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/CollectionImporterTest.java
@@ -0,0 +1,138 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.servicedependency;

+

+import java.io.FilePermission;

+import java.util.List;

+import java.util.Map;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.ServiceReference;

+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;

+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.Assert;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class CollectionImporterTest extends BaseIntegrationTest {

+

+	private static final String TCCL_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.tccl";

+

+	private static final String SERVICE_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.simpleservice";

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-multi-collection-import.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		// load the tccl bundle, plus simple.service

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,tccl.intf," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt, tccl," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion() };

+	}

+

+	public void testExporterAWhenImporterAGoesDownAndUp() throws Exception {

+		assertTrue("exporterA should be running", isExporterAStarted());

+		logger.info("Taking down serviceA...");

+		takeDownServiceA();

+		assertFalse("serviceA should take exporterA down", isExporterAStarted());

+		logger.info("Putting up serviceA...");

+		putUpServiceA();

+		// check exporter

+		assertTrue("serviceA is up again, so should exporterA", isExporterAStarted());

+	}

+

+	public void testExporterBWhenImporterAGoesDownAndUp() throws Exception {

+		assertTrue("exporterB should be running", isExporterBStarted());

+		logger.info("Taking down serviceA...");

+		takeDownServiceA();

+		assertFalse("serviceA should take exporterB down", isExporterBStarted());

+		logger.info("Putting up serviceA...");

+		putUpServiceA();

+		// check exporter

+		assertTrue("service A is up again, so should exporterB", isExporterBStarted());

+	}

+

+	public void testExporterBWhenImporterAGoesDownThenImporterBThenBothUpAgain() throws Exception {

+		assertTrue("exporterB should be running", isExporterBStarted());

+

+		takeDownServiceA();

+		assertFalse("serviceA should take exporterB down", isExporterBStarted());

+

+		// take down B

+		takeDownServiceC();

+		// check exporter

+		assertFalse("serviceC down should keep exporterB down", isExporterBStarted());

+

+		putUpServiceA();

+		// check exporter

+		assertFalse("service C is still down and so should be exporterB", isExporterBStarted());

+		putUpServiceC();

+		// check exporter

+		assertTrue("service A,B up -> exporterB up", isExporterBStarted());

+	}

+

+	private void checkAndTakeDownService(String beanName, Class<?> type, String bundleSymName) throws Exception {

+		ServiceReference ref = bundleContext.getServiceReference(type.getName());

+		Object service = bundleContext.getService(ref);

+		Assert.isInstanceOf(type, service);

+

+		Bundle dependency = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, bundleSymName);

+		// stop dependency bundle -> no importer -> exporter goes down

+		dependency.stop();

+	}

+

+	private void putUpService(String bundleSymName) throws Exception {

+		Bundle dependency = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, bundleSymName);

+		dependency.start();

+		waitOnContextCreation(bundleSymName);

+	}

+

+	private void takeDownServiceA() throws Exception {

+		checkAndTakeDownService("serviceA", MyService.class, SERVICE_SYM_NAME);

+	}

+

+	private void putUpServiceA() throws Exception {

+		putUpService(SERVICE_SYM_NAME);

+	}

+

+	private void takeDownServiceC() throws Exception {

+		checkAndTakeDownService("serviceC", TCCLService.class, TCCL_SYM_NAME);

+	}

+

+	private void putUpServiceC() throws Exception {

+		putUpService(TCCL_SYM_NAME);

+	}

+

+	private boolean isExporterBStarted() throws Exception {

+		return (bundleContext.getServiceReference(SimpleBean.class.getName()) != null);

+	}

+

+	private boolean isExporterAStarted() throws Exception {

+		return (bundleContext.getServiceReference(Map.class.getName()) != null);

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/ExporterWithOptionalAndMandatoryImportersTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/ExporterWithOptionalAndMandatoryImportersTest.java
new file mode 100644
index 0000000..facfba2
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/ExporterWithOptionalAndMandatoryImportersTest.java
@@ -0,0 +1,140 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.servicedependency;

+

+import java.io.Serializable;

+import java.util.SortedMap;

+import java.util.SortedSet;

+import java.util.TreeMap;

+import java.util.TreeSet;

+

+import junit.framework.Assert;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.core.io.Resource;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.eclipse.gemini.blueprint.util.OsgiFilterUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceReferenceUtils;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * @author Costin Leau

+ */

+public class ExporterWithOptionalAndMandatoryImportersTest extends BaseIntegrationTest {

+

+	private static final String DEP_SYN_NAME = "org.eclipse.gemini.blueprint.iandt.dependency.exporter.importer";

+

+	private ServiceRegistration optional, mandatory;

+

+	protected void postProcessBundleContext(BundleContext context) throws Exception {

+		super.postProcessBundleContext(context);

+		installTestBundle(context);

+	}

+

+	protected void onSetUp() throws Exception {

+		registerOptional();

+		registerMandatory();

+	}

+

+	protected void onTearDown() throws Exception {

+		Bundle bnd = getDependencyBundle();

+		bnd.stop();

+		OsgiServiceUtils.unregisterService(mandatory);

+		OsgiServiceUtils.unregisterService(optional);

+	}

+

+	public void testInjectedDependencies() throws Exception {

+		Bundle bnd = getDependencyBundle();

+		bnd.start();

+

+		logger.info("Waiting for the test bundle to start up...");

+		waitOnContextCreation(DEP_SYN_NAME);

+		logger.info("Test bundle context created - starting test...");

+		

+		assertTrue("exporter not alive on startup", isInjectedExporterAlive());

+		optional.unregister();

+		assertTrue("exporter affected by the optional dependency", isInjectedExporterAlive());

+		mandatory.unregister();

+		assertFalse("exporter not affected by the optional dependency", isInjectedExporterAlive());

+		registerOptional();

+		assertFalse("exporter affected by the optional dependency", isInjectedExporterAlive());

+		registerMandatory();

+		assertTrue("exporter not affected by the optional dependency", isInjectedExporterAlive());

+		optional.unregister();

+		assertTrue("exporter affected by the optional dependency", isInjectedExporterAlive());

+	}

+

+	public void testDependsOnDependencies() throws Exception {

+		Bundle bnd = getDependencyBundle();

+		bnd.start();

+

+		logger.info("Waiting for the test bundle to start up...");

+		waitOnContextCreation(DEP_SYN_NAME);

+		logger.info("Test bundle context created - starting test...");

+		

+		assertTrue("exporter not alive on startup", isDependsOnExporterAlive());

+		optional.unregister();

+		assertTrue("exporter affected by the optional dependency", isDependsOnExporterAlive());

+		mandatory.unregister();

+		assertFalse("exporter not affected by the optional dependency", isDependsOnExporterAlive());

+		registerOptional();

+		assertFalse("exporter affected by the optional dependency", isDependsOnExporterAlive());

+		registerMandatory();

+		assertTrue("exporter not affected by the optional dependency", isDependsOnExporterAlive());

+		optional.unregister();

+		assertTrue("exporter affected by the optional dependency", isInjectedExporterAlive());

+	}

+

+	private boolean isExporterAlive(String name) {

+		String filter = OsgiFilterUtils.unifyFilter(new Class[] { Serializable.class, Cloneable.class },

+				"(org.eclipse.gemini.blueprint.bean.name=" + name + ")");

+		ServiceReference reference = OsgiServiceReferenceUtils.getServiceReference(bundleContext, filter);

+		if (reference != null) {

+			Object service = bundleContext.getService(reference);

+			return service != null;

+		}

+		return false;

+	}

+

+	private boolean isInjectedExporterAlive() {

+		return isExporterAlive("injected-export");

+	}

+

+	private boolean isDependsOnExporterAlive() {

+		return isExporterAlive("depends-on-export");

+	}

+

+	private void registerOptional() {

+		optional = bundleContext.registerService(SortedSet.class.getName(), new TreeSet(), null);

+	}

+

+	private void registerMandatory() {

+		mandatory = bundleContext.registerService(SortedMap.class.getName(), new TreeMap(), null);

+	}

+

+	Bundle installTestBundle(BundleContext context) throws Exception {

+		Resource res = getLocator().locateArtifact("org.eclipse.gemini.blueprint.iandt", "export-import-dependency-bundle",

+				getSpringDMVersion());

+		return context.installBundle("test-bundle", res.getInputStream());

+	}

+

+	protected Bundle getDependencyBundle() {

+		return OsgiBundleUtils.findBundleBySymbolicName(bundleContext, DEP_SYN_NAME);

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/MultipleExportersDependingOnOneImporterTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/MultipleExportersDependingOnOneImporterTest.java
new file mode 100644
index 0000000..56bfd58
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/MultipleExportersDependingOnOneImporterTest.java
@@ -0,0 +1,126 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.servicedependency;

+

+import java.util.List;

+import java.util.Map;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.ServiceReference;

+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.Assert;

+

+/**

+ * Integration test for the dependency between exporters and importers. Tests multiple exports relying on the same

+ * importer.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class MultipleExportersDependingOnOneImporterTest extends BaseIntegrationTest {

+

+	private static final String DEP_SYN_NAME = "org.eclipse.gemini.blueprint.iandt.tccl";

+

+	protected String[] getTestBundlesNames() {

+		// load the tccl bundle as it exposes a simple service

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,tccl.intf," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt,tccl," + getSpringDMVersion() };

+	}

+

+	protected synchronized String[] getConfigLocations() {

+		// trigger loading of TCCLService

+		if (TCCLService.class != null) {

+			this.notify();

+		}

+

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-single-import.xml" };

+

+	}

+

+	// test map-exporter

+	public void testDirectExporterImporterDependency() throws Exception {

+		doServiceTestOn("map", Map.class);

+	}

+

+	// test simple-bean

+	public void testTransitiveExporterImporterDependency() throws Exception {

+		doServiceTestOn("simple-bean", SimpleBean.class);

+	}

+

+	protected void doServiceTestOn(String beanName, Class<?> type) throws Exception {

+		ServiceReference ref = bundleContext.getServiceReference(type.getName());

+		Object service = bundleContext.getService(ref);

+		Assert.isInstanceOf(type, service);

+

+		assertSame(applicationContext.getBean(beanName), service);

+		Bundle dependency = getDependencyBundle();

+		// stop bundle (and thus the exposed service)

+		dependency.stop();

+		// check if map is still published

+		assertNull("exported for " + beanName + " should have been unpublished", ref.getBundle());

+		// double check the service space

+		assertNull(beanName + " service should be unregistered", bundleContext.getServiceReference(type.getName()));

+

+		dependency.start();

+		waitOnContextCreation(DEP_SYN_NAME);

+

+		// the old reference remains invalid

+		assertNull("the reference should remain invalid", ref.getBundle());

+		// but the service should be back again

+		assertSame(applicationContext.getBean(beanName), service);

+	}

+

+	public void testTwoExportersWithTheSameImporter() throws Exception {

+		// check that both exporters go down one mandatory goes down

+		ServiceReference exporterARef = bundleContext.getServiceReference(Map.class.getName());

+		ServiceReference exporterBRef = bundleContext.getServiceReference(SimpleBean.class.getName());

+

+		Bundle dependency = getDependencyBundle();

+		dependency.stop();

+

+		// check if services are still published

+		assertNull("exportedA should have been unpublished", exporterARef.getBundle());

+		assertNull("exportedB should have been unpublished", exporterBRef.getBundle());

+

+		// double check the service space

+		assertNull("exporterA service should be unregistered", bundleContext.getServiceReference(Map.class.getName()));

+		assertNull("exporterB service should be unregistered", bundleContext.getServiceReference(SimpleBean.class

+				.getName()));

+

+		dependency.start();

+		waitOnContextCreation(DEP_SYN_NAME);

+

+		// the old reference remains invalid

+		assertNull("the reference should remain invalid", exporterARef.getBundle());

+		assertNull("the reference should remain invalid", exporterBRef.getBundle());

+

+		assertNotNull(bundleContext.getServiceReference(Map.class.getName()));

+		assertNotNull(bundleContext.getServiceReference(SimpleBean.class.getName()));

+	}

+

+	protected Bundle getDependencyBundle() {

+		return OsgiBundleUtils.findBundleBySymbolicName(bundleContext, DEP_SYN_NAME);

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		return perms;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SimpleBean.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SimpleBean.java
new file mode 100644
index 0000000..1a45126
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SimpleBean.java
@@ -0,0 +1,29 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.servicedependency;

+

+public class SimpleBean {

+

+	private Object property;

+

+

+	public Object getProperty() {

+		return property;

+	}

+

+	public void setProperty(Object property) {

+		this.property = property;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SingleExportDependingOnMultipleImportTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SingleExportDependingOnMultipleImportTest.java
new file mode 100644
index 0000000..b398dfa
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/servicedependency/SingleExportDependingOnMultipleImportTest.java
@@ -0,0 +1,174 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.servicedependency;

+

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.ServiceReference;

+import org.eclipse.gemini.blueprint.iandt.simpleservice.MyService;

+import org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2;

+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+import org.springframework.util.Assert;

+

+/**

+ * Integration test with multiple imports that are hooked inside the same exporter.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SingleExportDependingOnMultipleImportTest extends BaseIntegrationTest {

+

+	private static final String TCCL_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.tccl";

+

+	private static final String SERVICE_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.simpleservice";

+

+	private static final String SERVICE_2_SYM_NAME = "org.eclipse.gemini.blueprint.iandt.simpleservice2";

+

+	protected String[] getConfigLocations() {

+		return new String[] { "org/eclipse/gemini/blueprint/iandt/servicedependency/single-export-multi-import.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		// load the tccl bundle, plus simple.service + simple.service.2

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,tccl.intf," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt, tccl," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt, simple.service," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt, simple.service2," + getSpringDMVersion() };

+	}

+

+	public void testOneImporterCGoesDownAndThenUpAgain() throws Exception {

+		// importer C = TCCL bundle

+		// check exporter

+		assertTrue("exporter should be running", isExporterStarted());

+

+		takeDownServiceC();

+		assertFalse("serviceC should take exporter down", isExporterStarted());

+		putUpServiceC();

+		// check exporter

+		assertTrue("service C is up again, exporter should be up as well", isExporterStarted());

+	}

+

+	public void testImporterAGoesDownThenImporterBThenImporterAComesUpAgainAndThenB() throws Exception {

+		// check exporter

+		assertTrue("exporter should be running", isExporterStarted());

+

+		// start with A

+

+		// take down A

+		takeDownServiceA();

+		// check exporter

+		assertFalse("serviceA should take exporter down", isExporterStarted());

+

+		// then B

+

+		// take down B

+		takeDownServiceB();

+		// check exporter

+		assertFalse("serviceB should keep exporter down", isExporterStarted());

+

+		// put up A

+		putUpServiceA();

+		// check exporter

+		assertFalse("serviceB is still down so the exporter should be down as well", isExporterStarted());

+		// put up B

+		putUpServiceB();

+		// check exporter

+		assertTrue("service A + B up, exporter should be up as well", isExporterStarted());

+	}

+

+	public void testImportersGoDownOneAfterTheOtherAndTheExporterDoesNotStartUntilAllImportersAreUp() throws Exception {

+		// check exporter

+		assertTrue("exporter should be running", isExporterStarted());

+

+		// take down A

+		takeDownServiceA();

+		assertFalse("serviceA should take exporter down", isExporterStarted());

+

+		takeDownServiceB();

+		// check exporter

+		assertFalse("serviceB should keep exporter down", isExporterStarted());

+

+		takeDownServiceC();

+		// check exporter

+		assertFalse("serviceB should keep exporter down", isExporterStarted());

+

+		putUpServiceA();

+		// check exporter

+		assertFalse("serviceB,C are still down so the exporter should be down as well", isExporterStarted());

+

+		putUpServiceC();

+		assertFalse("serviceB is still down so the exporter should be down as well", isExporterStarted());

+

+		// put up B

+		putUpServiceB();

+		// check exporter

+		assertTrue("service A + B + C up, exporter should be up as well", isExporterStarted());

+	}

+

+	private void checkAndTakeDownService(String beanName, Class<?> type, String bundleSymName) throws Exception {

+		ServiceReference ref = bundleContext.getServiceReference(type.getName());

+		Object service = bundleContext.getService(ref);

+		Assert.isInstanceOf(type, service);

+

+		Bundle dependency = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, bundleSymName);

+		// stop dependency bundle -> no importer -> exporter goes down

+		dependency.stop();

+	}

+

+	private void putUpService(String bundleSymName) throws Exception {

+		Bundle dependency = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, bundleSymName);

+		dependency.start();

+		waitOnContextCreation(bundleSymName);

+	}

+

+	private void takeDownServiceA() throws Exception {

+		checkAndTakeDownService("serviceA", MyService.class, SERVICE_SYM_NAME);

+	}

+

+	private void putUpServiceA() throws Exception {

+		putUpService(SERVICE_SYM_NAME);

+	}

+

+	private void takeDownServiceB() throws Exception {

+		checkAndTakeDownService("serviceB", MyService2.class, SERVICE_2_SYM_NAME);

+	}

+

+	private void putUpServiceB() throws Exception {

+		putUpService(SERVICE_2_SYM_NAME);

+	}

+

+	private void takeDownServiceC() throws Exception {

+		checkAndTakeDownService("serviceC", TCCLService.class, TCCL_SYM_NAME);

+	}

+

+	private void putUpServiceC() throws Exception {

+		putUpService(TCCL_SYM_NAME);

+	}

+

+	private boolean isExporterStarted() throws Exception {

+		return (bundleContext.getServiceReference(SimpleBean.class.getName()) != null);

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		// export package

+		perms.add(new AdminPermission("*", AdminPermission.EXECUTE));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.java
new file mode 100644
index 0000000..48a5d14
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.java
@@ -0,0 +1,110 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceproxy;

+

+import java.util.Collection;

+import java.util.Date;

+import java.util.Iterator;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.aop.framework.DefaultAopProxyFactory;

+import org.eclipse.gemini.blueprint.service.importer.support.internal.collection.OsgiServiceCollection;

+import org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader;

+import org.springframework.util.ClassUtils;

+

+abstract class ServiceCollectionTest extends BaseIntegrationTest {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "net.sourceforge.cglib, com.springsource.net.sf.cglib, 2.1.3" };

+	}

+

+	protected ServiceRegistration publishService(Object obj) throws Exception {

+		return bundleContext.registerService(obj.getClass().getName(), obj, null);

+	}

+

+	public void testCGLIBAvailable() throws Exception {

+		assertTrue(ClassUtils.isPresent("net.sf.cglib.proxy.Enhancer", DefaultAopProxyFactory.class.getClassLoader()));

+	}

+

+	protected Collection createCollection() {

+		BundleDelegatingClassLoader classLoader =

+				BundleDelegatingClassLoader.createBundleClassLoaderFor(bundleContext.getBundle());

+

+		OsgiServiceCollection collection = new OsgiServiceCollection(null, bundleContext, classLoader, null, false);

+		ClassLoader tccl = Thread.currentThread().getContextClassLoader();

+		try {

+			Thread.currentThread().setContextClassLoader(classLoader);

+			collection.setRequiredAtStartup(false);

+			// collection.setInterfaces(new Class<?>[] { Date.class });

+			collection.afterPropertiesSet();

+		} finally {

+			Thread.currentThread().setContextClassLoader(tccl);

+		}

+

+		return collection;

+	}

+

+	public void testCollectionListener() throws Exception {

+		Collection collection = createCollection();

+

+		ServiceReference[] refs = bundleContext.getServiceReferences(null, null);

+

+		assertEquals(refs.length, collection.size());

+		int size = collection.size();

+		// register a service

+		long time = 123456;

+		Date date = new Date(time);

+		ServiceRegistration reg = publishService(date);

+		try {

+			assertEquals(size + 1, collection.size());

+		} finally {

+			reg.unregister();

+		}

+

+		assertEquals(size, collection.size());

+	}

+

+	public void testCollectionContent() throws Exception {

+		Collection collection = createCollection();

+		ServiceReference[] refs = bundleContext.getServiceReferences(null, null);

+

+		assertEquals(refs.length, collection.size());

+		int size = collection.size();

+

+		// register a service

+		long time = 123456;

+		Date date = new Date(time);

+		ServiceRegistration reg = publishService(date);

+		try {

+			assertEquals(size + 1, collection.size());

+			// test service

+			Iterator iter = collection.iterator();

+			// reach our new service index

+			for (int i = 0; i < size; i++) {

+				iter.next();

+			}

+			Object myService = iter.next();

+			// be sure to use classes loaded by the same CL

+			assertTrue(myService instanceof Date);

+			assertEquals(time, ((Date) myService).getTime());

+		} finally {

+			reg.unregister();

+		}

+

+		assertEquals(size, collection.size());

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceListTst.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceListTst.java
new file mode 100644
index 0000000..679ec2c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceListTst.java
@@ -0,0 +1,49 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceproxy;

+

+import java.util.Collection;

+import java.util.List;

+import java.util.ListIterator;

+

+import org.eclipse.gemini.blueprint.service.importer.support.internal.collection.OsgiServiceList;

+import org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class ServiceListTst extends ServiceCollectionTest {

+

+	protected Collection createCollection() {

+		ClassLoader classLoader = BundleDelegatingClassLoader.createBundleClassLoaderFor(bundleContext.getBundle());

+		OsgiServiceList col = new OsgiServiceList(null, bundleContext, classLoader, null, false);

+		col.setRequiredAtStartup(false);

+		// col.setInterfaces(new Class<?>[] { Date.class });

+		col.afterPropertiesSet();

+		return col;

+	}

+

+	public void testListContent() throws Exception {

+		List list = (List) createCollection();

+

+		// test the list iterator

+		ListIterator iter = list.listIterator();

+		Object b = iter.next();

+

+		assertSame(b, iter.previous());

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTst.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTst.java
new file mode 100644
index 0000000..0663ac2
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTst.java
@@ -0,0 +1,119 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.serviceproxy;

+

+import java.util.Date;

+

+import org.aopalliance.aop.Advice;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.ServiceRegistration;

+import org.springframework.aop.framework.ProxyFactory;

+import org.eclipse.gemini.blueprint.service.ServiceUnavailableException;

+import org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceDynamicInterceptor;

+import org.eclipse.gemini.blueprint.test.AbstractConfigurableBundleCreatorTests;

+import org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader;

+import org.eclipse.gemini.blueprint.util.OsgiFilterUtils;

+import org.springframework.util.ClassUtils;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public abstract class ServiceProxyTst extends AbstractConfigurableBundleCreatorTests {

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "net.sourceforge.cglib, com.springsource.net.sf.cglib, 2.1.3" };

+	}

+

+	protected String getManifestLocation() {

+		return null;

+	}

+

+	private ServiceRegistration publishService(Object obj) throws Exception {

+		return bundleContext.registerService(obj.getClass().getName(), obj, null);

+	}

+

+	private Object createProxy(final Class<?> clazz, Advice cardinalityInterceptor) {

+		ProxyFactory factory = new ProxyFactory();

+		factory.setProxyTargetClass(true);

+		factory.setOptimize(true);

+		factory.setTargetClass(clazz);

+

+		factory.addAdvice(cardinalityInterceptor);

+		factory.setFrozen(true);

+

+		return factory.getProxy(ProxyFactory.class.getClassLoader());

+	}

+

+	private Advice createCardinalityAdvice(Class<?> clazz) {

+		ClassLoader classLoader = BundleDelegatingClassLoader.createBundleClassLoaderFor(bundleContext.getBundle());

+		ServiceDynamicInterceptor interceptor = new ServiceDynamicInterceptor(bundleContext, null,

+			OsgiFilterUtils.createFilter(OsgiFilterUtils.unifyFilter(clazz, null)), classLoader);

+		// fast retry

+		interceptor.setMandatoryService(true);

+		interceptor.afterPropertiesSet();

+		interceptor.getRetryTemplate().reset(1);

+		return interceptor;

+

+	}

+

+	public void testCglibLibraryVisibility() {

+		// note that cglib is not declared inside this bundle but should be seen

+		// by spring-core (which contains the util classes)

+		assertTrue(ClassUtils.isPresent("net.sf.cglib.proxy.Enhancer", ProxyFactory.class.getClassLoader()));

+	}

+

+	public void testDynamicEndProxy() throws Exception {

+		long time = 123456;

+		Date date = new Date(time);

+		ServiceRegistration reg = publishService(date);

+		BundleContext ctx = bundleContext;

+

+		try {

+			ServiceReference ref = ctx.getServiceReference(Date.class.getName());

+			assertNotNull(ref);

+			Date proxy = (Date) createProxy(Date.class, createCardinalityAdvice(Date.class));

+			assertEquals(time, proxy.getTime());

+			// take down service

+			reg.unregister();

+			// reference is invalid

+			assertNull(ref.getBundle());

+

+			try {

+				proxy.getTime();

+				fail("should have thrown exception");

+			}

+			catch (ServiceUnavailableException sue) {

+				// service failed

+			}

+

+			// rebind the service

+			reg = publishService(date);

+			// retest the service

+			assertEquals(time, proxy.getTime());

+		}

+		finally {

+			if (reg != null)

+				try {

+					reg.unregister();

+				}

+				catch (Exception ex) {

+					// ignore

+				}

+		}

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/syntheticEvents/ServiceListenerSyntheticEvents.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/syntheticEvents/ServiceListenerSyntheticEvents.java
new file mode 100644
index 0000000..fb83efa
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/syntheticEvents/ServiceListenerSyntheticEvents.java
@@ -0,0 +1,193 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.syntheticEvents;

+

+import java.awt.Polygon;

+import java.awt.Rectangle;

+import java.awt.Shape;

+import java.awt.geom.Area;

+import java.util.ArrayList;

+import java.util.Dictionary;

+import java.util.List;

+import java.util.Map;

+import java.util.Properties;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Constants;

+import org.osgi.framework.ServiceRegistration;

+import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;

+import org.eclipse.gemini.blueprint.util.OsgiServiceUtils;

+

+/**

+ * Integration test for synthetic events delivery of service listeners during

+ * startup/shutdown.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ServiceListenerSyntheticEvents extends BaseIntegrationTest {

+

+	private Shape area, rectangle, polygon;

+

+	private ServiceRegistration areaReg, rectangleReg, polygonReg;

+

+	private OsgiBundleXmlApplicationContext appCtx;

+

+	private static List referenceBindServices, referenceUnbindServices;

+

+	private static List collectionBindServices, collectionUnbindServices;

+

+

+	public static class ReferenceListener {

+

+		public void bind(Object service, Map properties) {

+			referenceBindServices.add(service.toString());

+		};

+

+		public void unbind(Object service, Map properties) {

+			referenceUnbindServices.add(service.toString());

+		};

+	}

+

+	public static class CollectionListener {

+

+		public void bind(Object service, Map properties) {

+			collectionBindServices.add(service.toString());

+		};

+

+		public void unbind(Object service, Map properties) {

+			collectionUnbindServices.add(service.toString());

+		};

+	}

+

+

+	// register multiple services of the same type inside OSGi space

+	private void registerMultipleServices() {

+		area = new Area();

+		rectangle = new Rectangle();

+		polygon = new Polygon();

+

+		Dictionary polygonProp = new Properties();

+		polygonProp.put(Constants.SERVICE_RANKING, new Integer(1));

+		// first register polygon

+		polygonReg = bundleContext.registerService(Shape.class.getName(), polygon, polygonProp);

+

+		// then rectangle

+		Dictionary rectangleProp = new Properties();

+		rectangleProp.put(Constants.SERVICE_RANKING, new Integer(10));

+		rectangleReg = bundleContext.registerService(Shape.class.getName(), rectangle, rectangleProp);

+

+		// then area

+		Dictionary areaProp = new Properties();

+		areaProp.put(Constants.SERVICE_RANKING, new Integer(100));

+		areaReg = bundleContext.registerService(Shape.class.getName(), area, areaProp);

+

+	}

+

+	protected void onSetUp() {

+		referenceBindServices = new ArrayList();

+		referenceUnbindServices = new ArrayList();

+		collectionBindServices = new ArrayList();

+		collectionUnbindServices = new ArrayList();

+	}

+

+	protected void onTearDown() {

+		OsgiServiceUtils.unregisterService(areaReg);

+		OsgiServiceUtils.unregisterService(rectangleReg);

+		OsgiServiceUtils.unregisterService(polygonReg);

+		try {

+			if (appCtx != null)

+				appCtx.close();

+		}

+		catch (Exception ex) {

+			ex.printStackTrace();

+		}

+		referenceBindServices = null;

+		referenceUnbindServices = null;

+		collectionBindServices = null;

+		collectionUnbindServices = null;

+	}

+

+	private void createAppCtx() {

+		appCtx = new OsgiBundleXmlApplicationContext(

+			new String[] { "/org/eclipse/gemini/blueprint/iandt/syntheticEvents/importers.xml" });

+		appCtx.setBundleContext(bundleContext);

+		appCtx.refresh();

+	}

+

+	// create appCtx each time since we depend we test startup/shutdown behaviour

+	// and cannot have shared states

+	public void testServiceReferenceEventsOnStartupWithMultipleServicesPresent() throws Exception {

+		registerMultipleServices();

+		createAppCtx();

+

+		assertEquals("only one service bound at startup", 1, referenceBindServices.size());

+		assertEquals("wrong service bound", area.toString(), referenceBindServices.get(0).toString());

+	}

+

+	public void testServiceReferenceEventsDuringLifetimeWithMultipleServicesPresent() throws Exception {

+		createAppCtx();

+		registerMultipleServices();

+

+		assertEquals("multiple services should have been bound during runtime", 3, referenceBindServices.size());

+		assertEquals("wrong 1st service bound", polygon.toString(), referenceBindServices.get(0).toString());

+		assertEquals("wrong 2nd service bound", rectangle.toString(), referenceBindServices.get(1).toString());

+		assertEquals("wrong 3rd service bound", area.toString(), referenceBindServices.get(2).toString());

+	}

+

+	public void testServiceReferenceEventsOnShutdownWithMultipleServicesPresent() throws Exception {

+		createAppCtx();

+		registerMultipleServices();

+		appCtx.close();

+

+		assertEquals("only one service unbound at shutdown", 1, referenceUnbindServices.size());

+		assertEquals("wrong unbind at shutdown", area.toString(), referenceUnbindServices.get(0).toString());

+		appCtx = null;

+	}

+

+	public void testServiceCollectionEventsOnStartupWithMultipleServicesPresent() throws Exception {

+		registerMultipleServices();

+		createAppCtx();

+

+		assertEquals("all services should have been bound at startup", 3, collectionBindServices.size());

+		assertEquals("wrong service bound", polygon.toString(), collectionBindServices.get(0).toString());

+		assertEquals("wrong service bound", rectangle.toString(), collectionBindServices.get(1).toString());

+		assertEquals("wrong service bound", area.toString(), collectionBindServices.get(2).toString());

+

+	}

+

+	public void testServiceCollectionEventsDuringLifetimeWithMultipleServicesPresent() throws Exception {

+		createAppCtx();

+		registerMultipleServices();

+

+		assertEquals("multiple services should have been bound during runtime", 3, referenceBindServices.size());

+		assertEquals("wrong 1st service bound", polygon.toString(), collectionBindServices.get(0).toString());

+		assertEquals("wrong 2nd service bound", rectangle.toString(), collectionBindServices.get(1).toString());

+		assertEquals("wrong 3rd service bound", area.toString(), collectionBindServices.get(2).toString());

+	}

+

+	public void testServiceCollectionEventsOnShutdownWithMultipleServicesPresent() throws Exception {

+		createAppCtx();

+		registerMultipleServices();

+		appCtx.close();

+

+		assertEquals("all services should have been bound at startup", 3, collectionUnbindServices.size());

+		assertEquals("wrong 1st service bound", polygon.toString(), collectionUnbindServices.get(0).toString());

+		assertEquals("wrong 2nd service bound", rectangle.toString(), collectionUnbindServices.get(1).toString());

+		assertEquals("wrong 3rd service bound", area.toString(), collectionUnbindServices.get(2).toString());

+		appCtx = null;

+	}

+

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ClientOnlyTcclTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ClientOnlyTcclTest.java
new file mode 100644
index 0000000..e64d366
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ClientOnlyTcclTest.java
@@ -0,0 +1,169 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.tcclManagement;

+

+import java.net.URL;

+import java.net.URLClassLoader;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleException;

+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;

+import org.eclipse.gemini.blueprint.util.OsgiBundleUtils;

+

+/**

+ * Test for TCCL handling only on the client side. That is the service doesn't provide any handling.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ClientOnlyTcclTest extends BaseIntegrationTest {

+

+	private static final String CLIENT_RESOURCE =

+			"/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-resource.properties";

+

+	private static final String SERVICE_RESOURCE =

+			"/org/eclipse/gemini/blueprint/iandt/tccl/internal/internal-resource.file";

+

+	private static final String SERVICE_PUBLIC_RESOURCE = "/org/eclipse/gemini/blueprint/iandt/tccl/service-resource.file";

+

+	private static final String CLIENT_CLASS = "org.eclipse.gemini.blueprint.iandt.tcclManagement.ClientOnlyTcclTest";

+

+	private static final String SERVICE_CLASS =

+			"org.eclipse.gemini.blueprint.iandt.tccl.internal.PrivateTCCLServiceImplementation";

+

+	private static final String SERVICE_PUBLIC_CLASS = "org.eclipse.gemini.blueprint.iandt.tccl.TCCLService";

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-context.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,tccl.intf," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt,tccl," + getSpringDMVersion() };

+	}

+

+	public void testTCCLUnmanaged() throws Exception {

+		ClassLoader loader = Thread.currentThread().getContextClassLoader();

+		TCCLService tccl = getUnmanagedTCCL();

+		assertSame(loader, tccl.getTCCL());

+	}

+

+	public void testTCCLUnmanagedWithNullClassLoader() throws Exception {

+		ClassLoader previous = Thread.currentThread().getContextClassLoader();

+		try {

+			Thread.currentThread().setContextClassLoader(null);

+			ClassLoader cl = getUnmanagedTCCL().getTCCL();

+			assertNull(cl);

+		} finally {

+			Thread.currentThread().setContextClassLoader(previous);

+		}

+	}

+

+	public void testTCCLUnmanagedWithPredefinedClassLoader() throws Exception {

+		URLClassLoader dummyCL = new URLClassLoader(new URL[0]);

+

+		ClassLoader previous = Thread.currentThread().getContextClassLoader();

+		try {

+			Thread.currentThread().setContextClassLoader(dummyCL);

+			ClassLoader cl = getUnmanagedTCCL().getTCCL();

+			assertSame(dummyCL, cl);

+		} finally {

+			Thread.currentThread().setContextClassLoader(previous);

+		}

+	}

+

+	public void testClientTCCLOnClientClasses() throws Exception {

+		ClassLoader clientCL = getClientTCCL().getTCCL();

+		assertNotNull(clientCL);

+		assertNotNull(clientCL.loadClass(CLIENT_CLASS));

+	}

+

+	public void testClientTCCLOnClientResources() throws Exception {

+		ClassLoader clientCL = getClientTCCL().getTCCL();

+		assertNotNull(clientCL);

+		assertNotNull(clientCL.getResource(CLIENT_RESOURCE));

+	}

+

+	public void testClientTCCLWithServiceClasses() throws Exception {

+		ClassLoader current = Thread.currentThread().getContextClassLoader();

+		ClassLoader cl = getClientTCCL().getTCCL();

+		System.out.println("current :" + current);

+		System.out.println("cl : " + cl);

+		cl.loadClass(SERVICE_PUBLIC_CLASS);

+		failToLoadClass(cl, SERVICE_CLASS);

+	}

+

+	public void testClientTCCLWithServiceResource() throws Exception {

+		assertNull(getClientTCCL().getTCCL().getResource(SERVICE_RESOURCE));

+	}

+

+	public void testServiceProvidedTCCLOnClasses() throws Exception {

+		refreshTCCLBundle();

+		ClassLoader cl = getServiceProviderTCCL().getTCCL();

+		cl.loadClass(SERVICE_PUBLIC_CLASS);

+		cl.loadClass(SERVICE_CLASS);

+	}

+

+	public void testServiceProvidedTCCLOnResources() throws Exception {

+		assertNotNull(getServiceProviderTCCL().getTCCL().getResource(SERVICE_RESOURCE));

+	}

+

+	public void testServiceProviderTCCLOnClientClasses() throws Exception {

+		failToLoadClass(getServiceProviderTCCL().getTCCL(), CLIENT_CLASS);

+	}

+

+	public void testServiceProviderTCCLOnClientResources() throws Exception {

+		assertNull(getServiceProviderTCCL().getTCCL().getResource(CLIENT_RESOURCE));

+	}

+

+	private void failToLoadClass(ClassLoader cl, String className) {

+		try {

+			cl.loadClass(className);

+			fail("shouldn't be able to load class " + className);

+		} catch (ClassNotFoundException cnfe) {

+			// expected

+		}

+	}

+

+	private TCCLService getUnmanagedTCCL() {

+		return (TCCLService) applicationContext.getBean("unmanaged");

+	}

+

+	private TCCLService getServiceProviderTCCL() {

+		return (TCCLService) applicationContext.getBean("service-provider");

+	}

+

+	private TCCLService getClientTCCL() {

+		return (TCCLService) applicationContext.getBean("client");

+	}

+

+	private void refreshTCCLBundle() {

+		Bundle bundle = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, "org.eclipse.gemini.blueprint.iandt.tccl");

+		try {

+			bundle.update();

+		} catch (BundleException be) {

+		}

+	}

+

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		perms.add(new AdminPermission("(name=org.eclipse.gemini.blueprint.iandt.tccl)", AdminPermission.RESOURCE));

+		perms.add(new AdminPermission("(name=org.eclipse.gemini.blueprint.iandt.tccl)", AdminPermission.CLASS));

+		return perms;

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ServiceTcclTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ServiceTcclTest.java
new file mode 100644
index 0000000..64f9010
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/tcclManagement/ServiceTcclTest.java
@@ -0,0 +1,162 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.tcclManagement;

+

+import java.net.URL;

+import java.net.URLClassLoader;

+import java.util.List;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.AdminPermission;

+import org.osgi.framework.ServiceReference;

+import org.eclipse.gemini.blueprint.iandt.tccl.TCCLService;

+

+/**

+ * Test for TCCL handling from the server side. This test checks that the service provider has always priority no matter

+ * the client setting.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class ServiceTcclTest extends BaseIntegrationTest {

+

+	private static final String CLIENT_RESOURCE =

+			"/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-resource.properties";

+

+	private static final String SERVICE_RESOURCE =

+			"/org/eclipse/gemini/blueprint/iandt/tccl/internal/internal-resource.file";

+

+	private static final String SERVICE_PUBLIC_RESOURCE = "/org/eclipse/gemini/blueprint/iandt/tccl/service-resource.file";

+

+	private static final String CLIENT_CLASS = "org.eclipse.gemini.blueprint.iandt.tcclManagement.ServiceTcclTest";

+

+	private static final String SERVICE_CLASS =

+			"org.eclipse.gemini.blueprint.iandt.tccl.internal.PrivateTCCLServiceImplementation";

+

+	private static final String SERVICE_PUBLIC_CLASS = "org.eclipse.gemini.blueprint.iandt.tccl.TCCLService";

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/tcclManagement/service-context.xml" };

+	}

+

+	protected String[] getTestBundlesNames() {

+		return new String[] { "org.eclipse.gemini.blueprint.iandt,tccl.intf," + getSpringDMVersion(),

+				"org.eclipse.gemini.blueprint.iandt,tccl," + getSpringDMVersion() };

+	}

+

+	public void testSanity() throws Exception {

+		ServiceReference[] refs =

+				bundleContext.getServiceReferences("org.eclipse.gemini.blueprint.iandt.tccl.TCCLService",

+						"(tccl=service-provider)");

+		System.out.println(bundleContext.getService(refs[0]));

+	}

+

+	public void testServiceProviderTCCLAndUnmanagedClient() throws Exception {

+		ClassLoader loader = Thread.currentThread().getContextClassLoader();

+		TCCLService tccl = getUnmanagedTCCL();

+		assertNotSame("service provide CL hasn't been set", loader, tccl.getTCCL());

+	}

+

+	public void testServiceProviderTCCLWithUnmanagedClientWithNullClassLoader() throws Exception {

+		ClassLoader previous = Thread.currentThread().getContextClassLoader();

+		try {

+			Thread.currentThread().setContextClassLoader(null);

+			ClassLoader cl = getUnmanagedTCCL().getTCCL();

+			assertNotNull("service provide CL hasn't been set", cl);

+		} finally {

+			Thread.currentThread().setContextClassLoader(previous);

+		}

+	}

+

+	public void testServiceProviderTCCLAndUnmanagedClientWithPredefinedClassLoader() throws Exception {

+		URLClassLoader dummyCL = new URLClassLoader(new URL[0]);

+

+		ClassLoader previous = Thread.currentThread().getContextClassLoader();

+		try {

+			Thread.currentThread().setContextClassLoader(dummyCL);

+			ClassLoader cl = getUnmanagedTCCL().getTCCL();

+			assertNotSame(dummyCL, cl);

+		} finally {

+			Thread.currentThread().setContextClassLoader(previous);

+		}

+	}

+

+	public void testServiceProviderTCCLWithClientTCCLOnClasses() throws Exception {

+		failToLoadClass(getClientTCCL().getTCCL(), CLIENT_CLASS);

+	}

+

+	public void testServiceProviderTCCLWithClientTCCLOnResources() throws Exception {

+		assertNull(getClientTCCL().getTCCL().getResource(CLIENT_RESOURCE));

+	}

+

+	public void testServiceProviderTCCLWithClientTCCLWithServiceClasses() throws Exception {

+		ClassLoader cl = getClientTCCL().getTCCL();

+		cl.loadClass(SERVICE_PUBLIC_CLASS);

+		cl.loadClass(SERVICE_CLASS);

+	}

+

+	public void testServiceProviderTCCLWithClientTCCLWithServiceResource() throws Exception {

+		assertNotNull(getClientTCCL().getTCCL().getResource(SERVICE_PUBLIC_CLASS.replace(".", "/").concat(".class")));

+		assertNotNull(getClientTCCL().getTCCL().getResource(SERVICE_RESOURCE));

+	}

+

+	public void testServiceProvidedTCCLOnClasses() throws Exception {

+		ClassLoader cl = getServiceProviderTCCL().getTCCL();

+

+		cl.loadClass(SERVICE_PUBLIC_CLASS);

+		cl.loadClass(SERVICE_CLASS);

+	}

+

+	public void testServiceProvidedTCCLOnResources() throws Exception {

+		assertNotNull(getServiceProviderTCCL().getTCCL().getResource(SERVICE_RESOURCE));

+	}

+

+	public void testServiceProviderTCCLOnClientClasses() throws Exception {

+		failToLoadClass(getServiceProviderTCCL().getTCCL(), CLIENT_CLASS);

+	}

+

+	public void testServiceProviderTCCLOnClientResources() throws Exception {

+		assertNull(getServiceProviderTCCL().getTCCL().getResource(CLIENT_RESOURCE));

+	}

+

+	private void failToLoadClass(ClassLoader cl, String className) {

+		try {

+			cl.loadClass(className);

+			fail("shouldn't be able to load class " + className);

+		} catch (ClassNotFoundException cnfe) {

+			// expected

+		}

+	}

+

+	private TCCLService getUnmanagedTCCL() {

+		return (TCCLService) applicationContext.getBean("unmanaged");

+	}

+

+	private TCCLService getServiceProviderTCCL() {

+		return (TCCLService) applicationContext.getBean("service-provider");

+	}

+

+	private TCCLService getClientTCCL() {

+		return (TCCLService) applicationContext.getBean("client");

+	}

+

+	// provide permission for loading class using the service bundle

+	protected List getTestPermissions() {

+		List perms = super.getTestPermissions();

+		perms.add(new AdminPermission("(name=org.eclipse.gemini.blueprint.iandt.tccl)", AdminPermission.CLASS));

+		perms.add(new AdminPermission("(name=org.eclipse.gemini.blueprint.iandt.tccl)", AdminPermission.RESOURCE));

+		return perms;

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.java
new file mode 100644
index 0000000..87f0928
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.java
@@ -0,0 +1,48 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;

+

+import java.util.Arrays;

+import java.util.HashMap;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**

+ * Test the injection executed on the current test. This verifies that the

+ * application context has been created and that injection properly executes.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class AppCtxInjectionTest extends BaseIntegrationTest {

+

+	private HashMap map;

+

+

+	public void setMap(HashMap map) {

+		this.map = map;

+	}

+

+	@SuppressWarnings("deprecation")

+	public void testInjection() throws Exception {

+		System.out.println(Arrays.toString(applicationContext.getBeanDefinitionNames()));

+		assertNotNull(map);

+		assertEquals(applicationContext.getBean("injected-bean"), map);

+	}

+

+	protected String[] getConfigLocations() {

+		return new String[] { "/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.xml" };

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/BundleCreationTst.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/BundleCreationTst.java
new file mode 100644
index 0000000..8761029
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/BundleCreationTst.java
@@ -0,0 +1,54 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**

+ * Test to check if the testcase is properly packaged in a bundle jar and deploy

+ * on the OSGi platform.

+ * 

+ * Note: this test case is not intended to be run (hence the Tst name).

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class BundleCreationTst extends BaseIntegrationTest {

+

+	protected String[] getBundleLocations() {

+		// no test bundle is included

+		return new String[] {};

+	}

+

+	public void testAssertionPass() {

+		assertTrue(true);

+	}

+

+	public void testAssertionFailure() {

+		assertTrue(false);

+	}

+

+	public void testFailure() {

+		fail("this is a failure");

+	}

+

+	public void testException() {

+		throw new RuntimeException("this is an exception");

+	}

+

+	public void testError() {

+		throw new Error("this is an error");

+	}

+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/OsgiPlatformTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/OsgiPlatformTest.java
new file mode 100644
index 0000000..e2b0a21
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/OsgiPlatformTest.java
@@ -0,0 +1,50 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+import org.osgi.framework.Constants;

+import org.eclipse.gemini.blueprint.test.AbstractConfigurableBundleCreatorTests;

+

+/**

+ * This test might log exceptions since the OSGi platform may try to register an

+ * URLStreamFactory every time they start (during {@link #setName(String)}).

+ * 

+ * Basically, this just reads the underlying platform and checks its vendor to

+ * make sure the mapping is correct.

+ * 

+ * @author Costin Leau

+ * 

+ */

+public class OsgiPlatformTest extends BaseIntegrationTest {

+

+	private String platform;

+

+

+	protected void onSetUp() {

+		platform = getPlatformName();

+	}

+

+	public void testOsgiPlatform() throws Exception {

+		String vendor = bundleContext.getProperty(Constants.FRAMEWORK_VENDOR);

+

+		if ("Eclipse".equals(vendor))

+			assertTrue(platform.indexOf("Equinox") >= 0);

+		if ("Apache Software Foundation".equals(vendor))

+			assertTrue(platform.indexOf("Felix") >= 0);

+		if ("Knopflerfish".equals(vendor))

+			assertTrue(platform.indexOf("Knopflerfish") >= 0);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.java
new file mode 100644
index 0000000..d1cb7d3
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.java
@@ -0,0 +1,89 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc., Oracle Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *   Oracle Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;
+
+import junit.framework.TestCase;
+import junit.framework.TestFailure;
+import junit.framework.TestResult;
+
+/**
+ * Start executing the {@link RunBundleCreationTest} (which is an integration
+ * test) and tests failures and errors.
+ * 
+ * @author Hal Hildebrand
+ * @author Costin Leau
+ */
+public class RunBundleCreationTest extends TestCase {
+
+	private TestCase test;
+
+	private TestResult result;
+
+
+	protected void setUp() throws Exception {
+		test = new BundleCreationTst();
+		result = new TestResult();
+	}
+
+	public void testAssertionPass() {
+		executeTest("testAssertionPass");
+		assertEquals(0, result.errorCount());
+		assertEquals(0, result.failureCount());
+	}
+
+	public void testAssertionFailure() {
+		executeTest("testAssertionFailure");
+		assertEquals("failure counted as error", 0, result.errorCount());
+		assertEquals("failure ignored", 1, result.failureCount());
+
+	}
+
+	public void testFailure() {
+		executeTest("testFailure");
+		assertEquals("failure counted as error", 0, result.errorCount());
+		assertEquals("failure ignored", 1, result.failureCount());
+	}
+
+	public void testException() {
+		executeTest("testException");
+		assertEquals("error not considered", 1, result.errorCount());
+		assertEquals("error considered failure", 0, result.failureCount());
+	}
+
+	public void testExceptionClass() throws Exception {
+		executeTest("testException");
+		TestFailure failure = (TestFailure) result.errors().nextElement();
+		assertTrue(failure.thrownException() instanceof RuntimeException);
+	}
+
+	public void testError() {
+		executeTest("testError");
+		assertEquals("error not considered", 1, result.errorCount());
+		assertEquals("error considered failure", 0, result.failureCount());
+	}
+
+	public void testErrorClass() throws Exception {
+		executeTest("testError");
+		TestFailure failure = (TestFailure) result.errors().nextElement();
+		assertTrue(failure.thrownException() instanceof Error);
+	}
+
+	private void executeTest(String testMethod) {
+		test.setName(testMethod);
+		test.run(result);
+		assertEquals(1, result.runCount());
+	}
+}
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestRunner.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestRunner.java
new file mode 100644
index 0000000..0cf411c
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestRunner.java
@@ -0,0 +1,52 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;

+

+import junit.framework.TestCase;

+import junit.framework.TestResult;

+

+import org.springframework.test.ConditionalTestCase;

+

+/**

+ * @author Costin Leau

+ * 

+ */

+public class SkipTestRunner extends TestCase {

+

+	private TestCase test;

+

+	private TestResult result;

+

+

+	protected void setUp() throws Exception {

+		test = new SkipTestsTst();

+		result = new TestResult();

+	}

+

+	public void testSkippedTestProperlyRecorded() throws Exception {

+		executeTest(SkipTestsTst.TEST_SKIPPED_1);

+		executeTest(SkipTestsTst.TEST_RAN);

+		executeTest(SkipTestsTst.TEST_SKIPPED_2);

+

+		// tests are being ran as far as JUnit is concerned

+		assertEquals("tests are being not being ran by JUnit", 3, result.runCount());

+		assertEquals("skipped tests not properly recorded", 2, ConditionalTestCase.getDisabledTestCount());

+	}

+

+	private void executeTest(String testMethod) {

+		test.setName(testMethod);

+		test.run(result);

+	}

+}

diff --git a/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestsTst.java b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestsTst.java
new file mode 100644
index 0000000..3f286f9
--- /dev/null
+++ b/integration-tests/tests/src/test/java/org/eclipse/gemini/blueprint/iandt/testingFramework/SkipTestsTst.java
@@ -0,0 +1,46 @@
+/******************************************************************************

+ * Copyright (c) 2006, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * and Apache License v2.0 which accompanies this distribution. 

+ * The Eclipse Public License is available at 

+ * http://www.eclipse.org/legal/epl-v10.html and the Apache License v2.0

+ * is available at http://www.opensource.org/licenses/apache2.0.php.

+ * You may elect to redistribute this code under either of these licenses. 

+ * 

+ * Contributors:

+ *   VMware Inc.

+ *****************************************************************************/

+

+package org.eclipse.gemini.blueprint.iandt.testingFramework;

+

+import org.eclipse.gemini.blueprint.iandt.BaseIntegrationTest;

+

+/**
+ * 

+ * @author Costin Leau

+ * 

+ */

+public class SkipTestsTst extends BaseIntegrationTest {

+

+	static final String TEST_SKIPPED_1 = "testFirstSkipped";

+	static final String TEST_SKIPPED_2 = "testSecondSkipped";

+	static final String TEST_RAN = "testActuallyRan";

+

+

+	public void testFirstSkipped() throws Exception {

+		fail("test should be skipped");

+	}

+

+	public void testActuallyRan() throws Exception {

+	}

+

+	public void testSecondSkipped() throws Exception {

+		fail("test should be skipped");

+	}

+

+	protected boolean isDisabledInThisEnvironment(String testMethodName) {

+		return testMethodName.endsWith("Skipped");

+	}

+

+}

diff --git a/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file b/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file
new file mode 100644
index 0000000..088de99
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/folder-test.file
@@ -0,0 +1 @@
+some file
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file b/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file
new file mode 100644
index 0000000..088de99
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/bundleclasspath/folder/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file
@@ -0,0 +1 @@
+some file
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/bundleclasspath/simple.jar b/integration-tests/tests/src/test/resources/bundleclasspath/simple.jar
new file mode 100644
index 0000000..606e096
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/bundleclasspath/simple.jar
Binary files differ
diff --git a/integration-tests/tests/src/test/resources/expanded-bundle.jar/META-INF/MANIFEST.MF b/integration-tests/tests/src/test/resources/expanded-bundle.jar/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ad44e6d
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/expanded-bundle.jar/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.io.expanded.bundle

+Manifest-Version: 1.0

+Bundle-ManifestVersion: 2

diff --git a/integration-tests/tests/src/test/resources/expanded-bundle.jar/resource.res b/integration-tests/tests/src/test/resources/expanded-bundle.jar/resource.res
new file mode 100644
index 0000000..db10b4a
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/expanded-bundle.jar/resource.res
@@ -0,0 +1 @@
+some resource
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/log4j.properties b/integration-tests/tests/src/test/resources/log4j.properties
new file mode 100644
index 0000000..0d39fc6
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/log4j.properties
@@ -0,0 +1,34 @@
+log4j.rootCategory=WARN, stdout, file
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout.ConversionPattern=%t %p [%c{2}] - %m%n
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.threshold=TRACE
+
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=out.log
+log4j.appender.stdout.threshold=TRACE
+log4j.appender.file.MaxFileSize=100KB
+# Keep one backup file
+log4j.appender.file.MaxBackupIndex=2
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern==%t %p [%c{2}] - %m%n
+
+#log4j.logger.org.springframework.osgi.web.tomcat.internal=TRACE
+log4j.logger.org.springframework=INFO
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.activator=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.iandt=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.test=TRACE
+
+#log4j.logger.org.eclipse.gemini.blueprint.service.exporter.support.internal.support=TRACE
+# namespace resolving
+#log4j.logger.org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.context.support.DelegatedNamespaceHandlerResolver=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.support.NamespacePlugins=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.support.NamespaceManager=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.support=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.service.exporter.support=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.blueprint.activator.support=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.activator=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.extender.internal.blueprint=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.service.importer.support.internal.aop=TRACE
+#log4j.logger.org.eclipse.gemini.blueprint.service.dependency.internal=TRACE
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/namespace/ns.jar b/integration-tests/tests/src/test/resources/namespace/ns.jar
new file mode 100644
index 0000000..ce6d592
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/namespace/ns.jar
Binary files differ
diff --git a/integration-tests/tests/src/test/resources/norootcpbundle.jar b/integration-tests/tests/src/test/resources/norootcpbundle.jar
new file mode 100644
index 0000000..1a59936
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/norootcpbundle.jar
Binary files differ
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.MF
new file mode 100644
index 0000000..c006ccb
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/ScopingTest.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0

+Bundle-Name: Integration test for OSGi bundle scoping

+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.scope.integration

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.eclipse.gemini.blueprint.test.JUnitTestActivator

+Import-Package: junit.framework,

+  org.osgi.framework,

+  org.apache.commons.logging,

+  org.springframework.util,

+  org.eclipse.gemini.blueprint.service,

+  org.eclipse.gemini.blueprint.util,

+  org.eclipse.gemini.blueprint.test,

+  org.eclipse.gemini.blueprint.test.platform,

+  org.eclipse.gemini.blueprint.iandt.scope.common,

+  org.eclipse.gemini.blueprint.iandt.scope.a,

+  org.eclipse.gemini.blueprint.iandt.scope.b,

+  org.eclipse.gemini.blueprint.test.provisioning,

+  org.springframework.context,

+  org.springframework.test

+ 

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/scope-context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/scope-context.xml
new file mode 100644
index 0000000..0fc2f54
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/bundleScope/scope-context.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	default-lazy-init="false">

+

+	<bean id="props" class="java.util.Properties" destroy-method="clear" scope="bundle"/>

+	

+	<osgi:service interface="java.util.Map" ref="props"/>

+	

+	<bean id="object" class="java.lang.Object" scope="prototype"/>

+	<osgi:service auto-export="all-classes" ref="object"/>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.MF
new file mode 100644
index 0000000..b20525d
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cardinality0to1/Cardinality0to1Test.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of OSGi service reference cardinality {0..1}
+Bundle-SymbolicName: org.springframework.osgi.iandt.cardinality.0to1
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.platform,
+ org.springframework.osgi.service,
+ org.springframework.osgi.iandt.simpleservice2,
+ org.springframework.osgi.iandt.cardinality0to1.test 
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/package.file b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/package.file
new file mode 100644
index 0000000..088de99
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/package.file
@@ -0,0 +1 @@
+some file
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file
new file mode 100644
index 0000000..088de99
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/compliance/io/test.file
@@ -0,0 +1 @@
+some file
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/bundleContextAwareTest.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/bundleContextAwareTest.xml
new file mode 100644
index 0000000..add395d
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/bundleContextAwareTest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	default-lazy-init="false">

+

+	<bean id="bean"

+		class="org.eclipse.gemini.blueprint.iandt.context.BundleContextAwareTest$BundleContextAwareHolder" />

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/no-op-context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/no-op-context.xml
new file mode 100644
index 0000000..fa4b355
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/context/no-op-context.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<bean id="bean" class="java.lang.Object" />

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-collection-importer.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-collection-importer.xml
new file mode 100644
index 0000000..7c931f1
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-collection-importer.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<bean id="listenerA"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerA">

+		<property name="target" ref="importer" />

+	</bean>

+	

+	<bean id="listenerB"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerB">

+		<property name="target" ref="importer" />

+	</bean>

+	

+	<osgi:set id="importer" interface="java.awt.Shape" cardinality="0..N">

+		<osgi:reference-listener bind-method="bind" ref="listenerA" />

+		<osgi:reference-listener bind-method="bind" ref="listenerB" />

+	</osgi:set>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-exporter.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-exporter.xml
new file mode 100644
index 0000000..c6c3eba
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-exporter.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<bean id="listenerA"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerA">

+		<property name="target" ref="exporter" />

+	</bean>

+	

+	<bean id="listenerB"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerB">

+		<property name="target" ref="exporter" />

+	</bean>

+	

+	<osgi:service id="exporter" auto-export="all-classes">

+		<osgi:registration-listener registration-method="bind" ref="listenerA"/>

+		<osgi:registration-listener registration-method="bind" ref="listenerB"/>

+		<bean id="shape" class="java.awt.Polygon"/>

+	</osgi:service>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-reference-importer.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-reference-importer.xml
new file mode 100644
index 0000000..fb964a8
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/cycles/top-level-reference-importer.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<bean id="listenerA"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerA">

+		<property name="target" ref="importer" />

+	</bean>

+	

+	<bean id="listenerB"

+		class="org.eclipse.gemini.blueprint.iandt.cycles.ListenerB">

+		<property name="target" ref="importer" />

+	</bean>

+

+	<osgi:reference id="importer" interface="java.awt.Shape" cardinality="0..1">

+		<osgi:reference-listener bind-method="bind" ref="listenerA" />

+		<osgi:reference-listener bind-method="bind" ref="listenerB" />			 

+	</osgi:reference>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.MF
new file mode 100644
index 0000000..37871a7
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/dependency/DependencyTest.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of Spring dependencies
+Bundle-SymbolicName: org.springframework.osgi.iandt.dependency.functional
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.test,
+ org.springframework.osgi.util,
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.platform
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.MF
new file mode 100644
index 0000000..d63cf95
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/duplicateClass/DuplicateClassTest.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0

+Bundle-Name: Functional testing of Spring dependencies

+Bundle-SymbolicName: org.springframework.osgi.iandt.duplicateClass.functional

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.eclipse.gemini.blueprint.test.JUnitTestActivator

+DynamicImport-Package: org.eclipse.gemini.blueprint.iandt.simpleservice,

+ org.eclipse.gemini.blueprint.iandt.simpleservice.impl    

+Import-Package: junit.framework,

+ org.osgi.framework,

+ org.springframework.core.io,

+ org.eclipse.gemini.blueprint.util,

+ org.eclipse.gemini.blueprint.test,

+ org.eclipse.gemini.blueprint.test.platform,

+ org.eclipse.gemini.blueprint.test.provisioning,

+ org.springframework.test,

+ org.apache.commons.logging

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/exportimport/export-import.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/exportimport/export-import.xml
new file mode 100644
index 0000000..faa1d3e
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/exportimport/export-import.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:p="http://www.springframework.org/schema/p"

+	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">

+

+	<bean id="map" class="java.util.HashMap" />

+

+	<osgi:service id="export1" auto-export="interfaces" ref="map">

+		<osgi:service-properties>

+			<entry key="use" value="case"/>

+		</osgi:service-properties>

+	</osgi:service>

+	<osgi:service id="export2" auto-export="interfaces" ref="map" />

+

+

+	<osgi:list id="list" interface="java.io.Serializable" cardinality="0..N">

+		<osgi:reference-listener bind-method="bind" unbind-method="unbind">

+			<bean class="org.eclipse.gemini.blueprint.iandt.exportimport.Listener" />

+		</osgi:reference-listener>

+	</osgi:list>

+	

+	<osgi:reference id="na" interface="java.util.Queue"/>

+	

+	<osgi:service id="export-na" auto-export="interfaces" ref="map" depends-on="na">

+		<osgi:registration-listener 

+			registration-method="bind" 

+			unregistration-method="unbind">

+			<bean class="org.eclipse.gemini.blueprint.iandt.exportimport.Listener" />

+		</osgi:registration-listener>

+		<osgi:service-properties>

+			<entry key="use" value="case"/>

+		</osgi:service-properties>

+	</osgi:service>

+	

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/extender/configuration/config.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/extender/configuration/config.xml
new file mode 100644
index 0000000..7e15c81
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/extender/configuration/config.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:p="http://www.springframework.org/schema/p"

+	xsi:schemaLocation="

+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+		http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<osgi:reference id="appCtx"

+		interface="org.springframework.context.ApplicationContext"

+		filter="(Bundle-SymbolicName=org.eclipse.gemini.blueprint.extender)"

+		cardinality="0..1" />

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/collection.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/collection.xml
new file mode 100644
index 0000000..571079f
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/collection.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	osgi:default-timeout="10" osgi:default-cardinality="0..X">

+

+	<list id="reference-list" interface="java.awt.Shape" member-type="service-reference" availability="optional">

+		<listener bind-method="bind" unbind-method="unbind" ref="listener"/>

+	</list>

+ 

+ 	<beans:bean id="listener" class="org.eclipse.gemini.blueprint.iandt.importer.Listener"/>

+ 	

+</beans:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/importer-ordering.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/importer-ordering.xml
new file mode 100644
index 0000000..7cd09b5
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/importer/importer-ordering.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	osgi:default-timeout="10" osgi:default-cardinality="0..X">

+

+	<set id="setWithServiceOrder">

+		<interfaces>

+			<beans:value>org.eclipse.gemini.blueprint.iandt.importer.ServiceComparatorTest$MyInterface</beans:value>

+			<beans:value>java.io.Serializable</beans:value>

+			<beans:value>java.lang.Cloneable</beans:value>

+		</interfaces>

+		<comparator><natural basis="service"/></comparator>

+	</set>

+ 

+ 	<reference id="multiInterfaceProxy" cardinality="0..1">

+		<interfaces>

+			<beans:value>org.eclipse.gemini.blueprint.iandt.importer.ServiceComparatorTest$MyInterface</beans:value>

+			<beans:value>java.io.Serializable</beans:value>

+			<beans:value>java.lang.Cloneable</beans:value>

+		</interfaces>

+ 	</reference>

+ 	

+	<set id="setWithServiceReference">

+		<interfaces>

+			<beans:value>org.eclipse.gemini.blueprint.iandt.importer.ServiceComparatorTest$MyInterface</beans:value>

+		</interfaces>

+		<comparator><natural basis="service-reference"/></comparator>

+	</set>

+	

+	<beans:bean id="testBean" class="org.eclipse.gemini.blueprint.iandt.importer.ServiceComparatorTest$TestBean">

+		<beans:property name="prop1" ref="multiInterfaceProxy"/>

+		<beans:property name="prop2" ref="multiInterfaceProxy"/>

+		<beans:property name="prop3" ref="multiInterfaceProxy"/>

+	</beans:bean>

+</beans:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest-bundle.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest-bundle.properties
new file mode 100644
index 0000000..9ad18e4
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/BundleJarTest-bundle.properties
@@ -0,0 +1,2 @@
+root.dir=file:./target/test-classes

+include.patterns=/**/*.*
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests-bundle.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests-bundle.properties
new file mode 100644
index 0000000..9ad18e4
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests-bundle.properties
@@ -0,0 +1,2 @@
+root.dir=file:./target/test-classes

+include.patterns=/**/*.*
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.MF
new file mode 100644
index 0000000..636eac7
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/FragmentIoTests.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0

+Bundle-Name: Functional testing of IO Blueprint dependencies

+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.io.functional.fragments

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.eclipse.gemini.blueprint.test.JUnitTestActivator

+Import-Package: junit.framework,

+ org.osgi.framework,

+ org.springframework.core.io,

+ org.springframework.core.io.support,

+ org.eclipse.gemini.blueprint.io,

+ org.springframework.util,

+ org.eclipse.gemini.blueprint.util,

+ org.eclipse.gemini.blueprint.test,

+ org.eclipse.gemini.blueprint.test.platform,

+ org.eclipse.gemini.blueprint.test.provisioning,

+ org.springframework.test,

+ org.apache.commons.logging

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/IoTests-bundle.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/IoTests-bundle.properties
new file mode 100644
index 0000000..9ad18e4
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/IoTests-bundle.properties
@@ -0,0 +1,2 @@
+root.dir=file:./target/test-classes

+include.patterns=/**/*.*
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/another-resource.res b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/another-resource.res
new file mode 100644
index 0000000..6e6f069
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/another-resource.res
@@ -0,0 +1 @@
+another local resource
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
new file mode 100644
index 0000000..02252d4
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/duplicate.file
@@ -0,0 +1 @@
+file available in attached bundle also
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/some-resource.res b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/some-resource.res
new file mode 100644
index 0000000..db10b4a
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/io/some-resource.res
@@ -0,0 +1 @@
+some resource
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/config.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/config.xml
new file mode 100644
index 0000000..16ca867
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/bridgemethods/config.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<osgi:list id="collection" interface="java.awt.Shape"

+		cardinality="0..N">

+		<osgi:reference-listener bind-method="bind" unbind-method="unbind">

+			<bean class="org.eclipse.gemini.blueprint.iandt.jdk5.bridgemethods.Listener" />

+		</osgi:reference-listener>

+	</osgi:list>

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/context.xml
new file mode 100644
index 0000000..d599ad3
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/componentscanning/context.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:ctx="http://www.springframework.org/schema/context"

+	xmlns:osgi="http://www.springframework.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/context

+           http://www.springframework.org/schema/context/spring-context.xsd

+           http://www.springframework.org/schema/osgi

+           http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+

+	<ctx:component-scan base-package="org.eclipse.gemini.blueprint.iandt.jdk5.componentscanning"/>

+

+	<osgi:reference id="shape">

+		<osgi:interfaces>

+			<value>java.awt.Shape</value>

+			<value>java.lang.Cloneable</value>

+		</osgi:interfaces>

+	</osgi:reference>

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/io/component-scan.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/io/component-scan.xml
new file mode 100644
index 0000000..6c4387a
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/jdk5/io/component-scan.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:context="http://www.springframework.org/schema/context"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans 

+           http://www.springframework.org/schema/beans/spring-beans.xsd

+           http://www.springframework.org/schema/context

+           http://www.springframework.org/schema/context/spring-context.xsd">

+

+	<context:component-scan base-package="org.eclipse.gemini.blueprint.iandt.io.component" />

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/lifecycle/MANIFEST.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/lifecycle/MANIFEST.MF
new file mode 100644
index 0000000..70f0a2c
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/lifecycle/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of Spring lifecycle
+Bundle-SymbolicName: org.eclipse.gemini.blueprint.iandt.lifecycle.functional
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.platform
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.MF
new file mode 100644
index 0000000..c030cf6
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/mavenArtifact/MavenArtifactLookupTest.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of OSGi service reference cardinality {0..1}
+Bundle-SymbolicName: org.springframework.osgi.iandt.cardinality.0to1
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.platform,
+ org.springframework.osgi.service,
+ org.springframework.osgi.iandt.simpleservice2,
+ org.springframework.osgi.iandt.cardinality0to1.test
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/namespace/context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/namespace/context.xml
new file mode 100644
index 0000000..d1ce687
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/namespace/context.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!-- import embedded namespace -->

+<b:beans xmlns="http://www.springframework.org/schema/osgi/test"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:b="http://www.springframework.org/schema/beans"

+	xmlns:t="http://www.springframework.org/schema/osgi/test"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+                      http://www.springframework.org/schema/osgi/test http://www.springframework.org/schema/osgi/test/test.xsd">

+

+	<b:bean id="bean" class="java.lang.Object"/>

+	<t:test>test element</t:test>

+</b:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/nonosgicl/context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/nonosgicl/context.xml
new file mode 100644
index 0000000..fdfe125
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/nonosgicl/context.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!-- import embedded namespace -->

+<b:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:b="http://www.springframework.org/schema/beans"

+	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">

+

+	<reference id="service">

+		<interfaces>

+			<!-- two JDK packages -->

+			<b:value>java.util.Comparator</b:value>

+			<!-- one OSGi package -->

+			<b:value>org.osgi.framework.Constants</b:value>

+			<!-- a bundle (Spring) package -->

+			<b:value>org.springframework.beans.factory.InitializingBean</b:value>

+			<b:value>javax.sql.DataSource</b:value>

+		</interfaces>

+	</reference>	

+</b:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/ns/context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/ns/context.xml
new file mode 100644
index 0000000..7d379cb
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/ns/context.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!-- import embedded namespace -->

+<b:beans xmlns="http://www.springframework.org/schema/bogus"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:b="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:bogus="http://www.springframework.org/schema/bogus"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+                      http://www.springframework.org/schema/bogus http://www.springframework.org/schema/bogus/bogus.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<b:bean id="bean" class="java.lang.Object"/>

+	<bogus:bogus>bogus declaration</bogus:bogus>

+	

+</b:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest-bundle.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest-bundle.properties
new file mode 100644
index 0000000..968d22f
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/PropertyPlaceholderTest-bundle.properties
@@ -0,0 +1,3 @@
+root.dir=file:./target/test-classes

+include.patterns=/**/*.*

+libs=

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/placeholder.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/placeholder.xml
new file mode 100644
index 0000000..4d45d69
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/propertyplaceholder/placeholder.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"

+	xmlns:ctx="http://www.springframework.org/schema/context"

+	xsi:schemaLocation="

+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd

+		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

+

+	

+	<osgix:cm-properties id="cm" persistent-id="PropertyPlaceholderTest-123">

+		<prop key="white">donkey</prop>

+		<prop key="hidden">treasures</prop>

+	</osgix:cm-properties>

+

+	<ctx:property-placeholder properties-ref="cm"/>

+

+	<bean id="bean1" class="java.lang.String">

+		<constructor-arg value="${white}" />

+	</bean>

+

+	<bean id="bean2" class="java.lang.String">

+		<constructor-arg value="${hidden}" />

+	</bean>

+

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/proxied/listener/service-import.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/proxied/listener/service-import.xml
new file mode 100644
index 0000000..68ef452
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/proxied/listener/service-import.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<osgi:reference id="listener" interface="org.eclipse.gemini.blueprint.iandt.proxy.listener.Listener"/>

+	

+	<!-- single shared instance of the imported service -->

+    <osgi:reference id="reference" interface="java.awt.Shape" availability="optional">

+        <osgi:reference-listener bind-method="bind" unbind-method="unbind" ref="listener"/>

+    </osgi:reference>

+    	

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.MF
new file mode 100644
index 0000000..cb7c75a
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/referenceProxy/ReferenceProxyTest.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of OSGi service reference listener
+Bundle-SymbolicName: org.springframework.osgi.iandt.serviceListener.functional
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.osgi.service,
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.platform,
+ org.springframework.osgi.iandt.simpleservice,
+ org.springframework.osgi.iandt.reference.proxy
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.MF
new file mode 100644
index 0000000..b03876c
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceListener/ServiceListenerTest.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-Name: Functional testing of OSGi service reference listener
+Bundle-SymbolicName: org.springframework.osgi.iandt.serviceListener.functional
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework,
+ org.springframework.aop,
+ org.springframework.core.io,
+ org.springframework.osgi.test,
+org.springframework.osgi.test.platform,
+ org.springframework.osgi.iandt.service.listener
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-multi-collection-import.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-multi-collection-import.xml
new file mode 100644
index 0000000..e900911
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-multi-collection-import.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+

+	<!-- set -->

+	<osgi:set interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService" cardinality="1..N" id="serviceA" />

+

+	<!-- list -->

+	<osgi:list interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService" cardinality="1..N"  id="serviceC" />

+

+	<!-- only one importer dependency exporter -->

+	<osgi:service id="exporterA" ref="map" auto-export="all-classes"/>

+

+	<bean id="map" class="java.util.HashMap" depends-on="serviceA"/>

+

+	<!-- multiple importer dependency importer -->

+	<osgi:service id="exporterB" ref="simple-bean" auto-export="all-classes" depends-on="serviceC"/>

+	

+	<bean id="simple-bean" class="org.eclipse.gemini.blueprint.iandt.servicedependency.SimpleBean" depends-on="serviceC">

+		<property name="property" ref="serviceA"/>

+	</bean>		

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-single-import.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-single-import.xml
new file mode 100644
index 0000000..139645e
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/multi-export-single-import.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+		

+	<!-- mandatory importer bean -->

+	<osgi:reference interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService" id="mandatory" cardinality="1..1"/>

+	

+	<!-- optional importer bean -->

+	<osgi:reference interface="java.awt.Shape" id="optional"  cardinality="0..1"/>

+	

+	<!-- map exporter -->

+	<osgi:service id="map-exporter" ref="map" auto-export="interfaces" />

+	<bean id="map" class="java.util.HashMap" depends-on="mandatory,optional"/>

+	

+	<!-- simple exporter -->

+	<osgi:service id="bean-exporter" ref="simple-bean" auto-export="all-classes" />

+	

+	<bean id="simple-bean" class="org.eclipse.gemini.blueprint.iandt.servicedependency.SimpleBean">

+		<property name="property" ref="mandatory"/>

+	</bean>

+	

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/single-export-multi-import.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/single-export-multi-import.xml
new file mode 100644
index 0000000..83e638a
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/servicedependency/single-export-multi-import.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.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">

+		

+	

+	

+	<osgi:reference interface="org.eclipse.gemini.blueprint.iandt.simpleservice2.MyService2" cardinality="1..1" id="serviceB"/>

+

+	<osgi:reference interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService" cardinality="1..1" id="serviceC" />

+	

+	<!-- simple exporter -->

+	<osgi:service id="exporter" ref="simple-bean" auto-export="all-classes" depends-on="serviceC"/>

+	

+	<bean id="simple-bean" class="org.eclipse.gemini.blueprint.iandt.servicedependency.SimpleBean" depends-on="serviceB">

+		<property name="property">

+			<osgi:reference interface="org.eclipse.gemini.blueprint.iandt.simpleservice.MyService" cardinality="1..1" id="serviceA" />

+		</property>

+	</bean>

+	

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.MF
new file mode 100644
index 0000000..297d79b
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceCollectionTest.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0

+Bundle-Name: Integration test for OSGi service collection proxy lookup

+Bundle-SymbolicName: org.springframework.osgi.iandt.serviceproxy.integration

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator

+Import-Package: junit.framework,

+  org.osgi.framework,

+  org.apache.commons.logging,

+  org.springframework.aop,

+  org.springframework.aop.framework,

+  org.springframework.aop.target,

+  org.springframework.osgi.service,

+  org.springframework.osgi.service.support,

+  org.springframework.osgi.service.support.cardinality,

+  org.springframework.osgi.service.collection,

+  org.springframework.osgi.test,

+  org.springframework.osgi.test.platform,

+  org.aopalliance.aop,

+  org.aopalliance.intercept,

+  org.springframework.util

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTest.MF
new file mode 100644
index 0000000..05b07e8
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/serviceproxy/ServiceProxyTest.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0

+Bundle-Name: Integration test for OSGi service proxy lookup

+Bundle-SymbolicName: org.springframework.osgi.iandt.serviceproxy.integration

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator

+Import-Package: junit.framework,

+  org.osgi.framework,

+  org.apache.commons.logging,

+  org.springframework.aop,

+  org.springframework.aop.framework,

+  org.springframework.aop.target,

+  org.springframework.osgi.service,

+  org.springframework.osgi.service.support,

+  org.springframework.osgi.service.support.cardinality,

+  org.springframework.osgi.util,

+  org.springframework.osgi.test,

+  org.springframework.osgi.test.platform,

+  org.aopalliance.aop,

+  org.aopalliance.intercept,

+  org.springframework.util

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/syntheticEvents/importers.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/syntheticEvents/importers.xml
new file mode 100644
index 0000000..696e2bf
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/syntheticEvents/importers.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	osgi:default-timeout="10" osgi:default-cardinality="0..X">

+

+	<beans:bean id="referenceListener"

+		class="org.eclipse.gemini.blueprint.iandt.syntheticEvents.ServiceListenerSyntheticEvents$ReferenceListener" />

+

+	<beans:bean id="collectionListener"

+		class="org.eclipse.gemini.blueprint.iandt.syntheticEvents.ServiceListenerSyntheticEvents$CollectionListener" />

+

+	<reference id="serviceReference" interface="java.awt.Shape">

+		<listener ref="referenceListener" bind-method="bind"

+			unbind-method="unbind" />

+	</reference>

+	<list id="serviceList" interface="java.awt.Shape">

+		<listener ref="collectionListener" bind-method="bind"

+			unbind-method="unbind" />

+	</list>

+

+</beans:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-context.xml
new file mode 100644
index 0000000..b336d38
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-context.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	osgi:default-cardinality="0..X">

+

+	<!-- make sure to import the service unmanaged test -->

+	<osgi:reference id="unmanaged"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="unmanaged" filter="(tccl=unmanaged)" />

+

+	<osgi:reference id="service-provider"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="service-provider" filter="(tccl=unmanaged)" />

+

+	<osgi:reference id="client"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="client" filter="(tccl=unmanaged)" />

+

+</beans:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-resource.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-resource.properties
new file mode 100644
index 0000000..222f81e
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/client-resource.properties
@@ -0,0 +1 @@
+dummy file used for resource location
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/service-context.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/service-context.xml
new file mode 100644
index 0000000..1e19aa4
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/tcclManagement/service-context.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"

+	osgi:default-cardinality="0..X" osgi:default-timeout="10000">

+

+	<!-- make sure to import the service unmanaged test -->

+	<osgi:reference id="unmanaged"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="unmanaged" filter="(tccl=service-provider)" />

+

+	<osgi:reference id="service-provider"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="service-provider" filter="(tccl=service-provider)" />

+

+	<osgi:reference id="client"

+		interface="org.eclipse.gemini.blueprint.iandt.tccl.TCCLService"

+		context-class-loader="client" filter="(tccl=service-provider)" />

+</beans:beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.MF
new file mode 100644
index 0000000..6f38026
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0

+Bundle-Name: Integration test for OSGi testing framework

+Bundle-SymbolicName: org.springframework.osgi.iandt.integration

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator

+Import-Package: junit.framework,

+  org.apache.commons.logging,

+  org.osgi.framework,

+  org.springframework.osgi.util,

+  org.springframework.osgi.test,

+  org.springframework.osgi.test.platform,

+  org.springframework.beans,

+  org.springframework.beans.factory,  

+  org.springframework.context

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.xml b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.xml
new file mode 100644
index 0000000..5520efc
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/AppCtxInjectionTest.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="

+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

+

+	<bean id="injected-bean" class="java.util.HashMap"/>

+</beans>
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.MF b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.MF
new file mode 100644
index 0000000..6f38026
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/RunBundleCreationTest.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0

+Bundle-Name: Integration test for OSGi testing framework

+Bundle-SymbolicName: org.springframework.osgi.iandt.integration

+Bundle-Vendor: Spring Framework

+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator

+Import-Package: junit.framework,

+  org.apache.commons.logging,

+  org.osgi.framework,

+  org.springframework.osgi.util,

+  org.springframework.osgi.test,

+  org.springframework.osgi.test.platform,

+  org.springframework.beans,

+  org.springframework.beans.factory,  

+  org.springframework.context

diff --git a/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/log4j.properties b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/log4j.properties
new file mode 100644
index 0000000..b69b3cd
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/org/eclipse/gemini/blueprint/iandt/testingFramework/log4j.properties
@@ -0,0 +1,11 @@
+log4j.rootLogger=INFO, stdout

+

+log4j.appender.stdout=org.apache.log4j.ConsoleAppender

+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

+log4j.appender.stdout.threshold=TRACE

+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

+

+log4j.logger.org.springframework.osgi=INFO

+log4j.logger.org.springframework.osgi.util=TRACE

+

+#log4j.debug=false
\ No newline at end of file
diff --git a/integration-tests/tests/src/test/resources/osgi-723.jar b/integration-tests/tests/src/test/resources/osgi-723.jar
new file mode 100644
index 0000000..0fc4466
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/osgi-723.jar
Binary files differ
diff --git a/integration-tests/tests/src/test/resources/osgi-799-exp.jar b/integration-tests/tests/src/test/resources/osgi-799-exp.jar
new file mode 100644
index 0000000..b676242
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/osgi-799-exp.jar
Binary files differ
diff --git a/integration-tests/tests/src/test/resources/osgi-799-imp.jar b/integration-tests/tests/src/test/resources/osgi-799-imp.jar
new file mode 100644
index 0000000..cea8efc
--- /dev/null
+++ b/integration-tests/tests/src/test/resources/osgi-799-imp.jar
Binary files differ
diff --git a/pom.xml b/pom.xml
index 1411ce9..a0d25ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,12 +22,12 @@
     <spring.maven.artifact.version>3.0.2.RELEASE</spring.maven.artifact.version>
     <spring.base.version>3.0.0</spring.base.version>
     
-    <!--- Spring OSGi packages imported version (respect the OSGi naming pattern)-->
-    <spring.osgi.import.version>1.0.0.M1</spring.osgi.import.version>
+    <!--- Gemini Blueprint packages imported version (respect the OSGi naming pattern)-->
+    <gemini.blueprint.import.version>1.0.0.M1</gemini.blueprint.import.version>
     
-    <!--- Spring OSGi packages exported version -->
-    <spring.osgi.export.version>1.0.0.M1</spring.osgi.export.version>
-    <spring.osgi.bundle.version>1.0.0.M1</spring.osgi.bundle.version>
+    <!--- Gemini Blueprint packages exported version -->
+    <gemini.blueprint.export.version>1.0.0.M1</gemini.blueprint.export.version>
+    <gemini.blueprint.bundle.version>1.0.0.M1</gemini.blueprint.bundle.version>
 
     <symName.prefix>org.eclipse.gemini.blueprint</symName.prefix>
     <spring.osgi.symbolic.name>${groupId}.${artifactId}</spring.osgi.symbolic.name>
@@ -60,8 +60,8 @@
    <!-- common version ranges -->
    <spring.version.range.nq>[${spring.base.version},4.0)</spring.version.range.nq>
    <spring.version.range>"${spring.version.range.nq}"</spring.version.range>
-   <spring.osgi.version.range.nq>[${spring.osgi.import.version},${spring.osgi.import.version}]</spring.osgi.version.range.nq>
-   <spring.osgi.version.range>"${spring.osgi.version.range.nq}"</spring.osgi.version.range>
+   <gemini.blueprint.version.range.nq>[${gemini.blueprint.import.version},${gemini.blueprint.import.version}]</gemini.blueprint.version.range.nq>
+   <gemini.blueprint.version.range>"${gemini.blueprint.version.range.nq}"</gemini.blueprint.version.range>
    <logging.version.range>"[1.0,2.0)"</logging.version.range>
    <!-- jarjar -->
    <jarjar.keep></jarjar.keep>
@@ -543,7 +543,7 @@
         <configuration>
            <manifestTemplatePath>${basedir}/template.mf</manifestTemplatePath>
            <manifestHeaders><![CDATA[Bundle-Name: ${artifactId}
-Bundle-Version: ${spring.osgi.bundle.version}
+Bundle-Version: ${gemini.blueprint.bundle.version}
 Bundle-SymbolicName: ${spring.osgi.symbolic.name}
 Bundle-Vendor: Eclipse Foundation
 Bundle-DocURL: http://www.eclipse.org/gemini/blueprint/
@@ -664,7 +664,7 @@
         </dependency>
       </dependencies>
       <properties>
-        <osgi.test.platform>org.springframework.osgi.test.platform.EquinoxPlatform</osgi.test.platform>
+        <osgi.test.platform>org.eclipse.gemini.blueprint.test.platform.EquinoxPlatform</osgi.test.platform>
         <log4j.ignoreTCL>true</log4j.ignoreTCL>
       </properties>
     </profile>
@@ -681,7 +681,7 @@
         </dependency>
       </dependencies>
       <properties>
-        <osgi.test.platform>org.springframework.osgi.test.platform.KnopflerfishPlatform</osgi.test.platform>
+        <osgi.test.platform>org.eclipse.gemini.blueprint.test.platform.KnopflerfishPlatform</osgi.test.platform>
         <log4j.ignoreTCL>true</log4j.ignoreTCL>
         <org.knopflerfish.osgi.setcontextclassloader>true</org.knopflerfish.osgi.setcontextclassloader>
       </properties>
@@ -725,7 +725,7 @@
         </dependency>
       </dependencies>
       <properties>
-        <osgi.test.platform>org.springframework.osgi.test.platform.FelixPlatform</osgi.test.platform>
+        <osgi.test.platform>org.eclipse.gemini.blueprint.test.platform.FelixPlatform</osgi.test.platform>
         <log4j.ignoreTCL>true</log4j.ignoreTCL>
       </properties>
     </profile>
diff --git a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractConfigurableOsgiTests.java b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractConfigurableOsgiTests.java
index 5922b7e..9030b52 100644
--- a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractConfigurableOsgiTests.java
+++ b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractConfigurableOsgiTests.java
@@ -141,9 +141,9 @@
 		}

 		

 		if (logger.isTraceEnabled())

-			logger.trace("System property [" + OSGI_FRAMEWORK_SELECTOR + "] has value=" + systemProperty);

+			logger.trace("System property [" + SPRING_DM_OSGI_FRAMEWORK_SELECTOR + "] has value=" + systemProperty);

 

-		return (StringUtils.hasText(systemProperty) ? Platforms.EQUINOX : systemProperty);

+		return (!StringUtils.hasText(systemProperty) ? Platforms.EQUINOX : systemProperty);

 	}

 

 	/**

diff --git a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractDependencyManagerTests.java b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractDependencyManagerTests.java
index d92091f..053b4ab 100644
--- a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractDependencyManagerTests.java
+++ b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractDependencyManagerTests.java
@@ -78,7 +78,7 @@
 	}

 

 

-	private static final String SPRING_OSGI_VERSION_PROP_KEY = "ignore.spring.osgi.version";

+	private static final String GEMINI_BLUEPRINT_VERSION_PROP_KEY = "ignore.gemini.blueprint.version";

 

 	private static final String SPRING_VERSION_PROP_KEY = "ignore.spring.version";

 

@@ -97,7 +97,7 @@
 	 */

 	protected String getSpringDMVersion() {

 		if (springOsgiVersion == null) {

-			springOsgiVersion = readProperty(SPRING_OSGI_VERSION_PROP_KEY);

+			springOsgiVersion = readProperty(GEMINI_BLUEPRINT_VERSION_PROP_KEY);

 		}

 

 		return springOsgiVersion;

@@ -180,7 +180,7 @@
 			logger.trace("Loaded properties " + props);

 

 		// pass properties to test instance running inside OSGi space

-		System.getProperties().put(SPRING_OSGI_VERSION_PROP_KEY, props.get(SPRING_OSGI_VERSION_PROP_KEY));

+		System.getProperties().put(GEMINI_BLUEPRINT_VERSION_PROP_KEY, props.get(GEMINI_BLUEPRINT_VERSION_PROP_KEY));

 		System.getProperties().put(SPRING_VERSION_PROP_KEY, props.get(SPRING_VERSION_PROP_KEY));

 

 		Properties excluded = PropertiesUtil.filterKeysStartingWith(props, IGNORE);

@@ -204,7 +204,7 @@
 

 		String[] bundles = (String[]) props.keySet().toArray(new String[props.size()]);

 		// sort the array (as the Properties file doesn't respect the order)

-		bundles = StringUtils.sortStringArray(bundles);

+		//bundles = StringUtils.sortStringArray(bundles);

 

 		if (logger.isDebugEnabled())

 			logger.debug("Default framework bundles :" + ObjectUtils.nullSafeToString(bundles));

diff --git a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/internal/util/PropertiesUtil.java b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/internal/util/PropertiesUtil.java
index 63aa280..7b198e6 100644
--- a/test-support/src/main/java/org/eclipse/gemini/blueprint/test/internal/util/PropertiesUtil.java
+++ b/test-support/src/main/java/org/eclipse/gemini/blueprint/test/internal/util/PropertiesUtil.java
@@ -15,11 +15,14 @@
 package org.eclipse.gemini.blueprint.test.internal.util;

 

 import java.io.IOException;

+import java.util.Collection;

 import java.util.Enumeration;

 import java.util.Iterator;

+import java.util.LinkedHashMap;

 import java.util.Map;

 import java.util.Properties;

 import java.util.Set;

+import java.util.Map.Entry;

 

 import org.springframework.core.io.Resource;

 import org.springframework.util.Assert;

@@ -28,9 +31,8 @@
 /**

  * Loads a property file performing key expansion.

  * 

- * Provides simple property substitution, without support for inner or nested

- * placeholders. Also, the algorithm does only one parsing so derivative

- * placeholders are not supported.

+ * Provides simple property substitution, without support for inner or nested placeholders. Also, the algorithm does

+ * only one parsing so derivative placeholders are not supported.

  * 

  * 

  * @author Costin Leau

@@ -44,22 +46,190 @@
 

 	private static final Properties EMPTY_PROPERTIES = new Properties();

 

+	private static final class OrderedProperties extends Properties implements Cloneable {

+

+		private final Map<Object, Object> map = new LinkedHashMap<Object, Object>();

+

+		/**

+		 * 

+		 * @see java.util.Map#clear()

+		 */

+		public void clear() {

+			map.clear();

+		}

+

+		/**

+		 * @param key

+		 * @return

+		 * @see java.util.Map#containsKey(java.lang.Object)

+		 */

+		public boolean containsKey(Object key) {

+			return map.containsKey(key);

+		}

+

+		/**

+		 * @param value

+		 * @return

+		 * @see java.util.Map#containsValue(java.lang.Object)

+		 */

+		public boolean containsValue(Object value) {

+			return map.containsValue(value);

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#entrySet()

+		 */

+		public Set<Entry<Object, Object>> entrySet() {

+			return map.entrySet();

+		}

+

+		/**

+		 * @param o

+		 * @return

+		 * @see java.util.Map#equals(java.lang.Object)

+		 */

+		public boolean equals(Object o) {

+			return map.equals(o);

+		}

+

+		/**

+		 * @param key

+		 * @return

+		 * @see java.util.Map#get(java.lang.Object)

+		 */

+		public Object get(Object key) {

+			return map.get(key);

+		}

+

+		@Override

+		public String getProperty(String key) {

+			Object oval = map.get(key);

+			String sval = (oval instanceof String) ? (String) oval : null;

+			return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#hashCode()

+		 */

+		public int hashCode() {

+			return map.hashCode();

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#isEmpty()

+		 */

+		public boolean isEmpty() {

+			return map.isEmpty();

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#keySet()

+		 */

+		public Set<Object> keySet() {

+			return map.keySet();

+		}

+

+		/**

+		 * @param key

+		 * @param value

+		 * @return

+		 * @see java.util.Map#put(java.lang.Object, java.lang.Object)

+		 */

+		public Object put(Object key, Object value) {

+			return map.put(key, value);

+		}

+

+		/**

+		 * @param m

+		 * @see java.util.Map#putAll(java.util.Map)

+		 */

+		public void putAll(Map<? extends Object, ? extends Object> m) {

+			map.putAll(m);

+		}

+

+		/**

+		 * @param key

+		 * @return

+		 * @see java.util.Map#remove(java.lang.Object)

+		 */

+		public Object remove(Object key) {

+			return map.remove(key);

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#size()

+		 */

+		public int size() {

+			return map.size();

+		}

+

+		/**

+		 * @return

+		 * @see java.util.Map#values()

+		 */

+		public Collection<Object> values() {

+			return map.values();

+		}

+

+		@Override

+		public synchronized boolean contains(Object value) {

+			return map.containsValue(value);

+		}

+

+		@Override

+		public synchronized Enumeration<Object> elements() {

+			return new IteratorBackedEnumeration(map.values().iterator());

+		}

+

+		@Override

+		public synchronized Enumeration<Object> keys() {

+			return new IteratorBackedEnumeration(map.keySet().iterator());

+		}

+

+		@Override

+		public synchronized String toString() {

+			return map.toString();

+		}

+

+		private final class IteratorBackedEnumeration<K> implements Enumeration<K> {

+

+			private final Iterator<? extends K> iterator;

+

+			public IteratorBackedEnumeration(Iterator<? extends K> iterator) {

+				this.iterator = iterator;

+			}

+

+			public boolean hasMoreElements() {

+				return iterator.hasNext();

+			}

+

+			public K nextElement() {

+				return iterator.next();

+			}

+		}

+	}

+

 	/**

-	 * Shortcut method - loads a property object from the given input stream and

-	 * applies property expansion.

+	 * Shortcut method - loads a property object from the given input stream and applies property expansion. The

+	 * returned properties object preserves order at the expense of speed.

 	 * 

 	 * @param resource

 	 * @return

 	 */

 	public static Properties loadAndExpand(Resource resource) {

-		Properties props = new Properties();

+		Properties props = new OrderedProperties();

+

 		if (resource == null)

 			return props;

 

 		try {

 			props.load(resource.getInputStream());

-		}

-		catch (IOException ex) {

+		} catch (IOException ex) {

 			return null;

 		}

 		return expandProperties(props);

@@ -78,22 +248,24 @@
 

 		Assert.notNull(properties);

 

-		Properties excluded = new Properties();

+		Properties excluded = (properties instanceof OrderedProperties ? new OrderedProperties() : new Properties());

 

 		// filter ignore keys out

 		for (Enumeration enm = properties.keys(); enm.hasMoreElements();) {

 			String key = (String) enm.nextElement();

 			if (key.startsWith(prefix)) {

-				excluded.put(key, properties.remove(key));

+				excluded.put(key, properties.get(key));

 			}

 		}

-

+		

+		for (Enumeration enm = excluded.keys(); enm.hasMoreElements();) {

+			properties.remove(enm.nextElement());

+		}

 		return excluded;

 	}

 

 	/**

-	 * Filter/Eliminate keys that have a value that starts with the given

-	 * prefix.

+	 * Filter/Eliminate keys that have a value that starts with the given prefix.

 	 * 

 	 * @param properties

 	 * @param prefix

@@ -104,24 +276,27 @@
 			return EMPTY_PROPERTIES;

 

 		Assert.notNull(properties);

-		Properties excluded = new Properties();

+		Properties excluded = (properties instanceof OrderedProperties ? new OrderedProperties() : new Properties());

 

 		for (Enumeration enm = properties.keys(); enm.hasMoreElements();) {

 			String key = (String) enm.nextElement();

 			String value = properties.getProperty(key);

 			if (value.startsWith(prefix)) {

 				excluded.put(key, value);

-				properties.remove(key);

 			}

 		}

+		

+		for (Enumeration enm = excluded.keys(); enm.hasMoreElements();) {

+			properties.remove(enm.nextElement());

+		}

 		return excluded;

 	}

 

 	/**

 	 * Apply placeholder expansion to the given properties object.

 	 * 

-	 * Will return a new properties object, containing the expanded entries.

-	 * Note that both keys and values will be expanded.

+	 * Will return a new properties object, containing the expanded entries. Note that both keys and values will be

+	 * expanded.

 	 * 

 	 * @param props

 	 * @return

@@ -131,7 +306,7 @@
 

 		Set entrySet = props.entrySet();

 

-		Properties newProps = new Properties();

+		Properties newProps = (props instanceof OrderedProperties ? new OrderedProperties() : new Properties());

 

 		for (Iterator iter = entrySet.iterator(); iter.hasNext();) {

 			// first expand the keys

@@ -185,8 +360,7 @@
 					throw new IllegalArgumentException("cannot interpret property " + prop + " due of token [" + copy

 							+ "]");

 

-			}

-			else {

+			} else {

 				hasPlaceholder = false;

 				// make sure to append the remaining string

 				result.append(copy);

diff --git a/test-support/src/main/resources/org/eclipse/gemini/blueprint/test/internal/boot-bundles.properties b/test-support/src/main/resources/org/eclipse/gemini/blueprint/test/internal/boot-bundles.properties
index 7cb7630..f03c427 100644
--- a/test-support/src/main/resources/org/eclipse/gemini/blueprint/test/internal/boot-bundles.properties
+++ b/test-support/src/main/resources/org/eclipse/gemini/blueprint/test/internal/boot-bundles.properties
@@ -25,14 +25,14 @@
 ignore.log4j.version=1.2.15

 

 ignore.spring.version=3.0.1.RELEASE-A

-ignore.spring.osgi.version=2.0.0.M2-SNAPSHOT

+ignore.gemini.blueprint.version=1.0.0.M1-SNAPSHOT

 ignore.slf4j.version=1.5.6

 ignore.asm.version=2.2.3

 ignore.antlr.version=3.0.1

 

 # groupIds

 ignore.spring.groupId=org.springframework

-ignore.spring.osgi.groupId=org.eclipse.gemini.blueprint

+ignore.gemini.blueprint.groupId=org.eclipse.gemini.blueprint

 ignore.slf4j.groupId=org.slf4j

 

 #

@@ -70,9 +70,9 @@
 ${ignore.spring.groupId},org.springframework.test,${ignore.spring.version}=

 

 

-# spring osgi libs

-${ignore.spring.osgi.groupId},spring-osgi-io,${ignore.spring.osgi.version}=

-${ignore.spring.osgi.groupId},spring-osgi-core,${ignore.spring.osgi.version}=

-${ignore.spring.osgi.groupId},spring-osgi-annotation,${ignore.spring.osgi.version}=+15

-${ignore.spring.osgi.groupId},spring-osgi-extender,${ignore.spring.osgi.version}=

-${ignore.spring.osgi.groupId},spring-osgi-test,${ignore.spring.osgi.version}=

+# gemini blueprint libs

+${ignore.gemini.blueprint.groupId},gemini-blueprint-io,${ignore.gemini.blueprint.version}=

+${ignore.gemini.blueprint.groupId},gemini-blueprint-core,${ignore.gemini.blueprint.version}=

+#${ignore.gemini.blueprint.groupId},gemini-blueprint-annotation,${ignore.gemini.blueprint.version}=+15

+${ignore.gemini.blueprint.groupId},gemini-blueprint-extender,${ignore.gemini.blueprint.version}=

+${ignore.gemini.blueprint.groupId},gemini-blueprint-test,${ignore.gemini.blueprint.version}=

diff --git a/test-support/template.mf b/test-support/template.mf
index b3e2f0c..cd46d50 100644
--- a/test-support/template.mf
+++ b/test-support/template.mf
@@ -5,7 +5,7 @@
  org.osgi.service.cm;version=1.2;resolution:=optional,

  org.osgi.service.packageadmin;version=1.2,

  org.apache.commons.logging.*;version=${logging.version.range},

- org.springframework.osgi.*;version=${spring.osgi.version.range},

+ org.eclipse.gemini.blueprint.*;version=${gemini.blueprint.version.range},

  org.springframework.*;version=${spring.version.range},

  org.objectweb.*;version="[2,3)";resolution:=optional,

  org.eclipse.*;resolution:=optional,

@@ -13,7 +13,7 @@
  org.apache.felix.*;resolution:=optional,

  junit.*;version=3.8,

  *;resolution:=optional

-Bundle-Activator: org.springframework.osgi.test.internal.support.Activator

+Bundle-Activator: org.eclipse.gemini.blueprint.test.internal.support.Activator

 Unversioned-Imports: 

  *

  
\ No newline at end of file