Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsboshev2009-01-12 12:19:14 +0000
committersboshev2009-01-12 12:19:14 +0000
commitce4dffa54ff3fb50d6499d272a52eaa502a900a4 (patch)
tree2482ef50189376a343d6abc8cd7c8211e33ed312 /bundles/org.eclipse.equinox.ds.tests
parent67c6ed0752f61c3ea6b8f9fe63421c8cedc11068 (diff)
downloadrt.equinox.bundles-ce4dffa54ff3fb50d6499d272a52eaa502a900a4.tar.gz
rt.equinox.bundles-ce4dffa54ff3fb50d6499d272a52eaa502a900a4.tar.xz
rt.equinox.bundles-ce4dffa54ff3fb50d6499d272a52eaa502a900a4.zip
Donated DS tests by ProSyst Software
Diffstat (limited to 'bundles/org.eclipse.equinox.ds.tests')
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/.classpath26
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/.project33
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.core.prefs23
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/All DS Tests.launch438
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/META-INF/MANIFEST.MF18
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/build.properties81
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/BindUnbindSuccessor.java43
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/Immediate.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Activator.java37
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/AnotherComponent.java40
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BaseComp.java37
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BindUnbind.java53
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular1.java21
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular2.java21
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/components.xml67
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/sac.properties6
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountFactory.java42
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountHelperFactory.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/components.xml49
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/META-INF/MANIFEST.MF15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ConfigurationPolicyComp.java37
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore100.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore110.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset100.xml14
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset110.xml14
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional100.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional110.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require100.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require110.xml15
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc100.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc110.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/CallRegistrator.java137
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/ContextExp.java41
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs100.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs110.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/components.xml213
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/BindUnbindRegistrator.java89
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/Enabler.java40
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/components.xml118
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/ContextExp.java30
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional.java41
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional2.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/components.xml65
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component1.java48
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component2.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component3.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/components.xml48
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/TargetProperties.java54
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/components.xml48
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/Worker.java55
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/components.xml120
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/org/eclipse/equinox/ds/tests/tb18/components.xml160
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/org/eclipse/equinox/ds/tests/tb19/components.xml124
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/Blocker.java37
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/blockingcomp.xml13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/BindBlocker.java31
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/component.xml20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/META-INF/MANIFEST.MF11
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AdvancedBounder.java71
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AnotherComponent.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/BoundReplacer.java80
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component1.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component2.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component3.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/DynamicService.java17
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/GiveMeContext.java39
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/NamedService.java17
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/ServiceProvider.java29
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/components.xml56
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/DynamicFactory.java38
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/NamedFactory.java51
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.properties1
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.xml76
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/SecurityTester.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/component.xml12
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/ReferencedComp.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/StaticComp.java101
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/components.xml31
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit1.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit2.java59
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit1.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit2.java48
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit1.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit2.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/components.xml86
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/META-INF/MANIFEST.MF13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/NamespaceTester.java36
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/components.xml273
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root1.xml12
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root2.xml13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root3.xml13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root4.xml13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root5.xml13
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard1.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard2.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/WildcardTester.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp1.xml10
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp2.xml10
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/AllTests.java29
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/BundleInstaller.java156
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/DSTestsActivator.java61
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundCountProvider.java18
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundMainProvider.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundTester.java22
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BundleContextProvider.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentContextProvider.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentManager.java17
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEvent.java95
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEventsProvider.java17
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSTest.java2143
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DynamicWorker.java22
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/NamespaceProvider.java16
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/PropertiesProvider.java20
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/StaticWorker.java22
-rw-r--r--bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/TestHelper.java40
133 files changed, 7209 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.ds.tests/.classpath b/bundles/org.eclipse.equinox.ds.tests/.classpath
new file mode 100644
index 000000000..7e682e418
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" output="scr_test/tb2" path="bundles_src/tb2"/>
+ <classpathentry kind="src" output="scr_test/tb1" path="bundles_src/tb1"/>
+ <classpathentry kind="src" output="scr_test/tb10" path="bundles_src/tb10"/>
+ <classpathentry kind="src" output="scr_test/tb3" path="bundles_src/tb3"/>
+ <classpathentry kind="src" output="scr_test/tb4" path="bundles_src/tb4"/>
+ <classpathentry kind="src" output="scr_test/tb5" path="bundles_src/tb5"/>
+ <classpathentry kind="src" output="scr_test/tb6" path="bundles_src/tb6"/>
+ <classpathentry kind="src" output="scr_test/tb7" path="bundles_src/tb7"/>
+ <classpathentry kind="src" output="scr_test/tb8" path="bundles_src/tb8"/>
+ <classpathentry kind="src" output="scr_test/tb9" path="bundles_src/tb9"/>
+ <classpathentry kind="src" output="scr_test/tb11" path="bundles_src/tb11"/>
+ <classpathentry kind="src" output="scr_test/tb12" path="bundles_src/tb12"/>
+ <classpathentry kind="src" output="scr_test/tb13" path="bundles_src/tb13"/>
+ <classpathentry kind="src" output="scr_test/tb14" path="bundles_src/tb14"/>
+ <classpathentry kind="src" output="scr_test/tb15" path="bundles_src/tb15"/>
+ <classpathentry kind="src" output="scr_test/tb16" path="bundles_src/tb16"/>
+ <classpathentry kind="src" output="scr_test/tb17" path="bundles_src/tb17"/>
+ <classpathentry kind="src" output="scr_test/tb18" path="bundles_src/tb18"/>
+ <classpathentry kind="src" output="scr_test/tb19" path="bundles_src/tb19"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.ds.tests/.project b/bundles/org.eclipse.equinox.ds.tests/.project
new file mode 100644
index 000000000..10e047e3e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.ds.tests</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>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..32dfe693a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,23 @@
+#Mon Dec 15 14:23:49 EET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..a970245bf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Mon Dec 15 14:14:24 EET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
diff --git a/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..f38a61e2f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Tue Nov 11 12:04:55 EET 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.ds.tests/All DS Tests.launch b/bundles/org.eclipse.equinox.ds.tests/All DS Tests.launch
new file mode 100644
index 000000000..8a84fbcf4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/All DS Tests.launch
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.ds.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.ds.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<mapAttribute key="tracingOptions">
+<mapEntry key="org.eclipse.team.cvs.core/syncchangeevents" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/extraValDetail" value=""/>
+<mapEntry key="org.eclipse.equinox.registry/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/timings/useDoubles" value="false"/>
+<mapEntry key="org.eclipse.core.resources/perf/listeners" value="500"/>
+<mapEntry key="org.eclipse.debug.ui/debug/contextlaunching" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/internal.factory" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/render" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/needbuild" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/viewer" value="false"/>
+<mapEntry key="org.eclipse.jem.util/debug/logtrace" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/timings" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/data" value="true"/>
+<mapEntry key="org.eclipse.update.configurator/debug" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/log" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/device" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/ws_framework" value="true"/>
+<mapEntry key="org.eclipse.osgi/monitor/activation" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/preferences" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/content_assist/extensions" value="1000"/>
+<mapEntry key="org.eclipse.ui.ide/debug/gc" value="false"/>
+<mapEntry key="org.eclipse.core.resources/contenttype/cache" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/structuredmodel/state" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/timings/tracefile" value=""/>
+<mapEntry key="org.eclipse.birt.chart.engine/event" value="false"/>
+<mapEntry key="org.eclipse.core.jobs/jobs/shutdown" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/updateSequence" value="false"/>
+<mapEntry key="org.eclipse.osgi/monitor/classes" value="false"/>
+<mapEntry key="org.eclipse.equinox.preferences/get" value="false"/>
+<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFileMaps" value="false"/>
+<mapEntry key="org.eclipse.wst.xml.core/debug/tracefilter" value=""/>
+<mapEntry key="org.eclipse.update.core/debug" value="true"/>
+<mapEntry key="org.eclipse.core.runtime/debug/context" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/cpresolution/failure" value="false"/>
+<mapEntry key="org.eclipse.core.jobs/jobs/locks" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/swtdebug" value="false"/>
+<mapEntry key="com.mountainminds.eclemma.core/debug/instrumentation" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javamodel" value="false"/>
+<mapEntry key="org.eclipse.osgi/resolver/uses" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug/reconcilerjob" value="false"/>
+<mapEntry key="org.eclipse.ui.intro.universal/trace/logInfo" value="true"/>
+<mapEntry key="org.eclipse.debug.core/debug/events" value="false"/>
+<mapEntry key="org.eclipse.ui.intro/trace/printHTML" value="false"/>
+<mapEntry key="org.eclipse.equinox.registry/debug/events" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javadelta/verbose" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug" value="true"/>
+<mapEntry key="org.eclipse.pde.core/validation" value="false"/>
+<mapEntry key="org.eclipse.core.expressions/tracePropertyResolving" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore" value="false"/>
+<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/checkConditions" value="300"/>
+<mapEntry key="org.eclipse.ui/perf/perspective.listeners" value="200"/>
+<mapEntry key="org.eclipse.birt.chart.engine/datafeed" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.data.impl" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/perf/containerinitializer" value="5000"/>
+<mapEntry key="org.eclipse.osgi/trace/filename" value="runtime.traces"/>
+<mapEntry key="org.eclipse.wst.sse.ui/propertyChangeUpdateActionContributionItem" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/transferbuilder/time" value="false"/>
+<mapEntry key="org.eclipse.equinox.ds/performance" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/web" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.type.impl" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug" value="false"/>
+<mapEntry key="org.eclipse.birt.core/debug" value="false"/>
+<mapEntry key="org.eclipse.osgi/trace/activation" value="false"/>
+<mapEntry key="org.eclipse.equinox.security/debug/loginFramework" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/perspective.switch" value="800"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/job" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/part.input" value="200"/>
+<mapEntry key="org.eclipse.jface.text/debug/AnnotationPainter" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugmenu" value="false"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/info" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug/reconcilerSpelling/showProblems" value="false"/>
+<mapEntry key="org.eclipse.osgi/resolver/imports" value="false"/>
+<mapEntry key="org.eclipse.osgi/trace/filters" value="trace.properties"/>
+<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/infopop" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.equinox.preferences/general" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/debug" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/threading" value="false"/>
+<mapEntry key="org.eclipse.jdt.apt.pluggable.core/debug" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/internal.computations" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.component.impl" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/search/participants" value="300"/>
+<mapEntry key="org.eclipse.ui/perf/part.listeners" value="200"/>
+<mapEntry key="org.eclipse.osgi/resolver/debug" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/install" value="false"/>
+<mapEntry key="org.eclipse.equinox.security.ui/debug" value="false"/>
+<mapEntry key="org.eclipse.equinox.security/debug" value="false"/>
+<mapEntry key="org.eclipse.core.resources/debug" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser/inprocess" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/part.control" value="800"/>
+<mapEntry key="org.eclipse.osgi/profile/impl" value="org.eclipse.osgi.internal.profile.DefaultProfileLogger"/>
+<mapEntry key="org.eclipse.osgi/profile/benchmark" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/cpresolution/advanced" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/time" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/cvsprotocol" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/postaction" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/manifest" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/perf/selection" value="300"/>
+<mapEntry key="org.eclipse.help/debug/context" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/content_assist_sorters/extensions" value=""/>
+<mapEntry key="org.eclipse.jdt.core/debug/builder" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/actioncontributor/debugstatusfields" value="true"/>
+<mapEntry key="org.eclipse.osgi/resolver/requires" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/format" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendedconfigurationbuilder" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.util" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.ssh/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.dtd.ui/projectionperf" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/handlers.verbose" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/startlevel" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/installhandler" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/detection" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/computation" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.type" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javadelta" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/tree" value="false"/>
+<mapEntry key="org.eclipse.core.resources/preferences" value="false"/>
+<mapEntry key="org.eclipse.ui.intro/flags/noBrowser" value="false"/>
+<mapEntry key="org.eclipse.core.resources/perf/save.participants" value="500"/>
+<mapEntry key="org.eclipse.core.resources/natures" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/filemodelprovider/modelstatelistener" value="false"/>
+<mapEntry key="org.eclipse.osgi/defaultprofile/buffersize" value="256"/>
+<mapEntry key="org.eclipse.osgi/resolver/cycles" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/perf/variableinitializer" value="5000"/>
+<mapEntry key="org.eclipse.ui/trace/keyBindings.verbose" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/model" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.attribute.impl" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/filebuffers/modelmanagement" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/perf/success" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/contexts.performance" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/trace" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/compatibility/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/declaredImages" value="false"/>
+<mapEntry key="org.eclipse.pde.build/debug" value="false"/>
+<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/location" value="false"/>
+<mapEntry key="org.eclipse.jem.util/debug/logtracefile" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/contexts.verbose" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/emitter" value="true"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/buffer/size" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/showAllJobs" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener" value="false"/>
+<mapEntry key="org.eclipse.core.jobs/jobs" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/perspective.create" value="800"/>
+<mapEntry key="org.eclipse.ui/trace/sources" value="false"/>
+<mapEntry key="org.eclipse.debug.core/debug/commands" value="false"/>
+<mapEntry key="org.eclipse.core.resources/strings" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPartReference" value="false"/>
+<mapEntry key="org.eclipse.ui.ide/debug/undomonitor" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/structuredPresentationReconciler/time" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/metainfo" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/log.impl" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/part.activate" value="200"/>
+<mapEntry key="org.eclipse.ui.intro.universal/debug" value="true"/>
+<mapEntry key="org.eclipse.wst.sse.ui/contentOutline" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/perf" value="false"/>
+<mapEntry key="org.eclipse.wst.xml.core/debug/cmdocumentmanager" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.impl" value="false"/>
+<mapEntry key="org.eclipse.core.resources/contenttype" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/aggregate" value="false"/>
+<mapEntry key="org.eclipse.mtj.core.hooks/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/contributions" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/job.stale" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/info" value="true"/>
+<mapEntry key="org.eclipse.ui/perf/workbench.start" value="45000"/>
+<mapEntry key="org.eclipse.jdt.core/debug/completion" value="false"/>
+<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/debug/formatter" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/indexmanager" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/preferences-properties" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/storagemodelprovider/operations" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPerspectiveListener" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/loader" value="false"/>
+<mapEntry key="org.eclipse.wtp.common/debug/logtrace" value="false"/>
+<mapEntry key="com.mountainminds.eclemma.core/debug/performance" value="true"/>
+<mapEntry key="org.eclipse.ui.workbench/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/v1" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/launchhistory" value="false"/>
+<mapEntry key="org.eclipse.osgi/defaultprofile/logsynchronously" value="false"/>
+<mapEntry key="org.eclipse.osgi/trace/classLoading" value="false"/>
+<mapEntry key="org.eclipse.jface.text/debug/FastPartitioner/PositionCache" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.xml.ui/projectionperf" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder/readtime" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/handlers.performance" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/handlers.verbose.commandId" value=""/>
+<mapEntry key="org.eclipse.osgi/debug/filter" value="false"/>
+<mapEntry key="org.eclipse.jdt.apt.core/debug/compilationEnv" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/structuredmodel/lifecycle" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.layout.util" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/structuredmodel/modelmanager" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/debug/ASTProvider" value="false"/>
+<mapEntry key="org.eclipse.equinox.security.ui/debug/storage" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/builder/stats" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/style" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/filemodelprovider/operations" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/registry" value="false"/>
+<mapEntry key="org.eclipse.wtp.common/debug/loglevel" value="WARNING"/>
+<mapEntry key="org.eclipse.birt.chart.engine/factory" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/internal" value="false"/>
+<mapEntry key="org.eclipse.help.webapp/debug/workingsets" value="false"/>
+<mapEntry key="org.eclipse.osgi/defaultprofile/logfilename" value=""/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/directory" value="/tmp/"/>
+<mapEntry key="org.eclipse.wst.sse.ui/propertySheet" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/connect" value="false"/>
+<mapEntry key="org.eclipse.jface.text/debug/ContentAssistSubjectAdapters" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/markers" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/structureddocument" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/graphics" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/resolution" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.ssh/ssh_protocol" value="false"/>
+<mapEntry key="org.eclipse.core.resources/perf/snapshot" value="1000"/>
+<mapEntry key="org.eclipse.equinox.ds/print_on_console" value="true"/>
+<mapEntry key="org.eclipse.help/debug/search" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/needbuildstack" value="false"/>
+<mapEntry key="org.eclipse.help/debug/toc" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/part.init" value="800"/>
+<mapEntry key="org.eclipse.birt.chart.engine/util" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/structuredmodel/locks" value="true"/>
+<mapEntry key="org.eclipse.ui.intro/trace/logPerformance" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/script" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/dom/adapter/notification/time" value="false"/>
+<mapEntry key="org.eclipse.osgi/eclipseadaptor/converter/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/part.create" value="800"/>
+<mapEntry key="org.eclipse.wst.common.project.facet.core/activation" value="false"/>
+<mapEntry key="org.eclipse.wtp.common/debug/logtracefile" value="false"/>
+<mapEntry key="org.eclipse.osgi/eclipseadaptor/debug/platformadmin" value="false"/>
+<mapEntry key="org.eclipse.help.ui/debug/embeddedBrowser" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug/reconcilerValidators" value="false"/>
+<mapEntry key="org.eclipse.equinox.preferences/set" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/tasks/overalltime" value="false"/>
+<mapEntry key="org.eclipse.team.core/streams" value="false"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/use_old_implementation" value="false"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log" value="true"/>
+<mapEntry key="org.eclipse.core.resources/build/stacktrace" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/keyBindings" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.layout" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/debug/TypeConstraints" value="false"/>
+<mapEntry key="org.eclipse.equinox.ds/debug" value="true"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/error" value="true"/>
+<mapEntry key="org.eclipse.core.jobs/jobs/beginend" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.component.util" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/interrupt" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/showHeapStatus" value="true"/>
+<mapEntry key="org.eclipse.ui/perf/contentTypes" value="200"/>
+<mapEntry key="org.eclipse.ui/trace/commands" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/delta" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.data" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/search" value="false"/>
+<mapEntry key="org.eclipse.equinox.ds/instantiate_all" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/command" value="true"/>
+<mapEntry key="org.eclipse.wst.common.project.facet.core/actionSorting" value="false"/>
+<mapEntry key="org.eclipse.jdt.apt.core/debug" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/perf/completion" value="300"/>
+<mapEntry key="org.eclipse.jdt.core/debug/compiler" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/structuredPresentationReconciler" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/debug" value="true"/>
+<mapEntry key="com.mountainminds.eclemma.core/debug/emmaVerbosityLevel" value="info"/>
+<mapEntry key="org.eclipse.wst.sse.core/dom/adapter/notification/time/criteria" value="10"/>
+<mapEntry key="org.eclipse.jdt.core/debug/javamodel/cache" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/configuration" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/messageBundles" value="false"/>
+<mapEntry key="com.mountainminds.eclemma.core/debug/launching" value="true"/>
+<mapEntry key="org.eclipse.wst.sse.ui/gotoNextAnnotation" value="false"/>
+<mapEntry key="org.eclipse.jdt.core.manipulation/debug" value="true"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPartListener2" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPartListener2" value="false"/>
+<mapEntry key="org.eclipse.wst.validation/debug" value="true"/>
+<mapEntry key="org.eclipse.jdt.core/perf/reconcile" value="1000"/>
+<mapEntry key="org.eclipse.jdt.core/debug/hierarchy" value="false"/>
+<mapEntry key="org.eclipse.help.webapp/debug" value="true"/>
+<mapEntry key="org.eclipse.ui/debug/workingSets" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.core/filebuffers/lifecycle" value="false"/>
+<mapEntry key="org.eclipse.core.resources/refresh" value="false"/>
+<mapEntry key="org.eclipse.team.core/backgroundevents" value="false"/>
+<mapEntry key="org.eclipse.ltk.core.refactoring/perf/participants/createChanges" value="300"/>
+<mapEntry key="org.eclipse.jdt.core/debug/cpresolution" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug/reconcilerSpelling" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/warning" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/filemodelprovider/lifecyclelistener" value="false"/>
+<mapEntry key="org.eclipse.wst.common.project.facet.core/delegate/calls" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/parsing" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/explorer/makeActions" value="1000"/>
+<mapEntry key="org.eclipse.core.resources/restore/syncinfo" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/contentProvider" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchWindow.IPageListener" value="false"/>
+<mapEntry key="org.eclipse.team.core/threading" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/cachelookup" value="false"/>
+<mapEntry key="org.eclipse.update.core/debug/reconciler" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/security" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/debug" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.prefs" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/syncinfo" value="false"/>
+<mapEntry key="org.eclipse.osgi/profile/startup" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/services" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/ws_ant" value="true"/>
+<mapEntry key="org.eclipse.birt.chart.engine/computation.withaxes" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/markers" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/preferences/plugin" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/plugin" value="false"/>
+<mapEntry key="org.eclipse.osgi/monitor/resources" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugpopup" value="false"/>
+<mapEntry key="org.eclipse.core.jobs/jobs/timing" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/selection" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/exception" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/debug/ResultCollector" value="false"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/error" value="true"/>
+<mapEntry key="org.eclipse.core.resources/restore/snapshots" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/explorer/createPartControl" value="1300"/>
+<mapEntry key="org.eclipse.team.cvs.core/dirtycaching" value="false"/>
+<mapEntry key="org.eclipse.jdt.apt.core/debug/generatedFiles" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/zipaccess" value="false"/>
+<mapEntry key="org.eclipse.pde.core/cache" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder" value="false"/>
+<mapEntry key="org.eclipse.core.runtime/url/debug/cachecopy" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/stateSaveRestore" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/bundleTime" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/operations.verbose" value="false"/>
+<mapEntry key="org.eclipse.team.cvs.core/metafiles" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugtoolbar" value="false"/>
+<mapEntry key="org.eclipse.team.core/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.xml.core/debug/cmdocumentcache" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/workbench.restore" value="30000"/>
+<mapEntry key="org.eclipse.wst.sse.ui/storagemodelprovider/elementstatelistener" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendededitoractionbuilder/contributetime" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/events" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/warning" value="true"/>
+<mapEntry key="org.eclipse.wst.xml.core/debug" value="true"/>
+<mapEntry key="org.eclipse.core.jobs/jobs/errorondeadlock" value="false"/>
+<mapEntry key="org.eclipse.ui/debug/swtdebugglobal" value="false"/>
+<mapEntry key="org.eclipse.ui.ide/debug/internalerror/openDialog" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/computation.withoutaxes" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.component" value="false"/>
+<mapEntry key="org.eclipse.ui.intro.universal/trace/logPerformance" value="false"/>
+<mapEntry key="org.eclipse.ui.ide/debug/markers" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/uijob" value="200"/>
+<mapEntry key="org.eclipse.jdt.core/debug/sourcemapper" value="false"/>
+<mapEntry key="org.eclipse.debug.ui/debug/viewers/deltas" value="false"/>
+<mapEntry key="org.eclipse.osgi/resolver/generics" value="false"/>
+<mapEntry key="org.eclipse.osgi/resolver/wiring" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/perf/javadeltalistener" value="500"/>
+<mapEntry key="org.eclipse.osgi/profile/debug" value="false"/>
+<mapEntry key="com.mountainminds.eclemma.core/debug/analysis" value="true"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/char" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/contexts" value="false"/>
+<mapEntry key="org.eclipse.core.contenttype/debug" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/multipageeditor" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/invoking" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.data.util" value="false"/>
+<mapEntry key="org.eclipse.jem.util/debug/loglevel" value="WARNING"/>
+<mapEntry key="org.eclipse.ui/trace/operations" value="false"/>
+<mapEntry key="org.eclipse.core.resources/perf/builders" value="10000"/>
+<mapEntry key="org.eclipse.update.core/debug/type" value="false"/>
+<mapEntry key="org.eclipse.ui/perf/page.listeners" value="200"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.attribute" value="false"/>
+<mapEntry key="org.eclipse.jdt.ui/perf/explorer/RefactorActionGroup" value="150"/>
+<mapEntry key="org.eclipse.core.resources/history" value="false"/>
+<mapEntry key="org.eclipse.team.core/refreshjob" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/engine.i18n" value="false"/>
+<mapEntry key="org.eclipse.ui.intro/debug" value="true"/>
+<mapEntry key="org.eclipse.jface.text/debug/AbstractInformationControlManager" value="false"/>
+<mapEntry key="org.eclipse.debug.core/debug" value="false"/>
+<mapEntry key="org.eclipse.help/debug" value="true"/>
+<mapEntry key="org.eclipse.jface.text.source/debug/RevisionRulerColumn" value="false"/>
+<mapEntry key="org.eclipse.ui/debug" value="false"/>
+<mapEntry key="org.eclipse.osgi/debug/packageadmin" value="false"/>
+<mapEntry key="org.eclipse.core.resources/build/failure" value="false"/>
+<mapEntry key="org.eclipse.ui/trace/handlers" value="false"/>
+<mapEntry key="org.eclipse.ui/listeners/IWorkbenchPage.IPropertyChangeListener" value="false"/>
+<mapEntry key="org.eclipse.ui.browser/debug" value="false"/>
+<mapEntry key="org.eclipse.wst.common.environment/trace/ws_dt_cmd_engine" value="true"/>
+<mapEntry key="org.eclipse.core.resources/save/tree" value="false"/>
+<mapEntry key="org.eclipse.wst.sse.ui/debug/tracefilter" value=""/>
+<mapEntry key="org.eclipse.help.ui/debug" value="true"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.type.util" value="false"/>
+<mapEntry key="org.eclipse.core.resources/restore/metainfo" value="false"/>
+<mapEntry key="org.eclipse.core.resources/save/mastertable" value="false"/>
+<mapEntry key="org.eclipse.pde.core/debug" value="true"/>
+<mapEntry key="org.eclipse.wst.sse.ui/extendedconfigurationbuilder/time" value="false"/>
+<mapEntry key="org.eclipse.jdt.core/debug/buffermanager" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.layout.impl" value="false"/>
+<mapEntry key="org.eclipse.ui.ide/debug" value="false"/>
+<mapEntry key="org.eclipse.tm.terminal/debug/log/VT100Backend" value="false"/>
+<mapEntry key="org.eclipse.ui.intro/trace/logInfo" value="true"/>
+<mapEntry key="org.eclipse.core.resources/restore/mastertable" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/internal.script" value="false"/>
+<mapEntry key="org.eclipse.ui/experimental/menus" value="false"/>
+<mapEntry key="org.eclipse.pde.core/classpath" value="false"/>
+<mapEntry key="org.eclipse.birt.chart.engine/model.attribute.util" value="false"/>
+</mapAttribute>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.ds.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..1527566eb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Declarative Services Tests
+Bundle-Category: test
+Bundle-SymbolicName: org.eclipse.equinox.ds.tests
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.equinox.ds.tests.DSTestsActivator
+Bundle-ActivationPolicy: lazy
+Import-Package: junit.framework;version="[3.8.2,4.0.0)",
+ org.eclipse.osgi.service.urlconversion;version="1.0.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.cm;version="1.2.0",
+ org.osgi.service.component;version="1.0.0",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.service.packageadmin;version="1.2.0",
+ org.osgi.service.permissionadmin;version="1.2.0",
+ org.osgi.util.tracker;version="1.4.2"
+Export-Package: org.eclipse.equinox.ds.tests.tbc
diff --git a/bundles/org.eclipse.equinox.ds.tests/build.properties b/bundles/org.eclipse.equinox.ds.tests/build.properties
new file mode 100644
index 000000000..c1dc252dd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/build.properties
@@ -0,0 +1,81 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ osgi_config.xml,\
+ scr_test/tb1.jar,\
+ scr_test/tb2.jar,\
+ scr_test/tb3.jar,\
+ scr_test/tb4.jar,\
+ scr_test/tb5.jar,\
+ scr_test/tb6.jar,\
+ scr_test/tb7.jar,\
+ scr_test/tb8.jar,\
+ scr_test/tb9.jar,\
+ scr_test/tb10.jar,\
+ scr_test/tb11.jar,\
+ scr_test/tb12.jar,\
+ scr_test/tb13.jar,\
+ scr_test/tb14.jar,\
+ scr_test/tb15.jar,\
+ scr_test/tb16.jar,\
+ scr_test/tb17.jar,\
+ scr_test/tb18.jar,\
+ scr_test/tb19.jar
+jars.compile.order = .,\
+ scr_test/tb1.jar,\
+ scr_test/tb2.jar,\
+ scr_test/tb3.jar,\
+ scr_test/tb4.jar,\
+ scr_test/tb5.jar,\
+ scr_test/tb6.jar,\
+ scr_test/tb7.jar,\
+ scr_test/tb8.jar,\
+ scr_test/tb9.jar,\
+ scr_test/tb10.jar,\
+ scr_test/tb11.jar,\
+ scr_test/tb12.jar,\
+ scr_test/tb13.jar,\
+ scr_test/tb14.jar,\
+ scr_test/tb15.jar,\
+ scr_test/tb16.jar,\
+ scr_test/tb17.jar,\
+ scr_test/tb18.jar,\
+ scr_test/tb19.jar
+source.scr_test/tb1.jar = bundles_src/tb1/
+manifest.scr_test/tb1.jar = META-INF/MANIFEST.MF
+source.scr_test/tb2.jar = bundles_src/tb2/
+manifest.scr_test/tb2.jar = META-INF/MANIFEST.MF
+source.scr_test/tb3.jar = bundles_src/tb3/
+manifest.scr_test/tb3.jar = META-INF/MANIFEST.MF
+source.scr_test/tb4.jar = bundles_src/tb4/
+manifest.scr_test/tb4.jar = META-INF/MANIFEST.MF
+source.scr_test/tb5.jar = bundles_src/tb5/
+manifest.scr_test/tb5.jar = META-INF/MANIFEST.MF
+source.scr_test/tb6.jar = bundles_src/tb6/
+manifest.scr_test/tb6.jar = META-INF/MANIFEST.MF
+source.scr_test/tb7.jar = bundles_src/tb7/
+manifest.scr_test/tb7.jar = META-INF/MANIFEST.MF
+source.scr_test/tb8.jar = bundles_src/tb8/
+manifest.scr_test/tb8.jar = META-INF/MANIFEST.MF
+source.scr_test/tb9.jar = bundles_src/tb9/
+manifest.scr_test/tb9.jar = META-INF/MANIFEST.MF
+source.scr_test/tb10.jar = bundles_src/tb10/
+manifest.scr_test/tb10.jar = META-INF/MANIFEST.MF
+source.scr_test/tb11.jar = bundles_src/tb11/
+manifest.scr_test/tb11.jar = META-INF/MANIFEST.MF
+source.scr_test/tb12.jar = bundles_src/tb12/
+manifest.scr_test/tb12.jar = META-INF/MANIFEST.MF
+source.scr_test/tb13.jar = bundles_src/tb13/
+manifest.scr_test/tb13.jar = META-INF/MANIFEST.MF
+source.scr_test/tb14.jar = bundles_src/tb14/
+manifest.scr_test/tb14.jar = META-INF/MANIFEST.MF
+source.scr_test/tb15.jar = bundles_src/tb15/
+manifest.scr_test/tb15.jar = META-INF/MANIFEST.MF
+source.scr_test/tb16.jar = bundles_src/tb16/
+manifest.scr_test/tb16.jar = META-INF/MANIFEST.MF
+source.scr_test/tb17.jar = bundles_src/tb17/
+manifest.scr_test/tb17.jar = META-INF/MANIFEST.MF
+source.scr_test/tb18.jar = bundles_src/tb18/
+manifest.scr_test/tb18.jar = META-INF/MANIFEST.MF
+source.scr_test/tb19.jar = bundles_src/tb19/
+manifest.scr_test/tb19.jar = META-INF/MANIFEST.MF
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..eba806978
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB1
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Bundle-Activator: org.eclipse.equinox.ds.tests.tb1.impl.Activator
+Service-Component: org/eclipse/equinox/ds/tests/tb1/impl/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/BindUnbindSuccessor.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/BindUnbindSuccessor.java
new file mode 100644
index 000000000..6a5783a38
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/BindUnbindSuccessor.java
@@ -0,0 +1,43 @@
+package org.eclipse.equinox.ds.tests.tb1;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tb1.impl.BindUnbind;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentManager;
+import org.osgi.service.component.ComponentContext;
+
+
+public class BindUnbindSuccessor extends BindUnbind implements ComponentManager, ComponentContextProvider {
+
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public void doNothing() {
+
+ }
+
+ public ComponentContext getContext() {
+ return ctxt;
+ }
+
+ public void enableComponent(String name, boolean flag) {
+ if (flag) ctxt.enableComponent(name);
+ else ctxt.disableComponent(name);
+ }
+
+ public Dictionary getProperties() {
+ return ctxt.getProperties();
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/Immediate.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/Immediate.java
new file mode 100644
index 000000000..a4adddefe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/Immediate.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1;
+
+public class Immediate {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Activator.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Activator.java
new file mode 100644
index 000000000..5d2c9c0a1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Activator.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private BundleContext ctx;
+ private static Activator instance;
+
+ public Activator() {
+ Activator.instance = this;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ this.ctx = context;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ this.ctx = null;
+ }
+
+ public static BundleContext getContext() {
+ return instance.ctx;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/AnotherComponent.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/AnotherComponent.java
new file mode 100644
index 000000000..6f4a0a45c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/AnotherComponent.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.BundleContextProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+
+
+public class AnotherComponent implements BundleContextProvider {
+
+ private ComponentContext ctxt;
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public ComponentContext getContext() {
+ return ctxt;
+ }
+ public BundleContext getBundleContext() {
+ return Activator.getContext();
+ }
+ public Dictionary getProperties() {
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BaseComp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BaseComp.java
new file mode 100644
index 000000000..2c387f884
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BaseComp.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class BaseComp implements ComponentContextProvider {
+
+ private ComponentContext ctxt;
+
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BindUnbind.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BindUnbind.java
new file mode 100644
index 000000000..d3a180894
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/BindUnbind.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+import java.util.Dictionary;
+import java.util.Vector;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundTester;
+import org.osgi.framework.ServiceReference;
+
+
+public class BindUnbind implements BoundTester {
+
+ private Vector boundObjects = new Vector();
+
+ public void bindSAComp(ServiceReference sr) {
+ if (boundObjects.contains(sr)) {
+ } else {
+ boundObjects.addElement(sr);
+ }
+ }
+
+ public void unbindSAComp(ServiceReference sr) {
+ if (boundObjects.contains(sr)) {
+ boundObjects.removeElement(sr);
+ }
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ public int getBoundObjectsCount() {
+ return boundObjects.size();
+ }
+
+ public ServiceReference getBoundServiceRef(int index) {
+ return (ServiceReference) boundObjects.elementAt(index);
+ }
+
+ public Object getBoundService(int index) {
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular1.java
new file mode 100644
index 000000000..bb25783e8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular1.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+public class Circular1 {
+
+
+ public void bindComp2(Circular2 sr) {
+ }
+ public void unbindComp2(Circular2 sr) {
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular2.java
new file mode 100644
index 000000000..219d6aad8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/Circular2.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb1.impl;
+
+
+public class Circular2 {
+
+ public void bindComp1(Circular1 sr) {
+ }
+ public void unbindComp1(Circular1 sr) {
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/components.xml
new file mode 100644
index 000000000..d80ba5e97
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/components.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+
+<!-- another bad component - component factory cannot be immediate -->
+<scr:component name="org.eclipse.equinox.ds.tests.tb1.Immediate"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true"
+ factory="org.eclipse.equinox.ds.tests.tb1.Immediate">
+ <implementation class="org.eclipse.equinox.ds.tests.tb1.Immediate" />
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb1.Immediate"/>
+ </service>
+</scr:component>
+
+<!-- this below should be ignored by the SCR parser -->
+<ignored>
+ <component>
+ <service servicefactory="true" />
+ </component>
+</ignored>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"
+ enabled="true"
+ immediate="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <properties entry="org/eclipse/equinox/ds/tests/tb1/impl/sac.properties"/>
+ <property name="test.property.list" value="setFromDefinition"/>
+ <property name="test.property.cont" value="setFromDefinition"/>
+ <property name="test.property.name" value="setFromDefinition"/>
+ <property name="component.name" value="setFromDefinition"/>
+ <property name="component.id" value="-1" type="Long"/>
+ <implementation class="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb1.impl.BaseComp"
+ enabled="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb1.impl.BaseComp"/>
+ <property name="custom" value="customvalue"/>
+ <service servicefactory="true">
+ <provide interface="org.eclipse.equinox.ds.tests.tb1.impl.BaseComp"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb1.BindUnbindSuccessor"
+ enabled="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb1.BindUnbindSuccessor"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb1.BindUnbindSuccessor"/>
+ </service>
+
+ <reference name="StandAloneComp"
+ interface="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent)"
+ bind="bindSAComp"
+ unbind="unbindSAComp"
+ cardinality="0..n"
+ policy="dynamic"
+ />
+
+</scr:component>
+
+</root>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/sac.properties b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/sac.properties
new file mode 100644
index 000000000..064718f8b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb1/org/eclipse/equinox/ds/tests/tb1/impl/sac.properties
@@ -0,0 +1,6 @@
+test.property.name=setFromFile
+test.property.value=setFromFile
+test.property.array=setFromFile
+# try to override component.name & component.id
+component.name="setFromFile"
+component.id=-1 \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..e256179e0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB10
+Bundle-Category: test
+Import-Package: org.osgi.framework,
+ org.osgi.service.component; version="1.0.0",
+ org.eclipse.equinox.ds.tests.tbc
+Export-Package: org.eclipse.equinox.ds.tests.tb10
+Service-Component: org/eclipse/equinox/ds/tests/tb10/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountFactory.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountFactory.java
new file mode 100644
index 000000000..d61e34617
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountFactory.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb10;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundCountProvider;
+import org.osgi.framework.ServiceReference;
+
+
+public class CountFactory implements BoundCountProvider {
+
+ private List boundServices = new ArrayList();
+
+ public int getBoundServiceCount(String service) {
+ return boundServices.size();
+ }
+
+ public void bindService(ServiceReference ref) {
+ boundServices.add(ref);
+ }
+
+ public void unbindService(ServiceReference ref) {
+ boundServices.remove(ref);
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountHelperFactory.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountHelperFactory.java
new file mode 100644
index 000000000..791aace24
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/CountHelperFactory.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb10;
+
+public class CountHelperFactory {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/components.xml
new file mode 100644
index 000000000..7391e529b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb10/org/eclipse/equinox/ds/tests/tb10/components.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
+
+ <component name="ServiceCountHelperFactory" factory="CountHelperFactory">
+ <implementation class="org.eclipse.equinox.ds.tests.tb10.CountHelperFactory"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb10.CountHelperFactory"/>
+ </service>
+ </component>
+
+ <component name="ServiceCountFactory" factory="CountFactory">
+ <implementation class="org.eclipse.equinox.ds.tests.tb10.CountFactory"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.BoundCountProvider"/>
+ </service>
+ <reference name="HELPERFACTORY"
+ interface="org.eclipse.equinox.ds.tests.tb10.CountHelperFactory"
+ cardinality="0..n"
+ policy="dynamic"
+ bind="bindService"
+ unbind="unbindService"/>
+ <reference name="SIMPLECOMPONENT"
+ interface="org.eclipse.equinox.ds.tests.tb1.impl.BaseComp"
+ cardinality="0..n"
+ policy="dynamic"
+ bind="bindService"
+ unbind="unbindService"/>
+ </component>
+
+ <component name="StaticServiceCountFactory" factory="StaticServiceCountFactory">
+ <implementation class="org.eclipse.equinox.ds.tests.tb10.CountFactory"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.BoundCountProvider"/>
+ </service>
+ <reference name="HELPERFACTORY"
+ interface="org.eclipse.equinox.ds.tests.tb10.CountHelperFactory"
+ cardinality="0..n"
+ policy="static"
+ bind="bindService"
+ unbind="unbindService"/>
+ <reference name="SIMPLECOMPONENT"
+ interface="org.eclipse.equinox.ds.tests.tb1.impl.BaseComp"
+ cardinality="0..n"
+ policy="static"
+ bind="bindService"
+ unbind="unbindService"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..ca5c34dd9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB11
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb11/optional100.xml,
+ org/eclipse/equinox/ds/tests/tb11/optional110.xml,
+ org/eclipse/equinox/ds/tests/tb11/require100.xml,
+ org/eclipse/equinox/ds/tests/tb11/require110.xml,
+ org/eclipse/equinox/ds/tests/tb11/ignore100.xml,
+ org/eclipse/equinox/ds/tests/tb11/ignore110.xml,
+ org/eclipse/equinox/ds/tests/tb11/notset100.xml,
+ org/eclipse/equinox/ds/tests/tb11/notset110.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ConfigurationPolicyComp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ConfigurationPolicyComp.java
new file mode 100644
index 000000000..9cfbb820c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ConfigurationPolicyComp.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb11;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class ConfigurationPolicyComp implements PropertiesProvider {
+ private ComponentContext ctxt;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+
+ }
+
+ public Dictionary getProperties() {
+ if (ctxt == null)
+ return null;
+
+ return ctxt.getProperties();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore100.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore100.xml
new file mode 100644
index 000000000..93848ca8c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore100.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has ignore confuguration policy, but old XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb11.ignoreNS100"
+ configuration-policy="ignore"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore110.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore110.xml
new file mode 100644
index 000000000..ed63fc6cf
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/ignore110.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has ignore confuguration policy, and new XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb11.ignoreNS110"
+ configuration-policy="ignore"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset100.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset100.xml
new file mode 100644
index 000000000..802b5f8ac
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset100.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has not confuguration policy set and old XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb11.notsetNS100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset110.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset110.xml
new file mode 100644
index 000000000..c2580c479
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/notset110.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has not confuguration policy set and new XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb11.notsetNS110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional100.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional100.xml
new file mode 100644
index 000000000..fa64be42c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional100.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has optional confuguration policy, but old XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb11.optionalNS100"
+ configuration-policy="optional"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional110.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional110.xml
new file mode 100644
index 000000000..406ee210b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/optional110.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has optional confuguration policy, and new XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb11.optionalNS110"
+ configuration-policy="optional"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require100.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require100.xml
new file mode 100644
index 000000000..c8ebcd035
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require100.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has require confuguration policy, but old XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb11.requireNS100"
+ configuration-policy="require"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require110.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require110.xml
new file mode 100644
index 000000000..836dfc5a7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb11/org/eclipse/equinox/ds/tests/tb11/require110.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This component has require confuguration policy, and new XML Schema -->
+
+<component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb11.requireNS110"
+ configuration-policy="require"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb11.ConfigurationPolicyComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..1caeb82b2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB12
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb12/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc100.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc100.java
new file mode 100644
index 000000000..e691a4d19
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc100.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+public class Bc100 extends CallRegistrator {
+
+ public String getName() {
+ return "org.eclipse.equinox.ds.tests.tb12.Bc100";
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc110.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc110.java
new file mode 100644
index 000000000..5c351a467
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/Bc110.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+public class Bc110 extends CallRegistrator {
+
+ public String getName() {
+ return "org.eclipse.equinox.ds.tests.tb12.Bc110";
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/CallRegistrator.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/CallRegistrator.java
new file mode 100644
index 000000000..8af8fcc7e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/CallRegistrator.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.component.ComponentContext;
+
+
+public class CallRegistrator implements ComponentContextProvider {
+ private Dictionary properties;
+ private ComponentContext ctxt;
+ private static final int ACTIVATE_CC = 1 << 0;
+ private static final int DEACTIVATE_CC = 1 << 1;
+ private static final int ACT = 1 << 2;
+ private static final int DEACT = 1 << 3;
+ private static final int ACT_CC = 1 << 4;
+ private static final int DEACT_CC = 1 << 5;
+ private static final int ACT_BC = 1 << 6;
+ private static final int DEACT_BC = 1 << 7;
+ private static final int ACT_MAP = 1 << 8;
+ private static final int DEACT_MAP = 1 << 9;
+ private static final int ACT_CC_BC_MAP = 1 << 10;
+ private static final int DEACT_CC_BC_MAP = 1 << 11;
+ private static final int DEACT_INT = 1 << 12;
+ private static final int DEACT_CC_BC_MAP_INT = 1 << 13;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ setDataBits(ACTIVATE_CC);
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+ setDataBits(DEACTIVATE_CC);
+ }
+
+ protected void act() {
+ properties = new Properties();
+ properties.put(ComponentConstants.COMPONENT_NAME, getName());
+ setDataBits(ACT);
+ }
+
+ protected void deact() {
+ setDataBits(DEACT);
+ }
+
+ protected void actCc(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ setDataBits(ACT_CC);
+ }
+
+ protected void deactCc(ComponentContext ctxt) {
+ setDataBits(DEACT_CC);
+ }
+
+ protected void actBc(BundleContext bc) {
+ properties = new Properties();
+ properties.put(ComponentConstants.COMPONENT_NAME, getName());
+ setDataBits(ACT_BC);
+ }
+
+ protected void deactBc(BundleContext bc) {
+ setDataBits(DEACT_BC);
+ }
+
+ protected void actMap(Map props) {
+ properties = new Properties();
+ Iterator it = props.keySet().iterator();
+ while (it.hasNext()) {
+ Object key = it.next();
+ properties.put(key, props.get(key));
+ }
+ setDataBits(ACT_MAP);
+ }
+
+ protected void deactMap(Map props) {
+ setDataBits(DEACT_MAP);
+ }
+
+ protected void actCcBcMap(ComponentContext ctxt, BundleContext bc, Map props) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ setDataBits(ACT_CC_BC_MAP);
+ }
+
+ protected void deactCcBcMap(ComponentContext ctxt, BundleContext bc, Map props) {
+ setDataBits(DEACT_CC_BC_MAP);
+ }
+
+ protected void deactInt(int reason) {
+ setDataBits(DEACT_INT | reason << 16);
+ }
+
+ protected void deactCcBcMapInt(ComponentContext ctxt, BundleContext bc,
+ Map props, int reason) {
+ setDataBits(DEACT_CC_BC_MAP_INT | reason << 16);
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ private void setDataBits(int value) {
+ if (properties == null) {
+ return;
+ }
+ Object prop = properties.get("config.base.data");
+ int data = (prop instanceof Integer) ? ((Integer) prop).intValue() : 0;
+ properties.put("config.base.data", new Integer(data | value));
+ }
+
+ // Successors should override
+ public String getName() {
+ return "name.unknown";
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/ContextExp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/ContextExp.java
new file mode 100644
index 000000000..ad7717c6e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/ContextExp.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class ContextExp implements ComponentContextProvider {
+ private ComponentContext ctxt;
+ Dictionary properties;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs100.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs100.java
new file mode 100644
index 000000000..165f8e244
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs100.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+public class NoArgs100 extends CallRegistrator {
+
+ public String getName() {
+ return "org.eclipse.equinox.ds.tests.tb12.NoArgs100";
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs110.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs110.java
new file mode 100644
index 000000000..a1c05f2cd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/NoArgs110.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb12;
+
+public class NoArgs110 extends CallRegistrator {
+
+ public String getName() {
+ return "org.eclipse.equinox.ds.tests.tb12.NoArgs110";
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/components.xml
new file mode 100644
index 000000000..683cc6536
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb12/org/eclipse/equinox/ds/tests/tb12/components.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <!-- This component has not set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.notsetNS100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has not set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.notsetNS110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.NoArgs100"
+ activate="act"
+ deactivate="deact"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.NoArgs100"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.NoArgs110"
+ activate="act"
+ deactivate="deact"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.NoArgs110"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.CcNS100"
+ activate="actCc"
+ deactivate="deactCc"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.CcNS110"
+ activate="actCc"
+ deactivate="deactCc"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.Bc100"
+ activate="actBc"
+ deactivate="deactBc"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.Bc100"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.Bc110"
+ activate="actBc"
+ deactivate="deactBc"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.Bc110"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.MapNS100"
+ activate="actMap"
+ deactivate="deactMap"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.MapNS110"
+ activate="actMap"
+ deactivate="deactMap"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.CcBcMapNS100"
+ activate="actCcBcMap"
+ deactivate="deactCcBcMap"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.CcBcMapNS110"
+ activate="actCcBcMap"
+ deactivate="deactCcBcMap"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.IntNS110"
+ activate="activate"
+ deactivate="deactInt"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- This component has set activate/deactivate methods and new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb12.CcBcMapIntNS110"
+ activate="activate"
+ deactivate="deactCcBcMapInt"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.CallRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ name="org.eclipse.equinox.ds.tests.tb12.ContextExp"
+ interface="org.eclipse.equinox.ds.tests.tb12.ContextExp"/>
+ </component>
+
+
+
+ <!-- This component provides ComponentContext -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb12.ContextExp"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb12.ContextExp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb12.ContextExp"/>
+ </service>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..af53b89a6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB13
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb13/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/BindUnbindRegistrator.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/BindUnbindRegistrator.java
new file mode 100644
index 000000000..dbdef0742
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/BindUnbindRegistrator.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb13;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentManager;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+
+
+public class BindUnbindRegistrator implements PropertiesProvider {
+ private Dictionary properties = new Properties();
+ private ComponentContext ctxt;
+ private static final int BIND_SR = 1 << 0;
+ private static final int UNBIND_SR = 1 << 1;
+ private static final int BIND_CM = 1 << 2;
+ private static final int UNBIND_CM = 1 << 3;
+ private static final int BIND_CM_MAP = 1 << 4;
+ private static final int UNBIND_CM_MAP = 1 << 5;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ Dictionary props = ctxt.getProperties();
+ Enumeration en = props.keys();
+ while (en.hasMoreElements()) {
+ Object key = en.nextElement();
+ properties.put(key, props.get(key));
+ }
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+
+ }
+
+ protected void bindSr(ServiceReference sr) {
+ setDataBits(BIND_SR);
+ }
+
+ protected void unbindSr(ServiceReference sr) {
+ setDataBits(UNBIND_SR);
+ }
+
+ protected void bindCm(ComponentManager ce) {
+ setDataBits(BIND_CM);
+ }
+
+ protected void unbindCm(ComponentManager ce) {
+ setDataBits(UNBIND_CM);
+ }
+
+ protected void bindCmMap(ComponentManager ce, Map props) {
+ setDataBits(BIND_CM_MAP);
+ }
+
+ protected void unbindCmMap(ComponentManager ce, Map props) {
+ setDataBits(UNBIND_CM_MAP);
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ private void setDataBits(int value) {
+ if (properties == null) {
+ return;
+ }
+ Object prop = properties.get("config.base.data");
+ int data = (prop instanceof Integer) ? ((Integer) prop).intValue() : 0;
+ properties.put("config.base.data", new Integer(data | value));
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/Enabler.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/Enabler.java
new file mode 100644
index 000000000..a2653eb02
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/Enabler.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb13;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentManager;
+import org.osgi.service.component.ComponentContext;
+
+
+public class Enabler implements ComponentManager {
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public void enableComponent(String name, boolean flag) {
+ if (flag) ctxt.enableComponent(name);
+ else ctxt.disableComponent(name);
+ }
+
+ public Dictionary getProperties() {
+ return ctxt.getProperties();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/components.xml
new file mode 100644
index 000000000..36b9fb4c1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb13/org/eclipse/equinox/ds/tests/tb13/components.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <!-- This component provides ComponentManager service which other components use -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb13.Enabler"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.Enabler"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"/>
+ </service>
+ </component>
+
+ <!-- bind/unbind with ServiceReference; old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb13.SrNS100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindSr"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindSr"/>
+ </component>
+
+ <!-- bind/unbind with ServiceReference; new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb13.SrNS110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindSr"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindSr"/>
+ </component>
+
+ <!-- bind/unbind with ComponentEnabler; old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb13.CeNS100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindCm"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindCm"/>
+ </component>
+
+ <!-- bind/unbind with ComponentEnabler; new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb13.CeNS110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindCm"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindCm"/>
+ </component>
+
+ <!-- bind/unbind with ComponentEnabler, Map; old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb13.CeMapNS100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindCmMap"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindCmMap"/>
+ </component>
+
+ <!-- bind/unbind with ComponentEnabler, Map; new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb13.CeMapNS110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb13.BindUnbindRegistrator"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ bind="bindCmMap"
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentManager"
+ name="componentenabler"
+ unbind="unbindCmMap"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..9ba35c5b9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB14
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb14/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/ContextExp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/ContextExp.java
new file mode 100644
index 000000000..8860daced
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/ContextExp.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb14;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class ContextExp implements ComponentContextProvider {
+
+ public ComponentContext getComponentContext() {
+ return null;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional.java
new file mode 100644
index 000000000..95ff3a5a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb14;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class Optional implements PropertiesProvider, ComponentContextProvider {
+ private Dictionary properties;
+ private ComponentContext ctxt;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional2.java
new file mode 100644
index 000000000..d325e0a6c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/Optional2.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb14;
+
+public class Optional2 extends Optional {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/components.xml
new file mode 100644
index 000000000..9f8dc9358
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb14/org/eclipse/equinox/ds/tests/tb14/components.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <!-- This component provides ComponentContextExposer service which other components use -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb14.ContextExp"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb14.ContextExp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"/>
+ </service>
+ </component>
+
+ <!-- Component name not set; old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb14.Optional"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- Component name not set; new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb14.Optional2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ </component>
+
+ <!-- Reference name not set; old XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb14.OptRef100"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb14.Optional"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"/>
+ </component>
+
+ <!-- Reference name not set; new XML Schema -->
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.1.0"
+ name="org.eclipse.equinox.ds.tests.tb14.OptRef110"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb14.Optional"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"/>
+ </component>
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..4dee023e8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB15
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb15/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component1.java
new file mode 100644
index 000000000..8c2e2cdcb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component1.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb15;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class Component1 implements PropertiesProvider, ComponentContextProvider {
+ protected static int deactCount = 0;
+ private int deactPos = -1;
+ private Dictionary properties;
+ private ComponentContext ctxt;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+ deactPos = deactCount++;
+ properties.put("config.base.data", new Integer(deactPos));
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ public int getDeactivationPos() {
+ return deactPos;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component2.java
new file mode 100644
index 000000000..53fcb88b8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component2.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb15;
+
+public class Component2 extends Component1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component3.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component3.java
new file mode 100644
index 000000000..d5eb881ff
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/Component3.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb15;
+
+public class Component3 extends Component1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/components.xml
new file mode 100644
index 000000000..25ac516e6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb15/org/eclipse/equinox/ds/tests/tb15/components.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb15.Component1"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb15.Component1"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ <provide interface="org.eclipse.equinox.ds.tests.tb15.Component1"/>
+ </service>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb15.Component2"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb15.Component2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ <provide interface="org.eclipse.equinox.ds.tests.tb15.Component2"/>
+ </service>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tb15.Component1"
+ name="c1"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb15.Component3"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb15.Component3"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tb15.Component1"
+ name="c1"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tb15.Component2"
+ name="c2"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..deedbcf76
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB16
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb16/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/TargetProperties.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/TargetProperties.java
new file mode 100644
index 000000000..d629e27e1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/TargetProperties.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb16;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+
+
+public class TargetProperties implements PropertiesProvider, ComponentContextProvider {
+ private Dictionary properties;
+ private ComponentContext ctxt;
+ private ServiceRegistration sr;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+
+ Object prop = properties.get("serial.num");
+ if (prop != null) {
+ Properties serviceProps = new Properties();
+ serviceProps.put("serial.num", prop);
+ sr = ctxt.getBundleContext().registerService(getClass().getName(), this, serviceProps);
+ }
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+ if (sr != null) {
+ sr.unregister();
+ sr = null;
+ }
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/components.xml
new file mode 100644
index 000000000..b4bda3aae
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb16/org/eclipse/equinox/ds/tests/tb16/components.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb16.Exposer"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb16.TargetProperties"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ <provide interface="org.eclipse.equinox.ds.tests.tb16.TargetProperties"/>
+ </service>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb16.C1"
+ immediate="true"
+ enabled="false">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb16.TargetProperties"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <property
+ name="serial.num"
+ value="10"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb16.C2"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb16.TargetProperties"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"/>
+ </service>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tb16.TargetProperties"
+ name="ref"/>
+ <property
+ name="ref.target"
+ value="(serial.num=10)"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..851deb3d9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB17
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Export-Package: org.eclipse.equinox.ds.tests.tb17
+Service-Component: org/eclipse/equinox/ds/tests/tb17/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/Worker.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/Worker.java
new file mode 100644
index 000000000..5c02d20b9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/Worker.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb17;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.eclipse.equinox.ds.tests.tbc.PropertiesProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.component.ComponentContext;
+
+
+public class Worker implements PropertiesProvider, ComponentContextProvider {
+ private Dictionary properties;
+ private ComponentContext ctxt;
+ private ServiceRegistration sr;
+
+ protected void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ properties = ctxt.getProperties();
+
+ Object prop = properties.get(ComponentConstants.COMPONENT_NAME);
+ if (prop != null) {
+ Properties serviceProps = new Properties();
+ serviceProps.put(ComponentConstants.COMPONENT_NAME, prop);
+ sr = ctxt.getBundleContext().registerService(PropertiesProvider.class.getName(), this, serviceProps);
+ }
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+ if (sr != null) {
+ sr.unregister();
+ sr = null;
+ }
+ }
+
+ public Dictionary getProperties() {
+ return properties;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/components.xml
new file mode 100644
index 000000000..ef5442d19
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb17/org/eclipse/equinox/ds/tests/tb17/components.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C1"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C2"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C1)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C3"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C2)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C4"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C3)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C5"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C4)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C6"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C5)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C7"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C6)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C8"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C7)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C9"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C8)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb17.C10"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C9)"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..861174453
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB18
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tb17,
+ org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb18/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/org/eclipse/equinox/ds/tests/tb18/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/org/eclipse/equinox/ds/tests/tb18/components.xml
new file mode 100644
index 000000000..d7c94310a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb18/org/eclipse/equinox/ds/tests/tb18/components.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C1"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C1)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C2"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C1)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C2)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C3"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C2)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C3)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C4"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C3)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C4)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C5"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C4)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C5)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C6"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C5)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C6)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C7"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C6)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C7)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C8"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C7)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C8)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C9"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C8)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C9)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb18.C10"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice1"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb19.C9)"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice2"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb17.C10)"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..91417fb0a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB19
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tb17,
+ org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb19/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/org/eclipse/equinox/ds/tests/tb19/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/org/eclipse/equinox/ds/tests/tb19/components.xml
new file mode 100644
index 000000000..859937356
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb19/org/eclipse/equinox/ds/tests/tb19/components.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C1"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C1)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C2"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C2)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C3"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C3)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C4"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C4)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C5"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C5)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C6"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C6)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C7"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C7)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C8"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C8)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C9"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C9)"/>
+ </component>
+
+ <component
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ name="org.eclipse.equinox.ds.tests.tb19.C10"
+ immediate="true">
+ <implementation
+ class="org.eclipse.equinox.ds.tests.tb17.Worker"/>
+ <reference
+ interface="org.eclipse.equinox.ds.tests.tbc.PropertiesProvider"
+ name="baseservice"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb18.C10)"/>
+ </component>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..d3175c14e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB2
+Bundle-Category: test
+Import-Package: org.osgi.framework,
+ org.osgi.service.component;version="1.0.0",
+ org.eclipse.equinox.ds.tests.tbc
+Service-Component: org/eclipse/equinox/ds/tests/tb2/impl/blockingcomp.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/Blocker.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/Blocker.java
new file mode 100644
index 000000000..90ee80e5c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/Blocker.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb2.impl;
+
+import java.util.Dictionary;
+
+import org.osgi.service.component.ComponentContext;
+
+public class Blocker {
+
+ public void activate(ComponentContext ctxt) {
+ Dictionary props = ctxt.getProperties();
+ int timeout = 40000; // default value of 1 secs
+ Object t = props.get("block.timeout");
+ if (t != null) {
+ if (t instanceof String) {
+ timeout = Integer.parseInt((String) t);
+ } else if (t instanceof Integer) {
+ timeout = ((Integer)t).intValue();
+ }
+ }
+ try {
+ Thread.sleep(timeout);
+ } catch (InterruptedException ignore) {
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/blockingcomp.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/blockingcomp.xml
new file mode 100644
index 000000000..a91c35c1b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb2/org/eclipse/equinox/ds/tests/tb2/impl/blockingcomp.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb2.impl.Blocker"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb2.impl.Blocker"/>
+ <property name="block.timeout" value="60000"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb2.impl.Blocker"/>
+ </service>
+</scr:component>
+
+</root> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..97130eb0a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB3
+Bundle-Category: test
+Import-Package: org.osgi.framework,
+ org.osgi.service.component;version="1.0.0",
+ org.eclipse.equinox.ds.tests.tbc
+Service-Component: org/eclipse/equinox/ds/tests/tb3/impl/component.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/BindBlocker.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/BindBlocker.java
new file mode 100644
index 000000000..04e85193b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/BindBlocker.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb3.impl;
+
+import org.osgi.framework.ServiceReference;
+
+public class BindBlocker {
+
+ // the time the bind method will block
+ private int timeout = 60000;
+
+
+ public void setLogger(ServiceReference log) {
+ try {
+ Thread.sleep(timeout);
+ } catch (InterruptedException ignore) {
+ }
+ }
+
+ public void unsetLogger(ServiceReference log) {
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/component.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/component.xml
new file mode 100644
index 000000000..da50b2ced
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb3/org/eclipse/equinox/ds/tests/tb3/impl/component.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb3.impl.BindBlocker"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb3.impl.BindBlocker"/>
+ <property name="block.timeout" value="60000"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb3.impl.BindBlocker"/>
+ </service>
+ <reference
+ name="LOG"
+ cardinality="1..1"
+ interface="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"
+ bind="setLogger"
+ unbind="unsetLogger"
+ />
+</scr:component>
+
+</root> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..52096e3a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB4
+Bundle-Vendor: ProSyst
+Bundle-DocURL: http://www.prosyst.com
+Bundle-ContactAddress: d_nachev@prosyst.com
+Bundle-Category: test
+Import-Package: org.osgi.framework,
+ org.osgi.service.component; version="1.0.0",
+ org.eclipse.equinox.ds.tests.tbc
+Service-Component: org/eclipse/equinox/ds/tests/tb4/impl/namedservice.xml,org/eclipse/equinox/ds/tests/tb4/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AdvancedBounder.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AdvancedBounder.java
new file mode 100644
index 000000000..37af35913
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AdvancedBounder.java
@@ -0,0 +1,71 @@
+package org.eclipse.equinox.ds.tests.tb4;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundMainProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.eclipse.equinox.ds.tests.tbc.DSEvent;
+import org.eclipse.equinox.ds.tests.tbc.DSEventsProvider;
+import org.eclipse.equinox.ds.tests.tbc.DynamicWorker;
+import org.eclipse.equinox.ds.tests.tbc.StaticWorker;
+import org.osgi.service.component.ComponentContext;
+
+
+public class AdvancedBounder implements DSEventsProvider, BoundMainProvider, ComponentContextProvider {
+
+
+ private Hashtable boundServices = new Hashtable();
+ private Vector boundServiceEvents = new Vector();
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public void bindDynamicService(DynamicWorker dynService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_BOUND, dynService));
+ boundServices.put(BoundMainProvider.DYNAMIC_SERVICE, dynService);
+ }
+
+ public void unbindDynamicService(DynamicWorker dynService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_UNBOUND, dynService));
+ }
+
+ public void bindStaticService(StaticWorker staticService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_BOUND, staticService));
+ boundServices.put(BoundMainProvider.STATIC_SERVICE, staticService);
+ }
+
+ public void unbindStaticService(StaticWorker staticService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_UNBOUND, staticService));
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ public DSEvent[] getEvents() {
+ DSEvent[] events = new DSEvent[boundServiceEvents.size()];
+ boundServiceEvents.copyInto(events);
+ return events;
+ }
+
+ public Object getBoundService(String serviceName) {
+ return boundServices.get(serviceName);
+ }
+
+ public void resetEvents() {
+ boundServiceEvents.removeAllElements();
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AnotherComponent.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AnotherComponent.java
new file mode 100644
index 000000000..cb243b3c6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/AnotherComponent.java
@@ -0,0 +1,16 @@
+package org.eclipse.equinox.ds.tests.tb4;
+
+import org.eclipse.equinox.ds.tests.tbc.TestHelper;
+import org.osgi.service.component.ComponentContext;
+
+
+public class AnotherComponent {
+
+ public void activate(ComponentContext ctxt) {
+ TestHelper.setActivatedStandAlone(true);
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ TestHelper.setActivatedStandAlone(false);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/BoundReplacer.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/BoundReplacer.java
new file mode 100644
index 000000000..c7992e904
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/BoundReplacer.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundMainProvider;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.eclipse.equinox.ds.tests.tbc.DSEvent;
+import org.eclipse.equinox.ds.tests.tbc.DSEventsProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class BoundReplacer implements DSEventsProvider, BoundMainProvider, ComponentContextProvider {
+
+
+ private Hashtable boundServices = new Hashtable();
+ private Vector boundServiceEvents = new Vector();
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public void bindDynamicService(DynamicService dynService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_BOUND, dynService));
+ boundServices.put(BoundMainProvider.DYNAMIC_SERVICE, dynService);
+ }
+
+ public void unbindDynamicService(DynamicService dynService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_UNBOUND, dynService));
+ }
+
+ public void bindNamedService(NamedService namedService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_BOUND, namedService));
+ boundServices.put(BoundMainProvider.NAMED_SERVICE, namedService);
+ }
+
+ public void unbindNamedService(NamedService namedService) {
+ boundServiceEvents.addElement(new DSEvent(DSEvent.ACT_UNBOUND, namedService));
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ public DSEvent[] getEvents() {
+ DSEvent[] events = new DSEvent[boundServiceEvents.size()];
+ boundServiceEvents.copyInto(events);
+ return events;
+ }
+
+ public Object getBoundService(String serviceName) {
+ return boundServices.get(serviceName);
+ }
+
+ public void resetEvents() {
+ boundServiceEvents.removeAllElements();
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component1.java
new file mode 100644
index 000000000..a80c8ac9a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component1.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+public class Component1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component2.java
new file mode 100644
index 000000000..5246e3881
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component2.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+public class Component2 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component3.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component3.java
new file mode 100644
index 000000000..73ccfd8ec
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/Component3.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+public class Component3 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/DynamicService.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/DynamicService.java
new file mode 100644
index 000000000..807656b24
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/DynamicService.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.ds.tests.tb4;
+
+public interface DynamicService {
+ public void doNothing();
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/GiveMeContext.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/GiveMeContext.java
new file mode 100644
index 000000000..45524589f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/GiveMeContext.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+
+public class GiveMeContext implements ComponentContextProvider {
+
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/NamedService.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/NamedService.java
new file mode 100644
index 000000000..4b8e201a3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/NamedService.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.ds.tests.tb4;
+
+public interface NamedService {
+ public String getName();
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/ServiceProvider.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/ServiceProvider.java
new file mode 100644
index 000000000..0367fe62e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/ServiceProvider.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4;
+
+import org.eclipse.equinox.ds.tests.tbc.TestHelper;
+import org.osgi.service.component.ComponentContext;
+
+
+public class ServiceProvider {
+
+
+ public void activate(ComponentContext ctxt) {
+ TestHelper.setActivatedServiceProvider(true);
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ TestHelper.setActivatedServiceProvider(false);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/components.xml
new file mode 100644
index 000000000..fb11274bc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/components.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.AnotherComponent"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.AnotherComponent"/>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.ServiceProvider"
+ immediate="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.ServiceProvider"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.ServiceProvider"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.Component3"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.Component3"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.Component3"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.Component2"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.Component2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.Component2"/>
+ </service>
+ <reference
+ name="TailComponent"
+ interface="org.eclipse.equinox.ds.tests.tb4.Component3"
+ />
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.Component1"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.Component1"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.Component1"/>
+ </service>
+ <reference
+ name="MiddleComponent"
+ interface="org.eclipse.equinox.ds.tests.tb4.Component2"
+ />
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.GiveMeContext"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.GiveMeContext"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"/>
+ </service>
+</scr:component>
+</root>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/DynamicFactory.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/DynamicFactory.java
new file mode 100644
index 000000000..9aa257997
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/DynamicFactory.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4.impl;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tb4.DynamicService;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+public class DynamicFactory implements DynamicService, ComponentContextProvider {
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext componentContext) {
+ this.ctxt = componentContext;
+ }
+
+ public void doNothing() {
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/NamedFactory.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/NamedFactory.java
new file mode 100644
index 000000000..c894c2eb9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/NamedFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb4.impl;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tb4.NamedService;
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.osgi.service.component.ComponentContext;
+
+public class NamedFactory implements NamedService, ComponentContextProvider {
+ private String name = "name not init";
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext componentContext) {
+ this.ctxt = componentContext;
+ name = (String) componentContext.getProperties().get("name");
+ if( name == null ) {
+ this.name = "name not set";
+ }
+ }
+
+ // it is absolutely legal to have activate without having deactivate!
+ //public void deactivate(ComponentContext cc) {}
+
+ public String getName() {
+ return name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+ public Dictionary getProperties() {
+ return ctxt.getProperties();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.properties b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.properties
new file mode 100644
index 000000000..57f6f4616
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.properties
@@ -0,0 +1 @@
+override.property.2=setFromFile \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.xml
new file mode 100644
index 000000000..950f4e15d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb4/org/eclipse/equinox/ds/tests/tb4/impl/namedservice.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.NamedService"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ factory="org.eclipse.equinox.ds.tests.tb4.NamedService">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.impl.NamedFactory" />
+ <property name="override.property.1" value="setFromXML"/>
+ <properties entry="org/eclipse/equinox/ds/tests/tb4/impl/namedservice.properties"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.NamedService"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.DynamicService"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ factory="org.eclipse.equinox.ds.tests.tb4.DynamicService">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.impl.DynamicFactory" />
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.DynamicService"/>
+ </service>
+</scr:component>
+
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.BoundReplacer"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.BoundReplacer"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.BoundReplacer"/>
+ </service>
+ <reference
+ name="DynamicReference"
+ interface="org.eclipse.equinox.ds.tests.tb4.DynamicService"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb4.DynamicService)"
+ cardinality="1..1"
+ bind="bindDynamicService"
+ unbind="unbindDynamicService"
+ policy="dynamic"
+ />
+ <reference
+ name="StaticReference"
+ interface="org.eclipse.equinox.ds.tests.tb4.NamedService"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb4.NamedService)"
+ cardinality="1..1"
+ bind="bindNamedService"
+ unbind="unbindNamedService"
+ policy="static"
+ />
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb4.AdvancedBounder"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb4.AdvancedBounder"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb4.AdvancedBounder"/>
+ </service>
+ <reference
+ name="DynamicReference"
+ interface="org.eclipse.equinox.ds.tests.tbc.DynamicWorker"
+ target="(mandatory.property=true)"
+ cardinality="1..1"
+ bind="bindDynamicService"
+ unbind="unbindDynamicService"
+ policy="dynamic"
+ />
+ <reference
+ name="StaticReference"
+ interface="org.eclipse.equinox.ds.tests.tbc.StaticWorker"
+ target="(mandatory.property=true)"
+ cardinality="1..1"
+ bind="bindStaticService"
+ unbind="unbindStaticService"
+ policy="static"
+ />
+</scr:component>
+</root>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..602889e2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB5
+Bundle-Category: test
+Service-Component: org/eclipse/equinox/ds/tests/tb5/impl/component.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/SecurityTester.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/SecurityTester.java
new file mode 100644
index 000000000..c320fe151
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/SecurityTester.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb5.impl;
+
+public class SecurityTester {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/component.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/component.xml
new file mode 100644
index 000000000..666f96d80
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb5/org/eclipse/equinox/ds/tests/tb5/impl/component.xml
@@ -0,0 +1,12 @@
+<scr:component name="SecurityTestComponent"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb5.impl.SecurityTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb5.impl.SecurityTester"/>
+ </service>
+ <reference
+ name="LOG"
+ cardinality="1..1"
+ interface="org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"
+ />
+</scr:component> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..4b9daa7d4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB6
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb6/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/ReferencedComp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/ReferencedComp.java
new file mode 100644
index 000000000..9aa722d34
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/ReferencedComp.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb6;
+
+public class ReferencedComp {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/StaticComp.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/StaticComp.java
new file mode 100644
index 000000000..33c9ef323
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/StaticComp.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb6;
+
+import java.util.Dictionary;
+import java.util.Vector;
+
+import org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider;
+import org.eclipse.equinox.ds.tests.tbc.DSEvent;
+import org.eclipse.equinox.ds.tests.tbc.DSEventsProvider;
+import org.eclipse.equinox.ds.tests.tbc.BoundTester;
+import org.osgi.framework.ServiceReference;
+
+import org.osgi.service.component.ComponentContext;
+
+public class StaticComp implements DSEventsProvider, BoundTester, ComponentContextProvider {
+
+ private ComponentContext ctxt;
+ private Vector componentEvents = new Vector();
+ private ReferencedComp rc;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ componentEvents.addElement(new DSEvent(DSEvent.ACT_ACTIVATE, null));
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ componentEvents.addElement(new DSEvent(DSEvent.ACT_DEACTIVATE, null));
+ }
+
+ public void bind(ReferencedComp rc) {
+ this.rc = rc;
+ componentEvents.addElement(new DSEvent(DSEvent.ACT_BOUND, rc));
+ }
+
+ public void unbind(ReferencedComp rc) {
+ if (this.rc == rc) {
+ this.rc = null;
+ componentEvents.addElement(new DSEvent(DSEvent.ACT_UNBOUND, rc));
+ }
+ }
+
+ public DSEvent[] getEvents() {
+ DSEvent[] events = new DSEvent[componentEvents.size()];
+ componentEvents.copyInto(events);
+ return events;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.DSEventsProvider#resetComponentEvents()
+ */
+ public void resetEvents() {
+ componentEvents.removeAllElements();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.PropertiesProvider#getProperties()
+ */
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.BoundTester#getBoundObject(int)
+ */
+ public ServiceReference getBoundServiceRef(int index) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.BoundTester#getBoundObjectsCount()
+ */
+ public int getBoundObjectsCount() {
+ return (this.rc != null ? 1 : 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.BoundTester#getBoundService(int)
+ */
+ public Object getBoundService(int index) {
+ return this.rc;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider#getComponentContext()
+ */
+ public ComponentContext getComponentContext() {
+ return ctxt;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/components.xml
new file mode 100644
index 000000000..123472957
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb6/org/eclipse/equinox/ds/tests/tb6/components.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb6.ReferencedComp"
+ enabled="false"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb6.ReferencedComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb6.ReferencedComp"/>
+ </service>
+</scr:component>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb6.StaticComp"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb6.StaticComp"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb6.StaticComp"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb6.ReferencedComp"
+ target="(component.name=org.eclipse.equinox.ds.tests.tb6.ReferencedComp)"
+ cardinality="0..1"
+ policy="static"
+ bind="bind"
+ unbind="unbind"
+ />
+</scr:component>
+
+</root>
+
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..e6e9a2b24
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB7
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb7/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit1.java
new file mode 100644
index 000000000..077c3fee2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit1.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+public class DynamicCircuit1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit2.java
new file mode 100644
index 000000000..91feeed18
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/DynamicCircuit2.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundTester;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+
+public class DynamicCircuit2 implements BoundTester {
+
+ private ServiceReference mateRef;
+ private ComponentContext ctxt;
+
+ public void activate(ComponentContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ public void deactivate(ComponentContext ctxt) {
+ this.ctxt = null;
+ }
+
+ public int getBoundObjectsCount() {
+ return (mateRef != null ? 1 : 0);
+ }
+
+ public Object getBoundService(int index) {
+ return ctxt.locateService("referencedComponent", mateRef);
+ }
+
+ public ServiceReference getBoundServiceRef(int index) {
+ return mateRef;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ public void bind(ServiceReference mateRef) {
+ this.mateRef = mateRef;
+ }
+
+ public void unbind(ServiceReference mateRef) {
+ if (this.mateRef == mateRef) {
+ this.mateRef = null;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit1.java
new file mode 100644
index 000000000..fb11abedd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit1.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+public class StaticCircuit1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit2.java
new file mode 100644
index 000000000..0cfe2973e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/StaticCircuit2.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+import java.util.Dictionary;
+
+import org.eclipse.equinox.ds.tests.tbc.BoundTester;
+import org.osgi.framework.ServiceReference;
+
+public class StaticCircuit2 implements BoundTester {
+
+ private StaticCircuit1 mate;
+ public int getBoundObjectsCount() {
+ return (mate != null ? 1 : 0);
+ }
+
+ public Object getBoundService(int index) {
+ return mate;
+ }
+
+ public ServiceReference getBoundServiceRef(int index) {
+ return null;
+ }
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+ public void bind(StaticCircuit1 mate) {
+ this.mate = mate;
+ }
+
+ public void unbind(StaticCircuit1 mate) {
+ if (this.mate == mate) {
+ this.mate = null;
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit1.java
new file mode 100644
index 000000000..7dd79514b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit1.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+public class UnbreakableCircuit1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit2.java
new file mode 100644
index 000000000..3a41e5c48
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/UnbreakableCircuit2.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb7;
+
+public class UnbreakableCircuit2 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/components.xml
new file mode 100644
index 000000000..af6252fb8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb7/org/eclipse/equinox/ds/tests/tb7/components.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <!-- 1) unbreakable circularity - all components has mandatory references -->
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit1"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit1"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit1"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit2"
+ />
+ </scr:component>
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit2"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit2"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit1"
+ />
+ </scr:component>
+
+ <!-- 2) breakable circularity with dynamic policy -->
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit1"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit1"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit1"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit2"
+ />
+ </scr:component>
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit2"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit2"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.DynamicCircuit1"
+ cardinality="0..1"
+ policy="dynamic"
+ bind="bind"
+ unbind="unbind"
+ />
+ </scr:component>
+
+ <!-- 3) Breakable circularity with static policy -->
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.StaticCircuit1"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.StaticCircuit1"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.StaticCircuit1"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.StaticCircuit2"
+ />
+ </scr:component>
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb7.StaticCircuit2"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb7.StaticCircuit2"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb7.StaticCircuit2"/>
+ </service>
+ <reference
+ name="referencedComponent"
+ interface="org.eclipse.equinox.ds.tests.tb7.StaticCircuit1"
+ cardinality="0..1"
+ bind="bind"
+ unbind="unbind"
+ />
+ </scr:component>
+
+</root>
+
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..1d947a232
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB8
+Bundle-Category: test
+Import-Package: org.eclipse.equinox.ds.tests.tbc,
+ org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Service-Component: org/eclipse/equinox/ds/tests/tb8/root1.xml,
+ org/eclipse/equinox/ds/tests/tb8/root2.xml,
+ org/eclipse/equinox/ds/tests/tb8/root3.xml,
+ org/eclipse/equinox/ds/tests/tb8/root4.xml,
+ org/eclipse/equinox/ds/tests/tb8/root5.xml,
+ org/eclipse/equinox/ds/tests/tb8/components.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/NamespaceTester.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/NamespaceTester.java
new file mode 100644
index 000000000..9a785fde1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/NamespaceTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb8;
+
+import org.eclipse.equinox.ds.tests.tbc.NamespaceProvider;
+import org.osgi.service.component.ComponentContext;
+
+public class NamespaceTester implements NamespaceProvider {
+ private int nsid = -1;
+ private final static String NSID_PROP = "component.nsid";
+
+ protected void activate(ComponentContext ctxt) {
+ Object prop = ctxt.getProperties().get(NSID_PROP);
+ if (!(prop instanceof Integer)) {
+ return;
+ }
+ nsid = ((Integer)prop).intValue();
+ }
+
+ protected void deactivate(ComponentContext ctxt) {
+
+ }
+
+ public int getComponentNSID() {
+ return nsid;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/components.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/components.xml
new file mode 100644
index 000000000..e1ebd0c67
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/components.xml
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Any non root DS component should be in namespace "http://www.osgi.org/xmlns/scr/v1.0.0" -->
+
+<components>
+
+ <!-- This ds component description is not valid
+ (the component is in the default NS, but the default NS is not set) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot1"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="111"/>
+ </component>
+
+
+ <!-- This ds component description is valid
+ (the component is in the default NS and it is set properly) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot2"
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="112"/>
+ </component>
+
+
+ <!-- This ds component description is not valid
+ (the component is in the default NS, but the default NS is set wrongly) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot3"
+ xmlns="http://www.osgi.org/wrong"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="113"/>
+ </component>
+
+
+ <!-- This ds component description is valid
+ (the component is in the "scr" NS and it is set properly) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot4"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="114"/>
+ </scr:component>
+
+
+ <!-- This ds component description is not valid
+ (the component is in the "scr" NS, but it is set wrongly) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot5"
+ xmlns:scr="http://www.osgi.org/wrong"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="115"/>
+ </scr:component>
+
+
+
+ <componentsInner xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
+
+ <!-- This ds component description is valid
+ (the component is in the default NS and it is set properly in parent) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot6"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="116"/>
+ </component>
+
+
+ <!-- This ds component description is not valid
+ (the component is in the "scr" NS, but it is not set
+ (although the default NS is set properly in parent)) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot7"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="117"/>
+ </scr:component>
+
+ </componentsInner>
+
+
+
+ <componentsInner xmlns="http://www.osgi.org/wrong">
+
+ <!-- This ds component description is not valid
+ (the component is in the default NS, but the default NS
+ is set wrongly (in parent)) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot8"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="118"/>
+ </component>
+
+
+ <!-- This ds component description is not valid
+ (the component is in the "scr" NS, but it is not set
+ (not in the component nor the parent)) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot9"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="119"/>
+ </scr:component>
+
+ </componentsInner>
+
+
+
+ <componentsInner xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+
+ <!-- This ds component description is not valid
+ (the component is in the default NS, but the default NS is not set
+ (although the "scr" NS is set properly in parent)) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot10"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="120"/>
+ </component>
+
+
+ <!-- This ds component description is valid
+ (the component is in the "scr" NS and it is set properly in parent) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot11"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="121"/>
+ </scr:component>
+
+ </componentsInner>
+
+
+
+ <componentsInner xmlns:scr="http://www.osgi.org/wrong">
+
+ <!-- This ds component description is not valid
+ (the component is in the default NS, but the default NS is not set) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot12"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="122"/>
+ </component>
+
+
+ <!-- This ds component description is not valid
+ (the component is in the "scr" NS, but it is set wrongly (in parent)) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot13"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="123"/>
+ </scr:component>
+
+ </componentsInner>
+
+
+
+ <componentsInner xmlns="http://www.osgi.org/wrong">
+
+ <!-- This ds component description is valid
+ (the component is in the default NS, and the properly defined
+ default NS in component overrides wrongly defined NS in parent) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot14"
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="124"/>
+ </component>
+
+
+ <!-- This ds component description is valid
+ (the component is in the "scr" NS, and it is set properly in component
+ (the default NS is set wrongly in parent, but we use "scr" NS)) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot15"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="125"/>
+ </scr:component>
+
+ </componentsInner>
+
+
+
+ <componentsInner xmlns:scr="http://www.osgi.org/wrong">
+
+ <!-- This ds component description is valid
+ (the component is in the default NS, and it is set properly in component
+ (the "scr" NS is set wrongly in parent, but we use default NS) -->
+
+ <component name="org.eclipse.equinox.ds.tests.tb8.nonroot16"
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="126"/>
+ </component>
+
+
+ <!-- This ds component description is valid
+ (the component is in the "scr" NS, and the properly defined
+ "scr" NS in component overrides wrongly defined NS in parent) -->
+
+ <scr:component name="org.eclipse.equinox.ds.tests.tb8.nonroot17"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="127"/>
+ </scr:component>
+
+ </componentsInner>
+
+</components>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root1.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root1.xml
new file mode 100644
index 000000000..70540bca3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root1.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This ds component description is valid -->
+
+<component name="org.eclipse.equinox.ds.tests.tb8.root1"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="101"/>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root2.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root2.xml
new file mode 100644
index 000000000..6ca9a78c9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root2.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This ds component description is valid -->
+
+<component name="org.eclipse.equinox.ds.tests.tb8.root2"
+ xmlns="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="102"/>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root3.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root3.xml
new file mode 100644
index 000000000..82531fdbe
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root3.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This ds component description is not valid -->
+
+<component name="org.eclipse.equinox.ds.tests.tb8.root3"
+ xmlns="http://www.osgi.org/wrong"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="103"/>
+</component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root4.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root4.xml
new file mode 100644
index 000000000..b069e41c7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root4.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This ds component description is valid -->
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb8.root4"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="104"/>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root5.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root5.xml
new file mode 100644
index 000000000..baa04a0fd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb8/org/eclipse/equinox/ds/tests/tb8/root5.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This ds component description is not valid -->
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb8.root5"
+ xmlns:scr="http://www.osgi.org/wrong"
+ immediate="true">
+ <implementation class="org.eclipse.equinox.ds.tests.tb8.NamespaceTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tbc.NamespaceProvider"/>
+ </service>
+ <property name="component.nsid" type="Integer" value="105"/>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..487503224
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-Name: Declaritive services test
+Bundle-Description: Declaritive services TB9
+Bundle-Category: test
+Import-Package: org.osgi.framework,
+ org.osgi.service.component;version="1.0.0"
+Export-Package: org.eclipse.equinox.ds.tests.tb9
+Service-Component: org/eclipse/equinox/ds/tests/tb9/*.xml
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard1.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard1.java
new file mode 100644
index 000000000..8784a6ed3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard1.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb9;
+
+public interface Wildcard1 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard2.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard2.java
new file mode 100644
index 000000000..557a78082
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/Wildcard2.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb9;
+
+public interface Wildcard2 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/WildcardTester.java b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/WildcardTester.java
new file mode 100644
index 000000000..e1fba231f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/WildcardTester.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tb9;
+
+public class WildcardTester implements Wildcard1, Wildcard2 {
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp1.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp1.xml
new file mode 100644
index 000000000..c868beb9e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp1.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb9.WildcardComponent1"
+ immediate="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb9.WildcardTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb9.Wildcard1"/>
+ </service>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp2.xml b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp2.xml
new file mode 100644
index 000000000..bf48aa0a0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/bundles_src/tb9/org/eclipse/equinox/ds/tests/tb9/comp2.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<scr:component name="org.eclipse.equinox.ds.tests.tb9.WildcardComponent2"
+ immediate="true"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <implementation class="org.eclipse.equinox.ds.tests.tb9.WildcardTester"/>
+ <service>
+ <provide interface="org.eclipse.equinox.ds.tests.tb9.Wildcard2"/>
+ </service>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/AllTests.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/AllTests.java
new file mode 100644
index 000000000..7e83befb2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/AllTests.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests;
+
+import org.eclipse.equinox.ds.tests.tbc.DSTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Declarative Services Tests");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(DSTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/BundleInstaller.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/BundleInstaller.java
new file mode 100644
index 000000000..c155361a0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/BundleInstaller.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.osgi.service.urlconversion.URLConverter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class BundleInstaller {
+ private BundleContext context;
+ private String rootLocation;
+ private HashMap bundles = new HashMap();
+ private ServiceTracker converter;
+
+ public BundleInstaller(String bundlesRoot, BundleContext context) throws InvalidSyntaxException {
+ this.context = context;
+ rootLocation = bundlesRoot;
+ converter = new ServiceTracker(context, context.createFilter("(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"), null);
+ converter.open();
+ }
+
+ synchronized public Bundle installBundle(String name) throws BundleException {
+ return installBundle(name, true);
+ }
+
+ synchronized public Bundle installBundle(String name, boolean track) throws BundleException {
+ if (bundles == null && track)
+ return null;
+ String location = getBundleLocation(name);
+ Bundle bundle = context.installBundle(location);
+ if (track)
+ bundles.put(name, bundle);
+ return bundle;
+ }
+
+ public String getBundleLocation(String name) throws BundleException {
+ String bundleFileName = rootLocation + "/" + name;
+ URL bundleURL = context.getBundle().getEntry(bundleFileName);
+ if (bundleURL == null)
+ bundleURL = context.getBundle().getEntry(bundleFileName + ".jar");
+ if (bundleURL == null)
+ throw new BundleException("Could not find bundle to install at: " + name);
+ try {
+ bundleURL = ((URLConverter) converter.getService()).resolve(bundleURL);
+ } catch (IOException e) {
+ throw new BundleException("Converter error", e);
+ }
+ String location = bundleURL.toExternalForm();
+ if ("file".equals(bundleURL.getProtocol()))
+ location = "reference:" + location;
+ return location;
+ }
+
+ synchronized public Bundle updateBundle(String fromName, String toName) throws BundleException {
+ if (bundles == null)
+ return null;
+ Bundle fromBundle = (Bundle) bundles.get(fromName);
+ if (fromBundle == null)
+ throw new BundleException("The bundle to update does not exist!! " + fromName);
+ String bundleFileName = rootLocation + "/" + toName;
+ URL bundleURL = context.getBundle().getEntry(bundleFileName);
+ if (bundleURL == null)
+ bundleURL = context.getBundle().getEntry(bundleFileName + ".jar");
+ try {
+ bundleURL = ((URLConverter) converter.getService()).resolve(bundleURL);
+ } catch (IOException e) {
+ throw new BundleException("Converter error", e);
+ }
+ String location = bundleURL.toExternalForm();
+ if ("file".equals(bundleURL.getProtocol()))
+ location = "reference:" + location;
+ try {
+ fromBundle.update(new URL(location).openStream());
+ } catch (Exception e) {
+ throw new BundleException("Errors when updating bundle " + fromBundle, e);
+ }
+ bundles.remove(fromName);
+ bundles.put(toName, fromBundle);
+ return fromBundle;
+ }
+
+ synchronized public Bundle uninstallBundle(String name) throws BundleException {
+ if (bundles == null)
+ return null;
+ Bundle bundle = (Bundle) bundles.remove(name);
+ if (bundle == null)
+ return null;
+ bundle.uninstall();
+ return bundle;
+ }
+
+ synchronized public void uninstallBundle(Bundle b) throws BundleException {
+ if (bundles == null)
+ return;
+ if (bundles.containsValue(b)) {
+ for (Iterator it = bundles.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ if (entry.getValue().equals(b)) {
+ bundles.remove(entry.getKey());
+ break;
+ }
+ }
+ }
+ b.uninstall();
+ }
+
+ synchronized public Bundle[] uninstallAllBundles() throws BundleException {
+ if (bundles == null)
+ return null;
+ ArrayList result = new ArrayList(bundles.size());
+ for (Iterator iter = bundles.values().iterator(); iter.hasNext();) {
+ Bundle bundle = (Bundle) iter.next();
+ try {
+ bundle.uninstall();
+ } catch (IllegalStateException e) {
+ // ignore; bundle probably already uninstalled
+ }
+ result.add(bundle);
+ }
+ bundles.clear();
+ return (Bundle[]) result.toArray(new Bundle[result.size()]);
+ }
+
+ synchronized public Bundle getBundle(String name) {
+ if (bundles == null)
+ return null;
+ return (Bundle) bundles.get(name);
+ }
+
+ synchronized public Bundle[] shutdown() throws BundleException {
+ if (bundles == null)
+ return null;
+ Bundle[] result = uninstallAllBundles();
+ converter.close();
+ bundles = null;
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/DSTestsActivator.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/DSTestsActivator.java
new file mode 100644
index 000000000..23714adbc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/DSTestsActivator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class DSTestsActivator implements BundleActivator {
+
+ private static DSTestsActivator instance;
+ private BundleContext context;
+
+ public DSTestsActivator() {
+ instance = this;
+ }
+ public void start(BundleContext context) throws Exception {
+ this.context = context;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ this.context = null;
+ }
+
+ public static BundleContext getContext() {
+ return instance != null ? instance.context : null;
+ }
+
+ public static void activateSCR() {
+ activateBundle("org.eclipse.equinox.ds");
+ activateBundle("org.eclipse.equinox.cm");
+ activateBundle("org.eclipse.equinox.log");
+ activateBundle("org.eclipse.equinox.util");
+ }
+
+ private static void activateBundle(String symbolicName) {
+ if (instance != null) {
+ Bundle[] bundles = instance.context.getBundles();
+ for (int i = 0; i < bundles.length; i++) {
+ if (symbolicName.equals(bundles[i].getSymbolicName())) {
+ if (bundles[i].getState() != Bundle.ACTIVE)
+ try {
+ bundles[i].start(Bundle.START_TRANSIENT);
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundCountProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundCountProvider.java
new file mode 100644
index 000000000..cc634ff08
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundCountProvider.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public interface BoundCountProvider extends PropertiesProvider {
+
+ public int getBoundServiceCount(String service);
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundMainProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundMainProvider.java
new file mode 100644
index 000000000..8e62ce98b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundMainProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public interface BoundMainProvider extends PropertiesProvider {
+
+ public static final String DYNAMIC_SERVICE = "DynamicWorker";
+ public static final String NAMED_SERVICE = "NamedService";
+ public static final String STATIC_SERVICE = "StaticWorker";
+ public Object getBoundService(String serviceName);
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundTester.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundTester.java
new file mode 100644
index 000000000..7498163a9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BoundTester.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import org.osgi.framework.ServiceReference;
+
+public interface BoundTester extends PropertiesProvider {
+
+ public int getBoundObjectsCount();
+ public ServiceReference getBoundServiceRef(int index);
+ public Object getBoundService(int index);
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BundleContextProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BundleContextProvider.java
new file mode 100644
index 000000000..9aa7ff091
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/BundleContextProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import org.osgi.framework.BundleContext;
+
+public interface BundleContextProvider extends PropertiesProvider {
+
+ public BundleContext getBundleContext();
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentContextProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentContextProvider.java
new file mode 100644
index 000000000..9d0534cea
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentContextProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import org.osgi.service.component.ComponentContext;
+
+public interface ComponentContextProvider extends PropertiesProvider {
+
+ public ComponentContext getComponentContext();
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentManager.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentManager.java
new file mode 100644
index 000000000..8d69dc607
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/ComponentManager.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public interface ComponentManager extends PropertiesProvider {
+
+ public void enableComponent(String name, boolean flag);
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEvent.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEvent.java
new file mode 100644
index 000000000..5ea191379
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEvent.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public class DSEvent implements Comparable {
+
+ public static final int ACT_BOUND = 1;
+ public static final int ACT_UNBOUND = 2;
+ public static final int ACT_ACTIVATE = 3;
+ public static final int ACT_DEACTIVATE = 4;
+
+ private static long lastTime = System.currentTimeMillis();
+ private static final Object lock = new Object();
+
+ private long time;
+ private int action;
+ private Object object;
+
+ public DSEvent(int action, Object object) {
+ synchronized (lock) { // to prevent from creating BoundServiceEvents in one and the same millisecond
+ this.action = action;
+ this.object = object;
+ while(lastTime == System.currentTimeMillis());
+ this.time = lastTime = System.currentTimeMillis();
+ }
+ }
+
+ public int getAction() {
+ return action;
+ }
+
+ public Object getObject() {
+ return object;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ /**
+ * Returns whether this event is before the passed one
+ * @param event
+ * @return
+ */
+ public boolean before(DSEvent event) {
+ if (event.time > this.time) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object var0) {
+ DSEvent event = (DSEvent) var0;
+ if (event.time > this.time) {
+ return -1;
+ } else if (event.time < this.time) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ protected String getActionAsString() {
+ switch(getAction()) {
+ case ACT_BOUND: return "ACT_BOUND";
+ case ACT_UNBOUND: return "ACT_UNBOUND";
+ case ACT_ACTIVATE: return "ACT_ACTIVATE";
+ case ACT_DEACTIVATE: return "ACT_DEACTIVATE";
+ default: return "UNKNOWN (" + getAction() + ")";
+ }
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer("DSEvent[");
+ buf.append("time=" + this.time + ";action=");
+ buf.append(getActionAsString());
+ buf.append(";object=" + (this.object != null ? this.object.toString() : "null"));
+ buf.append("]");
+ return buf.toString();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEventsProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEventsProvider.java
new file mode 100644
index 000000000..b9c86a3d7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSEventsProvider.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public interface DSEventsProvider extends PropertiesProvider {
+ public DSEvent[] getEvents();
+ public void resetEvents();
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSTest.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSTest.java
new file mode 100644
index 000000000..b85d43af6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DSTest.java
@@ -0,0 +1,2143 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.eclipse.equinox.ds.tests.BundleInstaller;
+import org.eclipse.equinox.ds.tests.DSTestsActivator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.PackagePermission;
+import org.osgi.framework.ServicePermission;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.ComponentFactory;
+import org.osgi.service.component.ComponentInstance;
+import org.osgi.service.permissionadmin.PermissionAdmin;
+import org.osgi.service.permissionadmin.PermissionInfo;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class DSTest extends TestCase {
+
+ private static final String NAMED_CLASS = "org.eclipse.equinox.ds.tests.tb4.NamedService";
+
+ private static final String EXTENDED_CLASS = "org.eclipse.equinox.ds.tests.tb1.BindUnbindSuccessor";
+
+ private static final String SAC_CLASS = "org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent";
+
+ private static final String SC_CLASS = "org.eclipse.equinox.ds.tests.tb1.impl.BaseComp";
+
+ private static final String DYN_SERVICE_CLASS = "org.eclipse.equinox.ds.tests.tb4.DynamicService";
+
+ private static final String BSRC_CLASS = "org.eclipse.equinox.ds.tests.tb4.BoundReplacer";
+
+ private static final String MBSRC_CLASS = "org.eclipse.equinox.ds.tests.tb4.AdvancedBounder";
+
+ private static final String SECURITY_CLASS = "org.eclipse.equinox.ds.tests.tb5.impl.SecurityTester";
+
+ private static final String BLOCK_ACTIVE_CLASS = "org.eclipse.equinox.ds.tests.tb2.impl.Blocker";
+
+ private static final String BLOCK_BIND_CLASS = "org.eclipse.equinox.ds.tests.tb3.impl.BindBlocker";
+
+ private static final String STATIC_CLASS = "org.eclipse.equinox.ds.tests.tb6.StaticComp";
+
+ private static final String REFERENCED_CLASS = "org.eclipse.equinox.ds.tests.tb6.ReferencedComp";
+
+ private static final String NS_CLASS = "org.eclipse.equinox.ds.tests.tbc.NamespaceProvider";
+
+ private static final String COMP_OPTIONAL_100 = "org.eclipse.equinox.ds.tests.tb11.optionalNS100";
+
+ private static final String COMP_OPTIONAL_110 = "org.eclipse.equinox.ds.tests.tb11.optionalNS110";
+
+ private static final String COMP_REQUIRE_100 = "org.eclipse.equinox.ds.tests.tb11.requireNS100";
+
+ private static final String COMP_REQUIRE_110 = "org.eclipse.equinox.ds.tests.tb11.requireNS110";
+
+ private static final String COMP_IGNORE_100 = "org.eclipse.equinox.ds.tests.tb11.ignoreNS100";
+
+ private static final String COMP_IGNORE_110 = "org.eclipse.equinox.ds.tests.tb11.ignoreNS110";
+
+ private static final String COMP_NOTSET_100 = "org.eclipse.equinox.ds.tests.tb11.notsetNS100";
+
+ private static final String COMP_NOTSET_110 = "org.eclipse.equinox.ds.tests.tb11.notsetNS110";
+
+ private static int timeout = 1000;
+
+ private Bundle tb1;
+
+ private ServiceTracker trackerNamedService;
+
+ private ServiceTracker trackerNamedServiceFactory;
+
+ private ServiceTracker trackerCM;
+
+ private ServiceTracker trackerExtendedClass;
+
+ private ServiceTracker trackerSAC;
+
+ private ServiceTracker trackerSC;
+
+ private ServiceTracker trackerDynService;
+
+ private ServiceTracker trackerDynServiceFactory;
+
+ private ServiceTracker trackerBSRC;
+
+ private ServiceTracker trackerMBSRC;
+
+ private ServiceTracker trackerSecurity;
+
+ private ServiceTracker trackerBAS;
+
+ private ServiceTracker trackerBBS;
+
+ private ServiceTracker trackerStatic;
+
+ private ServiceTracker trackerReferenced;
+
+ private ServiceTracker trackerNS;
+
+ private ServiceTracker trackerBoundServiceCounterFactory;
+
+ private ServiceTracker trackerBoundServiceCounterHelperFactory;
+
+ private ServiceTracker trackerStaticServiceCounterFactory;
+
+ private ServiceTracker trackerBaseService;
+
+ private Hashtable registeredServices = new Hashtable();
+
+ private int scr_restart_timeout = 33000;
+
+ private boolean synchronousBuild = false;
+
+ private BundleInstaller installer;
+
+ public void setUp() throws Exception {
+ DSTestsActivator.activateSCR();
+
+ timeout = getSystemProperty("scr.test.timeout", timeout);
+ scr_restart_timeout = getSystemProperty("scr.restart.timeout", scr_restart_timeout);
+
+ String synchronousBuildProp = System.getProperty("equinox.ds.synchronous_build");
+ synchronousBuild = (synchronousBuildProp == null) || !synchronousBuildProp.equalsIgnoreCase("false");
+
+ clearConfigurations();
+ // init trackers
+ BundleContext bc = getContext();
+
+ installer = new BundleInstaller("/scr_test/", bc);
+
+ // install test bundles
+ tb1 = installBundle("tb1");
+
+ // start them
+ tb1.start();
+ waitBundleStart();
+
+ trackerNamedService = new ServiceTracker(bc, NAMED_CLASS, null);
+ Filter filter = bc
+ .createFilter("(&(" + ComponentConstants.COMPONENT_FACTORY + '='
+ + NAMED_CLASS + ")(" + Constants.OBJECTCLASS + '='
+ + ComponentFactory.class.getName() + "))");
+ trackerNamedServiceFactory = new ServiceTracker(bc, filter, null);
+ trackerCM = new ServiceTracker(bc, ConfigurationAdmin.class.getName(), null);
+ trackerExtendedClass = new ServiceTracker(bc, EXTENDED_CLASS, null);
+ trackerSAC = new ServiceTracker(bc, SAC_CLASS, null);
+ trackerSC = new ServiceTracker(bc, SC_CLASS, null);
+ trackerDynService = new ServiceTracker(bc, DYN_SERVICE_CLASS, null);
+ filter = bc.createFilter("(&(" + ComponentConstants.COMPONENT_FACTORY + '='
+ + DYN_SERVICE_CLASS + ")(" + Constants.OBJECTCLASS + '='
+ + ComponentFactory.class.getName() + "))");
+ trackerDynServiceFactory = new ServiceTracker(bc, filter, null);
+ trackerBSRC = new ServiceTracker(bc, BSRC_CLASS, null);
+ trackerMBSRC = new ServiceTracker(bc, MBSRC_CLASS, null);
+ trackerSecurity = new ServiceTracker(bc, SECURITY_CLASS, null);
+ trackerBAS = new ServiceTracker(bc, BLOCK_ACTIVE_CLASS, null);
+ trackerBBS = new ServiceTracker(bc, BLOCK_BIND_CLASS, null);
+ trackerStatic = new ServiceTracker(bc, STATIC_CLASS, null);
+ trackerReferenced = new ServiceTracker(bc, REFERENCED_CLASS, null);
+ trackerNS = new ServiceTracker(bc, NS_CLASS, null);
+ filter = bc.createFilter("(&(" + ComponentConstants.COMPONENT_FACTORY + '='
+ + "CountFactory" + ")(" + Constants.OBJECTCLASS + '=' + ComponentFactory.class.getName() + "))");
+ trackerBoundServiceCounterFactory = new ServiceTracker(bc, filter, null);
+ filter = bc.createFilter("(&(" + ComponentConstants.COMPONENT_FACTORY + '='
+ + "CountHelperFactory" + ")(" + Constants.OBJECTCLASS + '=' + ComponentFactory.class.getName() + "))");
+ trackerBoundServiceCounterHelperFactory = new ServiceTracker(bc, filter, null);
+ filter = bc.createFilter("(&(" + ComponentConstants.COMPONENT_FACTORY + '='
+ + "StaticServiceCountFactory" + ")(" + Constants.OBJECTCLASS + '=' + ComponentFactory.class.getName() + "))");
+ trackerStaticServiceCounterFactory = new ServiceTracker(bc, filter, null);
+ trackerBaseService = new ServiceTracker(bc, PropertiesProvider.class.getName(), null);
+
+ // start listening
+ trackerNamedService.open();
+ trackerNamedServiceFactory.open();
+ trackerCM.open();
+ trackerExtendedClass.open();
+ trackerSAC.open();
+ trackerSC.open();
+ trackerDynService.open();
+ trackerDynServiceFactory.open();
+ trackerBSRC.open();
+ trackerMBSRC.open();
+ trackerSecurity.open();
+ trackerBAS.open();
+ trackerBBS.open();
+ trackerStatic.open();
+ trackerReferenced.open();
+ trackerNS.open();
+ trackerBoundServiceCounterFactory.open();
+ trackerBoundServiceCounterHelperFactory.open();
+ trackerStaticServiceCounterFactory.open();
+ trackerBaseService.open();
+ }
+
+ /**
+ * This methods takes care of the configurations related to this test
+ * @throws IOException
+ * @throws InvalidSyntaxException
+ * @throws InterruptedException
+ */
+ private void clearConfigurations() throws IOException, InvalidSyntaxException {
+ ServiceReference cmSR = getContext().getServiceReference(
+ ConfigurationAdmin.class.getName());
+ if (cmSR == null)
+ return;
+ ConfigurationAdmin cm = (ConfigurationAdmin) getContext().getService(cmSR);
+ // clean configurations from previous tests
+ // clean factory configs for named service
+ clearConfiguration(cm, "(service.factoryPid=" + NAMED_CLASS + ")");
+ // clean configs for named service
+ clearConfiguration(cm, "(service.pid=" + NAMED_CLASS + ")");
+ // clean configs for stand alone component
+ clearConfiguration(cm, "(service.pid=" + SAC_CLASS + ")");
+ // clean configs for optionalNS100
+ clearConfiguration(cm, "(service.pid=" + COMP_OPTIONAL_100 + ")");
+ // clean configs for optionalNS110
+ clearConfiguration(cm, "(service.pid=" + COMP_OPTIONAL_110 + ")");
+ // clean configs for requireNS100
+ clearConfiguration(cm, "(service.pid=" + COMP_REQUIRE_100 + ")");
+ // clean configs for requireNS110
+ clearConfiguration(cm, "(service.pid=" + COMP_REQUIRE_110 + ")");
+ // clean configs for ignoreNS100
+ clearConfiguration(cm, "(service.pid=" + COMP_IGNORE_100 + ")");
+ // clean configs for ignoreNS110
+ clearConfiguration(cm, "(service.pid=" + COMP_IGNORE_110 + ")");
+ // clean configs for notsetNS100
+ clearConfiguration(cm, "(service.pid=" + COMP_NOTSET_100 + ")");
+ // clean configs for notsetNS110
+ clearConfiguration(cm, "(service.pid=" + COMP_NOTSET_110 + ")");
+
+ getContext().ungetService(cmSR);
+ try {
+ Thread.sleep(timeout * 2);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ private void clearConfiguration(ConfigurationAdmin cm, String filter) throws IOException, InvalidSyntaxException {
+ Configuration[] configs = cm.listConfigurations(filter);
+ for (int i = 0; configs != null && i < configs.length; i++) {
+ Configuration configuration = configs[i];
+ configuration.delete();
+ }
+ }
+
+ /**
+ * @param propertyKey
+ */
+ private int getSystemProperty(String propertyKey, int defaultValue) {
+ String propertyString = System.getProperty(propertyKey);
+ int sleepTime = defaultValue;
+ if (propertyString != null) {
+ try {
+ sleepTime = Integer.parseInt(propertyString);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out
+ .println("Error while parsing sleep value! The default one will be used : "
+ + defaultValue);
+ }
+ if (sleepTime < 100) {
+ log("The sleep value is too low : " + sleepTime
+ + " ! The default one will be used : " + defaultValue);
+ return defaultValue;
+ }
+ return sleepTime;
+ }
+ return defaultValue;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.ds.tests.tbc.DSTest.#tearDown()
+ */
+ public void tearDown() throws Exception {
+ unregisterAllServices();
+
+ trackerNamedService.close();
+ trackerNamedServiceFactory.close();
+ trackerExtendedClass.close();
+ trackerSAC.close();
+ trackerSC.close();
+ trackerDynService.close();
+ trackerDynServiceFactory.close();
+ trackerBSRC.close();
+ trackerMBSRC.close();
+ trackerSecurity.close();
+ trackerBAS.close();
+ trackerBBS.close();
+ trackerStatic.close();
+ trackerReferenced.close();
+ trackerNS.close();
+ trackerBoundServiceCounterFactory.close();
+ trackerBoundServiceCounterHelperFactory.close();
+ trackerBaseService.close();
+
+ if (installer != null) {
+ BundleInstaller bi = installer;
+ installer = null;
+ bi.shutdown();
+ }
+
+ clearConfigurations();
+ }
+
+ public void testBindUnbind() throws Exception {
+
+ assertEquals("TestBundle1 must be running.", Bundle.ACTIVE, tb1.getState());
+
+ Object s = trackerExtendedClass.getService();
+ assertNotNull("The BindUnbindSuccessor component should be available", s);
+
+ assertTrue(
+ "The bind method on BindUnbindSuccessor component should be called to save the service reference",
+ ((BoundTester) s).getBoundObjectsCount() > 0);
+
+ // disable the referenced component to trigger unbind event
+ ComponentManager enabler = (ComponentManager) s;
+ enabler.enableComponent(SAC_CLASS, false);
+ Thread.sleep(timeout);
+
+ assertNull("The SAC component should be disabled (unavailable)", trackerSAC
+ .getServiceReference());
+
+ assertTrue(
+ "The unbind method on BindUnbindSuccessor component should be called to reset the service reference",
+ ((BoundTester) s).getBoundObjectsCount() < 1);
+
+ // enable the referenced component
+ enabler = (ComponentManager) trackerExtendedClass.getService();
+ enabler.enableComponent(SAC_CLASS, true);
+ Thread.sleep(timeout);
+ assertNotNull("The SAC component should be available", trackerSAC
+ .getServiceReference());
+ }
+
+ public void testUniqueComponentContext() throws Exception {
+ Bundle bundle = installBundle("tb4");
+ bundle.start();
+ waitBundleStart();
+
+ Hashtable props;
+ ComponentFactory factory = (ComponentFactory) trackerNamedServiceFactory
+ .getService();
+ assertNotNull("The NamedService component factory should be available", factory);
+
+ // create the first service
+ props = new Hashtable();
+ props.put("name", "hello");
+
+ ComponentInstance ci1 = factory.newInstance(props);
+ ComponentInstance ci2 = factory.newInstance(props);
+
+ ComponentContextProvider cce1 = (ComponentContextProvider) ci1.getInstance();
+ ComponentContextProvider cce2 = (ComponentContextProvider) ci2.getInstance();
+
+ assertNotSame("The two instances created must be different", cce1, cce2);
+
+ ComponentContext cc1 = cce1.getComponentContext();
+ ComponentContext cc2 = cce2.getComponentContext();
+
+ assertNotSame("The two component contexts must be not the same", cc1, cc2);
+
+ uninstallBundle(bundle);
+ }
+
+ public void testComponentContextMethods() throws Exception {
+
+ Object extendedClass = trackerExtendedClass.getService();
+ // check that the BindUnbindSuccessor component is available
+ assertNotNull("BindUnbindSuccessor component should be available", extendedClass);
+
+ ComponentContext ctxt = ((ComponentContextProvider) extendedClass).getComponentContext();
+ assertNotNull(
+ "The BindUnbindSuccessor component should be activated properly",
+ ctxt);
+
+ assertNotNull("The AnotherComponent should be available before we disable it",
+ trackerSAC.getServiceReferences());
+ assertTrue("The AnotherComponent should be available before we disable it",
+ trackerSAC.getServiceReferences().length > 0);
+ assertNotNull("The Worker should be available before we disable it",
+ trackerSC.getServiceReferences());
+ assertTrue("The Worker should be available before we disable it",
+ trackerSC.getServiceReferences().length > 0);
+
+ // *** test disableComponent() method
+ ((ComponentManager)extendedClass).enableComponent("InvalidParameter", true); // test for disabling unexistent
+
+ ((ComponentManager)extendedClass).enableComponent(SAC_CLASS, false);
+ Thread.sleep(timeout * 2); // let the SCR to unregister the service
+ assertNull(
+ "The service must not be available after we had disabled the component (AnotherComponent)",
+ trackerSAC.getServiceReferences());
+
+ ((ComponentManager)extendedClass).enableComponent(SC_CLASS, false);
+ Thread.sleep(timeout * 2); // let the SCR to unregister the service
+ assertNull(
+ "The service must not be available after we had disabled the component (Worker)",
+ trackerSC.getServiceReferences());
+
+ //*** test enableComponent() method
+ ((ComponentManager)extendedClass).enableComponent(SAC_CLASS, true);
+ Thread.sleep(timeout * 2); // let the SCR to register the service
+ assertNotNull(
+ "The service must be available after we had enabled the component",
+ trackerSAC.getServiceReferences());
+ assertTrue(
+ "The service must be available after we had enabled the component",
+ trackerSAC.getServiceReferences().length > 0);
+
+ ((ComponentManager)extendedClass).enableComponent(null, true);
+ Thread.sleep(timeout * 2);
+ assertNotNull(
+ "The enableComponent() with passed null parameter, must enable the remaining disabled components",
+ trackerSC.getServiceReferences());
+ assertTrue(
+ "The enableComponent() with passed null parameter, must enable the remaining disabled components",
+ trackerSC.getServiceReferences().length > 0);
+
+ //*** test getBundleContext()
+ BundleContextProvider sacBCE = (BundleContextProvider) trackerSAC
+ .getService();
+ assertNotNull("AnotherComponent should be available", sacBCE);
+ assertSame(
+ "The two bundle context (this from the activator and from the ComponentContext object must be the same",
+ sacBCE.getBundleContext(),
+ ((ComponentContextProvider)extendedClass).getComponentContext().getBundleContext()
+ );
+
+ //*** test getComponentInstance()
+ Bundle bundle = installBundle("tb4");
+ assertNotNull("Installing tb4.jar should succeed", bundle);
+ bundle.start();
+ waitBundleStart();
+
+ Hashtable props;
+ ComponentFactory factory = (ComponentFactory) trackerNamedServiceFactory
+ .getService();
+ assertNotNull("NamedService component factory should be available", factory);
+
+ props = new Hashtable();
+ props.put("name", "hello");
+
+ ComponentInstance ci = factory.newInstance(props);
+ assertNotNull("newInstance() should not return null", ci);
+ ComponentContextProvider cce = (ComponentContextProvider) ci.getInstance();
+ assertNotNull("getInstance() should not return null if we haven't disposed the component", cce);
+ assertNotNull("the component instance should be initialized correctly", cce.getComponentContext());
+ ComponentInstance ctxtInstance = cce.getComponentContext().getComponentInstance();
+ assertSame("The ComponentInstance object retrieved from the factory and from the ComponentContext must be the same",
+ ci, ctxtInstance);
+ // dispose the instance
+ ci.dispose();
+ assertNull("getInstance() should return null when disposed", ci.getInstance());
+
+ //*** test getUsingBundle()
+ ComponentContextProvider simpleComponentCCE = (ComponentContextProvider) trackerSC.getService();
+ assertNotNull("Worker should be available", simpleComponentCCE);
+ assertNotNull("Worker's context should be not null", simpleComponentCCE.getComponentContext());
+ assertNotNull("At least this bundle (TBC) must be using the Worker service", simpleComponentCCE.getComponentContext().getUsingBundle());
+
+ //*** test getProperties()
+ Dictionary p = simpleComponentCCE.getComponentContext().getProperties();
+ assertNotNull("Worker properties must be not null", p);
+ assertEquals("The properties must contain the custom property defined in the component description",
+ p.get("custom"), "customvalue");
+ assertEquals("The properties must contain the component.name property",
+ p.get(ComponentConstants.COMPONENT_NAME), SC_CLASS);
+ assertNotNull("The properties must contain the component.id property",
+ p.get(ComponentConstants.COMPONENT_ID));
+ assertEquals("The component.id property must be of type java.lang.Long",
+ p.get(ComponentConstants.COMPONENT_ID).getClass().getName(),
+ Long.class.getName());
+
+ //*** test getServiceReference()
+ ServiceReference ctxtServiceReference = ctxt.getServiceReference();
+ ServiceReference bcServiceReference = trackerExtendedClass.getServiceReference();
+ assertEquals("The two ServiceReference should be equal",ctxtServiceReference, bcServiceReference);
+
+ //*** test locateService(String)
+ Object locateSac = ctxt.locateService("StandAloneComp");
+ assertNotNull("The locateService() method should return non-null object",
+ locateSac);
+ assertEquals("The object must implement " + SAC_CLASS, locateSac.getClass().getName(), SAC_CLASS);
+
+ // test illegal call
+ assertNull("Trying to get invalid reference should return null", ctxt.locateService("InvalidReference"));
+
+ ((ComponentManager)extendedClass).enableComponent(SAC_CLASS, false); // disable component to test that the locateService() don't return disabled components
+ Thread.sleep(timeout);
+
+ assertEquals("Check that the component is correctly disabled", 0, countAvailableServices(trackerSAC));
+
+ locateSac = ctxt.locateService("StandAloneComp");
+ assertNull("The reference shouldn't be available with optional cardinality and disabled component",
+ locateSac);
+
+ ((ComponentManager)extendedClass).enableComponent(SAC_CLASS, true);
+ Thread.sleep(timeout * 2);
+ assertTrue("Check that the component is correctly enabled", countAvailableServices(trackerSAC) > 0);
+
+ //*** test locateServices(String)
+ Object[] boundObjects = ctxt.locateServices("StandAloneComp");
+ int boundCount = ((BoundTester)extendedClass).getBoundObjectsCount();
+ assertNotNull("The returned array of bound services should not be null", boundObjects);
+ assertEquals(
+ "The returned array of bound services should have the length equal to the internal count",
+ boundCount, boundObjects.length);
+ for (int i = 0; i < boundObjects.length; i++) {
+ assertNotNull(
+ "There shouldn't be null element in the bound objects array (" + i
+ + ")", boundObjects[i]);
+ }
+
+ assertNull("The locateServices() method should return null on invalid reference name",
+ ctxt.locateServices("InvalidReference"));
+
+ //*** test locateService(String, ServiceReference)
+ assertTrue("There must be at least one bound element",
+ ((BoundTester) extendedClass).getBoundObjectsCount() > 0);
+
+ ServiceReference sr1 = ((BoundTester) extendedClass).getBoundServiceRef(0);
+ assertNotNull("The ServiceReference bound to the BindUnbindSuccessor components should not be null",
+ sr1);
+ Object fromSR1 = ctxt.getBundleContext().getService(sr1);
+ Object fromCtxt = ctxt.locateService("StandAloneComp", sr1);
+ try {
+ assertNotNull("The service object from BundleContext must not be null",
+ fromSR1);
+ assertNotNull("The service object from locateService() must not be null",
+ fromCtxt);
+ assertSame(
+ "The two objects retrieved from BundleContext and from locateService(String, ServiceReference) method must be the same",
+ fromSR1, fromCtxt);
+ } finally {
+ ctxt.getBundleContext().ungetService(sr1);
+ }
+
+ assertNull(
+ "locateService() must return null when passed ServiceReference is null",
+ ctxt.locateService("StandAloneComp", null));
+
+ assertNull(
+ "locateService() must return null when passed ServiceReference isn't bound to the component",
+ ctxt.locateService("StandAloneComp", trackerExtendedClass.getServiceReference()));
+
+ assertNull(
+ "locateService() must return null when the referenceName isn't correct even if the service reference is correct",
+ ctxt.locateService("InvalidReference", sr1));
+
+ uninstallBundle(bundle);
+ }
+
+ public void testPropertiesHandling() throws Exception {
+ ConfigurationAdmin cm = (ConfigurationAdmin) trackerCM.getService();
+ ServiceReference ref;
+
+ // update the properties
+ Hashtable props = new Hashtable(10);
+ props.put("test.property.value", "setFromCM");
+ props.put("test.property.list", "setFromCM");
+ props.put("component.name", "setFromCM");
+ props.put("component.id", new Long(-1));
+ // the line below will create the configuration if it doesn't exists!
+ // see CM api for details
+ assertNotNull("The ConfigurationAdmin should be available", cm);
+ Configuration config = cm.getConfiguration(SAC_CLASS);
+ assertNotNull("The Configuration object should be created if don't exist",
+ config);
+ config.update(props);
+
+ // let SCR & CM to complete it's job
+ Thread.sleep(timeout * 3);
+
+ ref = trackerSAC.getServiceReference();
+ // check the correctness of the properties
+ assertNotNull("The AnotherComponent's reference should be available",
+ ref);
+ assertEquals("Properties not overriden from later ones should not be lost",
+ "setFromFile", ref.getProperty("test.property.array"));
+ assertEquals(
+ "Properties set through the CM should take precedence before those set from file",
+ "setFromCM", ref.getProperty("test.property.value"));
+ assertEquals(
+ "Properties overriden from later ones in definition should take precedence",
+ "setFromDefinition", ref.getProperty("test.property.name"));
+ assertEquals(
+ "Properties set through the CM should take precedence before those set from definition",
+ "setFromCM", ref.getProperty("test.property.list"));
+ assertEquals("Properties not overriden from later ones should not be lost",
+ "setFromDefinition", ref.getProperty("test.property.cont"));
+ assertEquals("Must not allow overriding the component.name property",
+ SAC_CLASS, ref.getProperty("component.name"));
+ assertNotNull("component.id property should be present", ref.getProperty(ComponentConstants.COMPONENT_ID));
+ assertTrue("Must not allow overriding the component.id property",
+ ((Long) ref.getProperty("component.id")).longValue() > 0);
+
+ Bundle bundle = installBundle("tb4");
+ bundle.start();
+ waitBundleStart();
+
+ Configuration c = cm.getConfiguration(NAMED_CLASS);
+ assertNotNull("The Configuration should be created properly", c);
+ Hashtable cmProps = new Hashtable();
+ cmProps.put("override.property.3", "setFromCM");
+ c.update(cmProps);
+
+ // let the config update reach the SCR
+ Thread.sleep(timeout * 3);
+
+ ComponentFactory factory = (ComponentFactory) trackerNamedServiceFactory
+ .getService();
+ assertNotNull("The NamedService ComponentFactory should be available",
+ factory);
+
+ Hashtable newProps = new Hashtable();
+ newProps.put("override.property.1", "setFromMethod");
+ newProps.put("override.property.2", "setFromMethod");
+ newProps.put("override.property.3", "setFromMethod");
+ newProps.put(ComponentConstants.COMPONENT_NAME, "setFromMethod");
+ newProps.put(ComponentConstants.COMPONENT_ID, new Long(-1));
+ newProps.put("name", "test");
+
+ ComponentInstance ci = factory.newInstance(newProps);
+ assertNotNull("newInstance() method shouldn't return null", ci);
+
+ ServiceReference[] refs = trackerNamedService.getServiceReferences();
+ boolean serviceFound = false;
+ for (int i = 0; refs != null && i < refs.length; i++) {
+ ServiceReference current = refs[i];
+ if ("test".equals(current.getProperty("name"))) {
+ serviceFound = true;
+ assertEquals(
+ "Properties set through newInstance method must override those from definition",
+ "setFromMethod", current.getProperty("override.property.1"));
+ assertEquals(
+ "Properties set through newInstance method must override those from file",
+ "setFromMethod", current.getProperty("override.property.2"));
+ assertEquals(
+ "Properties set through newInstance method must override those from ConfigurationAdmin",
+ "setFromMethod", current.getProperty("override.property.3"));
+ assertEquals("Must not override " + ComponentConstants.COMPONENT_NAME,
+ current.getProperty(ComponentConstants.COMPONENT_NAME), NAMED_CLASS);
+ assertTrue("Must not override " + ComponentConstants.COMPONENT_ID,
+ ((Long) current.getProperty(ComponentConstants.COMPONENT_ID))
+ .longValue() > 0);
+ }
+ }
+ assertTrue("Must have found service", serviceFound);
+
+ ci.dispose();
+ c.delete();
+ bundle.stop();
+
+ // test the conflict between factory and factoryPID
+ c = cm.createFactoryConfiguration(NAMED_CLASS);
+ assertNotNull(
+ "CM should not return null Configuration from createFactoryConfiguration()",
+ c);
+ c.update(cmProps);
+ Thread.sleep(timeout);
+
+ bundle.start();
+ waitBundleStart();
+
+ assertNull(
+ "The named service shouldn't be available when there is factory configuration for it",
+ trackerNamedServiceFactory.getService());
+
+ c.delete();
+ Thread.sleep(timeout * 3);
+
+ // create factory configs for Worker
+ Configuration scConfig1 = cm.createFactoryConfiguration(SC_CLASS);
+ Hashtable scProps1 = new Hashtable();
+ scProps1.put("name", "instance1");
+ scConfig1.update(scProps1);
+
+ Configuration scConfig2 = cm.createFactoryConfiguration(SC_CLASS);
+ Hashtable scProps2 = new Hashtable();
+ scProps2.put("name", "instance2");
+ scConfig2.update(scProps2);
+
+ Thread.sleep(timeout * 3);
+
+ try {// test factory configuration for normal component
+ assertEquals("The Worker should have two instances", 2, countAvailableServices(trackerSC));
+ } finally {
+ scConfig1.delete();
+ scConfig2.delete();
+ }
+ Thread.sleep(timeout * 3);
+
+ assertEquals("The Worker should have one instance", 1, countAvailableServices(trackerSC));
+ ServiceReference scRef = trackerSC.getServiceReference();
+ assertNull("The Worker only instance shouldn't have \"name\" property", scRef.getProperty("name"));
+
+ uninstallBundle(bundle);
+ }
+
+ public void testBoundServiceReplacement() throws Exception {
+ int beforeCount, afterCount;
+ Hashtable mandatoryProperty = new Hashtable();
+ mandatoryProperty.put("mandatory.property", "true");
+
+ Bundle tb4 = installBundle("tb4");
+ tb4.start();
+ waitBundleStart();
+ assertEquals("tb4.jar should be ACTIVE", Bundle.ACTIVE, tb4.getState());
+
+ ComponentFactory namedFactory = (ComponentFactory) trackerNamedServiceFactory
+ .getService();
+ assertNotNull("NamedService component factory should be available",
+ namedFactory);
+ ComponentFactory dynFactory = (ComponentFactory) trackerDynServiceFactory
+ .getService();
+ assertNotNull("DynamicWorker component factory should be available",
+ dynFactory);
+
+ // create the mandatory elements
+ ComponentInstance namedServiceInstance = namedFactory
+ .newInstance((Dictionary) mandatoryProperty.clone());
+ assertNotNull("NamedService component instance should not be null",
+ namedServiceInstance);
+ Object namedService = namedServiceInstance.getInstance();
+ assertNotNull("NamedService should be created properly", namedService);
+ ComponentInstance dynServiceInstance = dynFactory
+ .newInstance((Dictionary) mandatoryProperty.clone());
+ assertNotNull("DynamicWorker component instance should not be null",
+ dynServiceInstance);
+ Object dynService = dynServiceInstance.getInstance();
+ assertNotNull("DynamicWorker should be created properly", dynService);
+ Thread.sleep(timeout * 2);
+
+ Object bsrc = trackerBSRC.getService();
+ assertNotNull("BoundReplacer should be available",
+ bsrc);
+ assertSame("NamedService bound should be our first instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.NAMED_SERVICE), namedService);
+ assertSame("DynamicWorker bound should be our first instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.DYNAMIC_SERVICE), dynService);
+
+ // provide second dynamic service
+ ComponentInstance dynServiceInstance2 = dynFactory
+ .newInstance((Dictionary) mandatoryProperty.clone());
+ assertNotNull(
+ "Second DynamicWorker component instance should not be null",
+ dynServiceInstance2);
+ Object dynService2 = dynServiceInstance2.getInstance();
+ assertNotNull("Second DynamicWorker instance should be available",
+ dynService2);
+
+ // reset the events
+ ((DSEventsProvider) bsrc).resetEvents();
+ // destroy the first instance of dynamic service
+ dynServiceInstance.dispose();
+
+ // check that service is replaced
+ assertNotSame(
+ "The bound dynamic service shouldn't be our first instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.DYNAMIC_SERVICE), dynService);
+ assertSame("The bound dynamic service should be our second instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.DYNAMIC_SERVICE),
+ dynService2);
+
+ // check the correct order of replacing
+ DSEvent[] replacedBoundDynamicServicesEvents = ((DSEventsProvider) bsrc)
+ .getEvents();
+ assertEquals(
+ "There should two events after we have disposed the bound service",
+ 2, replacedBoundDynamicServicesEvents.length);
+ assertEquals("The first event should be bind event",
+ DSEvent.ACT_BOUND, replacedBoundDynamicServicesEvents[0]
+ .getAction());
+ assertSame(
+ "The first event should have associated object the second instance",
+ dynService2, replacedBoundDynamicServicesEvents[0].getObject());
+
+ assertEquals("The second event should be unbind event",
+ DSEvent.ACT_UNBOUND, replacedBoundDynamicServicesEvents[1]
+ .getAction());
+ assertSame(
+ "The second event should have associated object the first instance",
+ dynService, replacedBoundDynamicServicesEvents[1].getObject());
+
+ // destroy and the second service
+ dynServiceInstance2.dispose();
+
+ // check that the inspected service is deactivated
+ assertNull(
+ "The BoundReplacer should not be available as the destroyed service hasn't replacement",
+ trackerBSRC.getService());
+
+ // restore the BSRC
+ assertNotNull(
+ "The DynamicWorker component instance should be created properly",
+ dynFactory.newInstance((Dictionary) mandatoryProperty.clone()));
+ Thread.sleep(timeout);
+
+ Object bsrcObject = trackerBSRC.getService();
+ assertNotNull(
+ "The BoundReplacer should be available again",
+ bsrcObject);
+ ComponentContext bsrcCtxt1 = ((ComponentContextProvider) bsrcObject)
+ .getComponentContext();
+ assertNotNull(
+ "The BoundReplacer should be activated and ComponentContext available",
+ bsrcCtxt1);
+
+ // prepare second static service instance
+ ComponentInstance namedServiceInstance2 = namedFactory
+ .newInstance((Dictionary) mandatoryProperty.clone());
+ assertNotNull("Second NamedService instance should be created properly",
+ namedServiceInstance2);
+ Object namedService2 = namedServiceInstance2.getInstance();
+ assertNotNull("Second NamedService instance should be created properly",
+ namedService2);
+
+ // destroy the first instance
+ beforeCount = countAvailableServices(trackerNamedService);
+ namedServiceInstance.dispose();
+ afterCount = countAvailableServices(trackerNamedService);
+ assertEquals(
+ "The NamedService instance should be removed from the registry",
+ beforeCount - 1, afterCount);
+
+ // check that the BSRC has been reactivated
+ Object bsrcObject2 = trackerBSRC.getService(); // the BSRC object can be
+ // recreated
+ assertNotNull("The BoundReplacer should not be null",
+ bsrcObject2);
+ ComponentContext bsrcCtxt2 = ((ComponentContextProvider) bsrcObject2)
+ .getComponentContext();
+ assertNotNull("The second ComponentContext should not be null", bsrcCtxt2);
+ assertNotSame(
+ "The second ComponentContext should be different than the first one",
+ bsrcCtxt1, bsrcCtxt2);
+
+ // destroy the second instance
+ namedServiceInstance2.dispose();
+
+ assertNull("The BSRC should be disabled", trackerBSRC.getService());
+
+ uninstallBundle(tb4);
+ }
+
+ /**
+ * Returns the number of available services for the passed tracker
+ *
+ * @param tracker
+ * @return
+ */
+ private int countAvailableServices(ServiceTracker tracker) {
+ if (tracker == null)
+ return -1;
+ ServiceReference[] refs = tracker.getServiceReferences();
+ return refs != null ? refs.length : 0;
+ }
+
+ public void testBoundServiceReplacementOnModification() throws Exception {
+ BundleContext bc = getContext();
+ Hashtable initialProps = new Hashtable();
+ Hashtable modifiedProps = new Hashtable();
+ initialProps.put("mandatory.property", "true");
+ modifiedProps.put("mandatory.property", "false");
+
+ ServiceRegistration dynRegistration1 = registerService(DynamicWorker.class.getName(), new DynamicWorker(), (Dictionary) initialProps.clone());
+
+ ServiceRegistration staticRegistration1 = registerService(
+ StaticWorker.class.getName(), new StaticWorker(),
+ (Dictionary) initialProps.clone());
+
+ Bundle tb4 = installBundle("tb4");
+ tb4.start();
+ waitBundleStart();
+ assertEquals("tb4.jar should be ACTIVE", Bundle.ACTIVE, tb4.getState());
+
+ // assure the MBSRC is available
+ assertTrue("The AdvancedBounder must be available",
+ countAvailableServices(trackerMBSRC) > 0);
+ Object bsrc = trackerMBSRC.getService();
+ assertNotNull("MBSRC isntance should be not null", bsrc);
+
+ // register the second instances
+ ServiceRegistration dynRegistration2 = registerService(
+ DynamicWorker.class.getName(), new DynamicWorker(),
+ (Dictionary) initialProps.clone());
+
+ // reset the bound services events
+ ((DSEventsProvider) bsrc).resetEvents();
+ // change the first instance of dynamic service
+ dynRegistration1.setProperties(modifiedProps);
+ Thread.sleep(timeout);
+
+ Object instance1 = bc.getService(dynRegistration1.getReference());
+ Object instance2 = bc.getService(dynRegistration2.getReference());
+ try {
+
+ // check that service is replaced
+ assertNotSame("The bound dynamic service shouldn't be our first instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.DYNAMIC_SERVICE), instance1);
+ assertSame("The bound dynamic service should be our second instance",
+ ((BoundMainProvider) bsrc)
+ .getBoundService(BoundMainProvider.DYNAMIC_SERVICE), instance2);
+
+ // check the correct order of replacing
+ DSEvent[] replacedBoundDynamicServicesEvents = ((DSEventsProvider) bsrc)
+ .getEvents();
+ assertEquals(
+ "There should two events after we have disposed the bound service", 2,
+ replacedBoundDynamicServicesEvents.length);
+
+ assertEquals("The first event should be bind event",
+ DSEvent.ACT_BOUND, replacedBoundDynamicServicesEvents[0]
+ .getAction());
+ assertSame(
+ "The first event should have associated object the second instance",
+ instance2, replacedBoundDynamicServicesEvents[0].getObject());
+
+ assertEquals("The second event should be unbind event",
+ DSEvent.ACT_UNBOUND, replacedBoundDynamicServicesEvents[1]
+ .getAction());
+ assertSame(
+ "The second event should have associated object the first instance",
+ instance1, replacedBoundDynamicServicesEvents[1].getObject());
+
+ } finally {
+ bc.ungetService(dynRegistration1.getReference());
+ bc.ungetService(dynRegistration2.getReference());
+ }
+ instance1 = instance2 = null;
+
+ ComponentContext bsrcCtxt1 = ((ComponentContextProvider) bsrc)
+ .getComponentContext();
+ assertNotNull("ComponentContext object should be available", bsrcCtxt1);
+
+ ServiceRegistration staticRegistration2 = registerService(
+ StaticWorker.class.getName(), new StaticWorker(),
+ (Dictionary) initialProps.clone());
+ // change the first instance
+ staticRegistration1.setProperties((Dictionary) modifiedProps.clone());
+ Thread.sleep(timeout);
+
+ Object bsrcObject2 = trackerMBSRC.getService(); // the BSRC object can be
+ // recreated
+ assertNotNull("The BoundReplacer should not be null",
+ bsrcObject2);
+ ComponentContext bsrcCtxt2 = ((ComponentContextProvider) bsrcObject2)
+ .getComponentContext();
+ assertNotNull("The second ComponentContext should not be null", bsrcCtxt2);
+ assertNotSame(
+ "The second ComponentContext should be different than the first one",
+ bsrcCtxt1, bsrcCtxt2);
+
+ uninstallBundle(tb4);
+
+ unregisterService(dynRegistration1);
+ unregisterService(dynRegistration2);
+ unregisterService(staticRegistration1);
+ unregisterService(staticRegistration2);
+ }
+
+ public void testSecurity() throws Exception {
+ // the method below sets the permissions of a bundle before installing it
+ // to simplify the test case
+ if (System.getSecurityManager() == null) {
+ // the security is off
+ return;
+ }
+ BundleContext bc = getContext();
+ ServiceReference padmRef = bc.getServiceReference(PermissionAdmin.class
+ .getName());
+ assertNotNull("Permission Admin service not available.", padmRef);
+
+ PermissionAdmin padm = (PermissionAdmin) bc.getService(padmRef);
+ assertNotNull("Permission Admin service should be available", padm);
+
+ assertEquals("TestBundle1 must be running.", Bundle.ACTIVE, tb1.getState());
+
+ PermissionInfo registerServiceInfo = new PermissionInfo(
+ ServicePermission.class.getName(),
+ "org.eclipse.equinox.ds.tests.tb5.impl.SecurityTester",
+ ServicePermission.REGISTER);
+ PermissionInfo getServiceInfo = new PermissionInfo(ServicePermission.class
+ .getName(), "org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent", ServicePermission.GET);
+
+ PermissionInfo importPackage = new PermissionInfo(
+ PackagePermission.class.getName(), "org.eclipse.equinox.ds.tests.tb1.impl",
+ PackagePermission.IMPORT);
+
+ // install the bundle to get the location
+ Bundle tb5 = installBundle("tb5");
+ tb5.start();
+ waitBundleStart();
+ final String bundleLocation = tb5.getLocation();
+
+ uninstallBundle(tb5);
+
+ // do the test
+
+ // set all permission needed for correct operation
+ padm.setPermissions(bundleLocation, new PermissionInfo[] {
+ registerServiceInfo, getServiceInfo, importPackage });
+
+ // install
+ tb5 = installBundle("tb5");
+ tb5.start();
+ waitBundleStart();
+ assertEquals(
+ "The bundle location should be the same as the first one registered",
+ bundleLocation, tb5.getLocation());
+
+ // check that the component is available
+ assertTrue(
+ "The SecurityTester should be present because all needed permissions are set",
+ countAvailableServices(trackerSecurity) > 0);
+
+ // uninstall
+ uninstallBundle(tb5);
+
+ // remove the register permission - the service shouldn't be available
+ padm.setPermissions(bundleLocation, new PermissionInfo[] {
+ importPackage, getServiceInfo });
+
+ // install
+ tb5 = installBundle("tb5");
+ tb5.start();
+ waitBundleStart();
+ assertEquals(
+ "The bundle location should be the same as the first one registered",
+ bundleLocation, tb5.getLocation());
+
+ // check that the service is unavailable
+ assertEquals(
+ "The SecurityTester shouldn't be present due to missing ServicePermission.REGISTER",
+ 0, countAvailableServices(trackerSecurity));
+
+ // uninstall
+ uninstallBundle(tb5);
+
+ // remove the get permission and bring back the register permission
+ padm.setPermissions(bundleLocation, new PermissionInfo[] {
+ importPackage, registerServiceInfo });
+
+ // install
+ tb5 = installBundle("tb5");
+ tb5.start();
+ waitBundleStart();
+ assertEquals(
+ "The bundle location should be the same as the first one registered",
+ bundleLocation, tb5.getLocation());
+
+ // check that the component is unavailable
+ assertEquals(
+ "The SecurityTester shouldn't be present due to missing ServicePermission.GET",
+ 0, countAvailableServices(trackerSecurity));
+
+ // uninstall
+ uninstallBundle(tb5);
+
+ // reset the permissions
+ padm.setPermissions(bundleLocation, null);
+ // release the PermissionAdmin service
+ bc.ungetService(padmRef);
+ padm = null;
+ }
+
+ public void testImmediateComponents() throws Exception {
+ Bundle tb4 = installBundle("tb4");
+ tb4.start();
+ waitBundleStart();
+
+ // check that the ServiceProvider is registered
+ assertNotNull("The ServiceProvider should be registered as service",
+ getContext().getServiceReference(
+ "org.eclipse.equinox.ds.tests.tb4.ServiceProvider"));
+ // check that the ServiceProvider is activated
+ assertTrue("The ServiceProvider should be activated", TestHelper
+ .isActivatedServiceProvider());
+
+ // check that the Stand Alone Component is activated
+ assertTrue("The AnotherComponent should be activated",
+ TestHelper.isActivatedStandAlone());
+
+ uninstallBundle(tb4);
+ }
+
+ public void testRowReference() throws Exception {
+ final String TAIL_CLASS = "org.eclipse.equinox.ds.tests.tb4.Component3";
+ final String MIDDLE_CLASS = "org.eclipse.equinox.ds.tests.tb4.Component2";
+ final String HEAD_CLASS = "org.eclipse.equinox.ds.tests.tb4.Component1";
+
+ Bundle tb4 = installBundle("tb4");
+ tb4.start();
+ waitBundleStart();
+
+ // check that all the components are present
+ assertTrue("The Component3 should be available",
+ checkAvailability(TAIL_CLASS));
+ assertTrue("The Component2 should be available",
+ checkAvailability(MIDDLE_CLASS));
+ assertTrue("The Component1 should be available",
+ checkAvailability(HEAD_CLASS));
+
+ BundleContext bc = getContext();
+ // get ComponentContext
+ ServiceReference cceRef = bc
+ .getServiceReference("org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider");
+ assertNotNull("The GiveMeContext should be available", cceRef);
+ assertEquals(
+ "The GiveMeContext should be the implementation present in tb4.jar",
+ "org.eclipse.equinox.ds.tests.tb4.GiveMeContext", cceRef
+ .getProperty("component.name"));
+
+ ComponentContextProvider cce = (ComponentContextProvider) bc
+ .getService(cceRef);
+ assertNotNull("The service object should be retrieved correctly", cce);
+ ComponentContext ctxt = cce.getComponentContext();
+ assertNotNull("The ComponentContext object should not be null", ctxt);
+
+ // disable the tail component
+ ctxt.disableComponent(TAIL_CLASS);
+ Thread.sleep(timeout);
+
+ // check that no component is available
+ assertTrue("The Component3 shouldn't be available",
+ !checkAvailability(TAIL_CLASS));
+ assertTrue("The Component2 shouldn't be available",
+ !checkAvailability(MIDDLE_CLASS));
+ assertTrue("The Component1 shouldn't be available",
+ !checkAvailability(HEAD_CLASS));
+
+ // enable the tail component
+ ctxt.enableComponent(TAIL_CLASS);
+ Thread.sleep(timeout);
+
+ // check that the components are back online
+ assertTrue("The Component3 should be available",
+ checkAvailability(TAIL_CLASS));
+ assertTrue("The Component2 should be available",
+ checkAvailability(MIDDLE_CLASS));
+ assertTrue("The Component1 should be available",
+ checkAvailability(HEAD_CLASS));
+
+ // release the GiveMeContext
+ bc.ungetService(cceRef);
+
+ // remove the bundle
+ uninstallBundle(tb4);
+ }
+
+ private boolean checkAvailability(String service) {
+ BundleContext bc = getContext();
+ ServiceReference ref = bc.getServiceReference(service);
+ return ref != null;
+ }
+
+ private boolean checkFactoryAvailability(String factory) throws InvalidSyntaxException {
+ BundleContext bc = getContext();
+ ServiceReference[] refs = bc.getServiceReferences(ComponentFactory.class.getName(), "(" + ComponentConstants.COMPONENT_FACTORY + "=" + factory + ")");
+ return refs != null && refs.length > 0;
+ }
+
+ public void testBlockingComponents() throws Exception {
+ final Bundle tb2 = installBundle("tb2");
+ final Bundle tb3 = installBundle("tb3");
+ final Bundle tb4 = installBundle("tb4");
+
+ new Thread() {
+ public void run() {
+ try {
+ tb2.start(); // start the blocking service
+ } catch (BundleException e) { }
+ }
+ }.start();
+ sleep0(scr_restart_timeout + timeout * 2);
+
+ new Thread() {
+ public void run() {
+ try {
+ tb4.start(); // start the other
+ } catch (BundleException e) { }
+ }
+ }.start();
+
+ sleep0(timeout * 3); // sleep until the services are activated
+
+ // check that the first service is missing, and the second is available
+ assertEquals("The blocking service should not be available", 0, countAvailableServices(trackerBAS));
+ assertTrue("The service in the bundle should be available", checkAvailability("org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"));
+
+ tb2.stop();
+ tb4.stop();
+
+ // check that AnotherComponent is available
+ assertTrue("The AnotherComponent should be available", checkAvailability("org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"));
+
+ // start the other blocking bundle
+ new Thread() {
+ public void run() {
+ try {
+ tb3.start();
+ } catch (BundleException e) { }
+ }
+ }.start();
+
+ sleep0(scr_restart_timeout + timeout * 2);
+
+ // start the non-blocking bundle
+ new Thread() {
+ public void run() {
+ try {
+ tb4.start(); // start the other
+ } catch (BundleException e) { }
+ }
+ }.start();
+
+ sleep0(timeout * 3); // sleep until the services are activated
+
+ assertEquals("The blocking service should not be available", 0, countAvailableServices(trackerBBS));
+ assertTrue("The service in the bundle should be available", checkAvailability("org.eclipse.equinox.ds.tests.tbc.ComponentContextProvider"));
+
+ uninstallBundle(tb2);
+ uninstallBundle(tb3);
+ uninstallBundle(tb4);
+ }
+
+ public void testStaticPolicyBinding() throws Exception {
+ Bundle tb6 = installBundle("tb6");
+ tb6.start();
+ waitBundleStart();
+
+ // check initial conditions
+ assertTrue("The StaticComp should be available", checkAvailability(STATIC_CLASS));
+ assertTrue("The ReferencedComp shouldn't be available (disabled)", !checkAvailability(REFERENCED_CLASS));
+
+ // reset the events list
+ Object initialStatic = trackerStatic.getService();
+ assertNotNull(STATIC_CLASS + " component should be non-null", initialStatic);
+ ComponentContext initialCtxt = ((ComponentContextProvider)initialStatic).getComponentContext();
+ ((DSEventsProvider)initialStatic).resetEvents();
+ assertEquals("There shouldn't be bound service to StaticComp", 0, ((BoundTester)initialStatic).getBoundObjectsCount());
+
+
+ // enable the ReferencedComp
+ initialCtxt.enableComponent(REFERENCED_CLASS);
+ Thread.sleep(timeout * 2);
+
+ // check the availability after enablement
+ assertTrue("The StaticComp should be available", checkAvailability(STATIC_CLASS));
+ assertTrue("The ReferencedComp should be available", checkAvailability(REFERENCED_CLASS));
+
+ // check that the SCR created new instance
+ Object enabledStatic = trackerStatic.getService();
+ assertNotNull(STATIC_CLASS + " component should be non-null", enabledStatic);
+ ComponentContext enabledCtxt = ((ComponentContextProvider)enabledStatic).getComponentContext();
+ assertNotSame("The StaticComp must have been restarted", initialCtxt, enabledCtxt);
+ assertEquals("There should be one bound service to StaticComp", 1, ((BoundTester)enabledStatic).getBoundObjectsCount());
+
+ // check the events
+ DSEvent[] initialEvents = ((DSEventsProvider)initialStatic).getEvents();
+ assertEquals("The events in the first instance of StaticComp should only one", 1, initialEvents.length);
+ assertEquals("The event should deactivate one", DSEvent.ACT_DEACTIVATE, initialEvents[0].getAction());
+
+ DSEvent[] enabledEvents = ((DSEventsProvider)enabledStatic).getEvents();
+ assertEquals("The events for the second instance of StaticComp should be two", 2, enabledEvents.length);
+ assertEquals("The first event should bind event", DSEvent.ACT_BOUND, enabledEvents[0].getAction());
+ assertEquals("The second event should be activate event", DSEvent.ACT_ACTIVATE, enabledEvents[1].getAction());
+
+ // reset the events
+ ((DSEventsProvider)enabledStatic).resetEvents();
+
+ // disable the component
+ enabledCtxt.disableComponent(REFERENCED_CLASS);
+ Thread.sleep(timeout * 2);
+
+ // check the availability
+ assertTrue("The StaticComp should be available", checkAvailability(STATIC_CLASS));
+ assertTrue("The ReferencedComp shouldn't be available", !checkAvailability(REFERENCED_CLASS));
+
+ // check that the SCR created new instance
+ Object disabledStatic = trackerStatic.getService();
+ assertNotNull(STATIC_CLASS + " component should be non-null", disabledStatic);
+ ComponentContext disabledCtxt = ((ComponentContextProvider)disabledStatic).getComponentContext();
+ assertNotSame("The StaticComp must have been restarted", enabledCtxt, disabledCtxt);
+ assertEquals("There should be one bound service to StaticComp", 0, ((BoundTester)disabledStatic).getBoundObjectsCount());
+
+ enabledEvents = ((DSEventsProvider)enabledStatic).getEvents();
+ DSEvent[] disabledEvents = ((DSEventsProvider)disabledStatic).getEvents();
+
+ assertEquals("The second instance of StaticComp should have two events after disabling ReferencedComp", 2, enabledEvents.length);
+ assertEquals("The first event should be deactivate", DSEvent.ACT_DEACTIVATE, enabledEvents[0].getAction());
+ assertEquals("The second event should be unbind", DSEvent.ACT_UNBOUND, enabledEvents[1].getAction());
+
+ assertEquals("There should only one event for the second instance of StaticComp", 1, disabledEvents.length);
+ assertEquals("The event should be activate", DSEvent.ACT_ACTIVATE, disabledEvents[0].getAction());
+
+ uninstallBundle(tb6);
+ }
+
+ public void testCircularityHandling() throws Exception {
+ Bundle tb7 = installBundle("tb7");
+ tb7.start();
+ waitBundleStart();
+
+ final String UNBREAKABLE = "org.eclipse.equinox.ds.tests.tb7.UnbreakableCircuit";
+ final String DYN_BREAKABLE = "org.eclipse.equinox.ds.tests.tb7.DynamicCircuit";
+ final String STATIC_BREAKABLE = "org.eclipse.equinox.ds.tests.tb7.StaticCircuit";
+
+ // check that the unbreakable circuit isn't available
+ assertTrue("The first service from the unbreakable circularity shouldn't be available", !checkAvailability(UNBREAKABLE + "1"));
+ assertTrue("The second service from the unbreakable circularity shouldn't be available", !checkAvailability(UNBREAKABLE + "2"));
+
+ // check that the breakable circuit with dynamic optional reference is available
+ assertTrue("The first service from the breakable circularity with dynamic optional reference should be available", checkAvailability(DYN_BREAKABLE + "1"));
+ assertTrue("The second service from the breakable circularity with dynamic optional reference should be available", checkAvailability(DYN_BREAKABLE + "2"));
+
+ // check that the breakable circuit with dynamic optional reference has bound correctly
+ ServiceReference dynBreak2Ref = getContext().getServiceReference(DYN_BREAKABLE + "2");
+ Object dynBreak2 = getContext().getService(dynBreak2Ref);
+ try {
+ assertEquals("The DynamicCircuit2 component should have one bound object", 1, ((BoundTester)dynBreak2).getBoundObjectsCount());
+ assertNotNull("The DynamicCircuit2 component should have one non-null bound object", ((BoundTester)dynBreak2).getBoundService(0));
+ } finally {
+ getContext().ungetService(dynBreak2Ref);
+ }
+ // check that the breakable circuit with static optional reference isn't available
+ assertTrue("The first service from the breakable circularity with static optional reference should be available", checkAvailability(STATIC_BREAKABLE + "1"));
+ assertTrue("The second service from the breakable circularity with static optional reference should be available", checkAvailability(STATIC_BREAKABLE + "2"));
+
+ // check that the optional reference isn't satisfied
+ ServiceReference staticBreak2Ref = getContext().getServiceReference(STATIC_BREAKABLE + "2");
+ Object staticBreak2 = getContext().getService(staticBreak2Ref);
+ try {
+ assertEquals("The StaticCircuit2 component shouldn't have bound objects", 0, ((BoundTester)staticBreak2).getBoundObjectsCount());
+ } finally {
+ getContext().ungetService(staticBreak2Ref);
+ }
+
+ // check that the worker hasn't been blocked
+ Bundle tb5 = installBundle("tb5");
+ tb5.start();
+ waitBundleStart();
+
+ // check that the AnotherComponent service is available
+ assertTrue("The AnotherComponent should be available", checkAvailability("org.eclipse.equinox.ds.tests.tb1.impl.AnotherComponent"));
+ assertTrue("The service in TB5 should be available which means that the working thread of the SCR isn't blocked", checkAvailability("org.eclipse.equinox.ds.tests.tb5.impl.SecurityTester"));
+
+ uninstallBundle(tb5);
+ uninstallBundle(tb7);
+ }
+
+ // tests namespace handling in xml component description parser
+ public void testNamespaceHandling() throws Exception {
+ Bundle tb8 = installBundle("tb8");
+ tb8.start();
+ waitBundleStart();
+
+ // check the root component handling
+ assertTrue("The root1 component should be available", isNSComponentAvailable(101));
+ assertTrue("The root2 component should be available", isNSComponentAvailable(102));
+ assertTrue("The root3 component should not be available", !isNSComponentAvailable(103));
+ assertTrue("The root4 component should be available", isNSComponentAvailable(104));
+ assertTrue("The root5 component should not be available", !isNSComponentAvailable(105));
+ // check the non root component handling
+ assertTrue("The nonroot1 component should not be available", !isNSComponentAvailable(111));
+ assertTrue("The nonroot2 component should be available", isNSComponentAvailable(112));
+ assertTrue("The nonroot3 component should not be available", !isNSComponentAvailable(113));
+ assertTrue("The nonroot4 component should be available", isNSComponentAvailable(114));
+ assertTrue("The nonroot5 component should not be available", !isNSComponentAvailable(115));
+ assertTrue("The nonroot6 component should be available", isNSComponentAvailable(116));
+ assertTrue("The nonroot7 component should not be available", !isNSComponentAvailable(117));
+ assertTrue("The nonroot8 component should not be available", !isNSComponentAvailable(118));
+ assertTrue("The nonroot9 component should not be available", !isNSComponentAvailable(119));
+ assertTrue("The nonroot10 component should not be available", !isNSComponentAvailable(120));
+ assertTrue("The nonroot11 component should be available", isNSComponentAvailable(121));
+ assertTrue("The nonroot12 component should not be available", !isNSComponentAvailable(122));
+ assertTrue("The nonroot13 component should not be available", !isNSComponentAvailable(123));
+ assertTrue("The nonroot14 component should be available", isNSComponentAvailable(124));
+ assertTrue("The nonroot15 component should be available", isNSComponentAvailable(125));
+ assertTrue("The nonroot16 component should be available", isNSComponentAvailable(126));
+ assertTrue("The nonroot17 component should be available", isNSComponentAvailable(127));
+
+ uninstallBundle(tb8);
+ }
+
+ private boolean isNSComponentAvailable(int nsid) {
+ Object[] services = trackerNS.getServices();
+ if (services == null) {
+ return false;
+ }
+ for (int i = 0; i < services.length; i++) {
+ if (services[i] instanceof NamespaceProvider) {
+ NamespaceProvider s = (NamespaceProvider)services[i];
+ if (s.getComponentNSID() == nsid) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ // tests wildcard handling in mf (e.g. Service-Component: OSGI-INF/*.xml)
+ public void testWildcardHandling() throws Exception {
+ Bundle tb9 = installBundle("tb9");
+ tb9.start();
+ waitBundleStart();
+
+ final String WILD = "org.eclipse.equinox.ds.tests.tb9.Wildcard";
+
+ // check that the both components are available
+ assertTrue("The first Wildcard component should be available", checkAvailability(WILD + "1"));
+ assertTrue("The second Wildcard component should be available", checkAvailability(WILD + "2"));
+
+ uninstallBundle(tb9);
+ }
+
+ public void testDynamicComponentFactoryServiceBinding() throws Exception {
+ Bundle tb10 = installBundle("tb10");
+ assertNotNull("Failed to install test bundle tb10.jar", tb10);
+ tb10.start();
+ waitBundleStart();
+
+ // assert that the required components are available
+ assertTrue("The referenced simple component should be available", checkAvailability(SC_CLASS));
+ assertTrue("The referenced factory component should be available", checkFactoryAvailability("CountHelperFactory"));
+ assertTrue("The dependent dynamic factory component should be available", checkFactoryAvailability("CountFactory"));
+
+ // retrieve the helper factory
+ ComponentFactory helperFactory = (ComponentFactory) trackerBoundServiceCounterHelperFactory.getService();
+ assertNotNull("The helper factory must be retrievable", helperFactory);
+
+ // retrieve the observed factory
+ ComponentFactory observedFactory = (ComponentFactory) trackerBoundServiceCounterFactory.getService();
+ assertNotNull("The observed factory must be retrievable", observedFactory);
+
+ // instantiate observed components
+ ComponentInstance observedInstance1 = observedFactory.newInstance(null);
+ assertNotNull("Cannot instantiate component from observed factory [1]", observedInstance1);
+ ComponentInstance observedInstance2 = observedFactory.newInstance(null);
+ assertNotNull("Cannot instantiate component from observed factory [2]", observedInstance2);
+
+ BoundCountProvider observedComponent1 = (BoundCountProvider) observedInstance1.getInstance();
+ BoundCountProvider observedComponent2 = (BoundCountProvider) observedInstance2.getInstance();
+ assertNotNull("The observed component must be non-null [1]", observedComponent1);
+ assertNotNull("The observed component must be non-null [2]", observedComponent2);
+
+ // check the bound services before instantiating helper factory components - both components must have 1 service bound
+ assertEquals("The bound service count must be 1 - only the simple component is available [1]", 1, observedComponent1.getBoundServiceCount(null));
+ assertEquals("The bound service count must be 1 - only the simple component is available [2]", 1, observedComponent2.getBoundServiceCount(null));
+
+ // instantiate three helper components and check the service count again
+ for (int i = 0; i < 3; i++) {
+ helperFactory.newInstance(null); // don't keep track of the created instances, they will be disposed when the bundle is stopped and uninstalled
+ }
+
+ // check the bound services count again - both components must have 4 services bound -> 1 simple component and 3 helper factory
+ assertEquals("The bound service count must be 4 - 1 simple component, 3 helper factory components [1]", 4, observedComponent1.getBoundServiceCount(null));
+ assertEquals("The bound service count must be 4 - 1 simple component, 3 helper factory components [2]", 4, observedComponent2.getBoundServiceCount(null));
+
+ uninstallBundle(tb10);
+ }
+
+ public void testStaticComponentFactoryServiceBinding() throws Exception {
+ Bundle tb10 = installBundle("tb10");
+ assertNotNull("Failed to install test bundle tb10.jar", tb10);
+ tb10.start();
+ waitBundleStart();
+
+ // assert that the required components are available
+ assertTrue("The referenced simple component should be available", checkAvailability(SC_CLASS));
+ assertTrue("The referenced factory component should be available", checkFactoryAvailability("CountHelperFactory"));
+ assertTrue("The dependent static factory component should be available", checkFactoryAvailability("StaticServiceCountFactory"));
+
+ // retrieve the helper and observer factories
+ ComponentFactory helperFactory = (ComponentFactory) trackerBoundServiceCounterHelperFactory.getService();
+ ComponentFactory observedFactory = (ComponentFactory) trackerStaticServiceCounterFactory.getService();
+ assertNotNull("The helper factory must be retrievable", helperFactory);
+ assertNotNull("The observed factory must be retrievable", observedFactory);
+
+ // instantiate observed components
+ ComponentInstance observedInstance1 = observedFactory.newInstance(null);
+ ComponentInstance observedInstance2 = observedFactory.newInstance(null);
+ assertNotNull("Cannot instantiate component from observed factory [1]", observedInstance1);
+ assertNotNull("Cannot instantiate component from observed factory [2]", observedInstance2);
+
+ BoundCountProvider observedComponent1 = (BoundCountProvider) observedInstance1.getInstance();
+ BoundCountProvider observedComponent2 = (BoundCountProvider) observedInstance2.getInstance();
+ assertNotNull("The observed component must be non-null [1]", observedComponent1);
+ assertNotNull("The observed component must be non-null [2]", observedComponent2);
+
+ // check the bound services before instantiating helper factory components - both components must have 1 service bound
+ assertEquals("The bound service count must be 1 - only the simple component is available [1]", 1, observedComponent1.getBoundServiceCount(null));
+ assertEquals("The bound service count must be 1 - only the simple component is available [2]", 1, observedComponent2.getBoundServiceCount(null));
+
+ // instantiate three helper components and check the service count again
+ for (int i = 0; i < 3; i++) {
+ helperFactory.newInstance(null); // don't keep track of the created instances, they will be disposed when the bundle is stopped and uninstalled
+ }
+
+ // check whether the factory is the same, it shouldn't be disposed
+ assertSame(observedFactory, trackerStaticServiceCounterFactory.getService());
+ observedFactory = (ComponentFactory) trackerStaticServiceCounterFactory.getService();
+
+ // check that the components are reinstantiated
+ observedInstance1 = observedFactory.newInstance(null);
+ observedInstance2 = observedFactory.newInstance(null);
+ assertNotNull("Cannot instantiate new observed component instance [1]", observedInstance1);
+ assertNotNull("Cannot instantiate new observed component instance [2]", observedInstance2);
+
+ // get the new instances
+ observedComponent1 = (BoundCountProvider) observedInstance1.getInstance();
+ observedComponent2 = (BoundCountProvider) observedInstance2.getInstance();
+ assertNotNull("The observed component instance must be non-null [1]", observedComponent1);
+ assertNotNull("The observed component instance must be non-null [2]", observedComponent2);
+
+ // check the bound services count again - both components must have 4 services bound -> 1 simple component and 3 helper factory
+ assertEquals("The bound service count must be 4 - 1 simple component, 3 helper factory components [1]", 4, observedComponent1.getBoundServiceCount(null));
+ assertEquals("The bound service count must be 4 - 1 simple component, 3 helper factory components [2]", 4, observedComponent2.getBoundServiceCount(null));
+
+ uninstallBundle(tb10);
+ }
+
+ public void testConfigurationPolicy() throws Exception {
+ ConfigurationAdmin cm = (ConfigurationAdmin) trackerCM.getService();
+ assertNotNull("The ConfigurationAdmin should be available", cm);
+
+ Bundle tb11 = installBundle("tb11");
+ tb11.start();
+ waitBundleStart();
+
+ Hashtable props = new Hashtable(10);
+ props.put("config.base.data", new Integer(1));
+
+ // component notsetNS100 - property not set by Configuration Admin; XML NS 1.0.0
+ assertEquals("Configuration data should not be available for notsetNS100", 0, getBaseConfigData(COMP_NOTSET_100));
+ // component notsetNS100 - property set by Configuration Admin; XML NS 1.0.0
+ Configuration config = cm.getConfiguration(COMP_NOTSET_100);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Configuration data should be available for notsetNS100 and equal to 1", 1, getBaseConfigData(COMP_NOTSET_100));
+
+ // component notsetNS110 - property not set by Configuration Admin; XML NS 1.1.0
+ assertEquals("Configuration data should not be available for notsetNS110", 0, getBaseConfigData(COMP_NOTSET_110));
+ // component notsetNS110 - property set by Configuration Admin; XML NS 1.1.0
+ config = cm.getConfiguration(COMP_NOTSET_110);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Configuration data should be available for notsetNS110 and equal to 1", 1, getBaseConfigData(COMP_NOTSET_110));
+
+ // component optionalNS100 - property not set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ assertEquals("Component optionalNS100 should not be activated", -1, getBaseConfigData(COMP_OPTIONAL_100));
+ // component optionalNS100 - property set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ config = cm.getConfiguration(COMP_OPTIONAL_100);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Component optionalNS100 should not be activated", -1, getBaseConfigData(COMP_OPTIONAL_100));
+
+ // component optionalNS110 - property not set by Configuration Admin; XML NS 1.1.0
+ assertEquals("Configuration data should not be available for optionalNS110", 0, getBaseConfigData(COMP_OPTIONAL_110));
+ // component optionalNS110 - property set by Configuration Admin; XML NS 1.1.0
+ config = cm.getConfiguration(COMP_OPTIONAL_110);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Configuration data should be available for optionalNS110 and equal to 1", 1, getBaseConfigData(COMP_OPTIONAL_110));
+
+ // component requireNS100 - property not set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ assertEquals("Component requireNS100 should not be activated", -1, getBaseConfigData(COMP_REQUIRE_100));
+ // component requireNS100 - property set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ config = cm.getConfiguration(COMP_REQUIRE_100);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Component requireNS100 should not be activated", -1, getBaseConfigData(COMP_REQUIRE_100));
+
+ // component requireNS110 - property not set by Configuration Admin; XML NS 1.1.0
+ assertEquals("Configuration data should not be available for requireNS110, and it should not be satisfied", -1, getBaseConfigData(COMP_REQUIRE_110));
+ // component requireNS110 - property set by Configuration Admin; XML NS 1.1.0
+ config = cm.getConfiguration(COMP_REQUIRE_110);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Configuration data should be available for requireNS110 and equal to 1", 1, getBaseConfigData(COMP_REQUIRE_110));
+
+ // component ignoreNS100 - property not set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ assertEquals("Component ignoreNS100 should not be activated", -1, getBaseConfigData(COMP_IGNORE_100));
+ // component ignoreNS100 - property set by Configuration Admin; XML NS 1.0.0 - INVALID COMPONENT
+ config = cm.getConfiguration(COMP_IGNORE_100);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Component ignoreNS100 should not be activated", -1, getBaseConfigData(COMP_IGNORE_100));
+
+ // component ignoreNS110 - property not set by Configuration Admin; XML NS 1.1.0
+ assertEquals("Configuration data should not be available for ignoreNS110, but it should be satisfied", 0, getBaseConfigData(COMP_IGNORE_110));
+ // component ignoreNS110 - property set by Configuration Admin; XML NS 1.1.0
+ config = cm.getConfiguration(COMP_IGNORE_110);
+ config.update(props);
+ Thread.sleep(timeout * 3);
+ assertEquals("Configuration data should not be available for ignoreNS110, but it should be satisfied", 0, getBaseConfigData(COMP_IGNORE_110));
+
+ uninstallBundle(tb11);
+ }
+
+ public void testActivateDeactivate() throws Exception {
+ Bundle tb12 = installBundle("tb12");
+ tb12.start();
+ waitBundleStart();
+
+ final String NOTSET_NS100 = "org.eclipse.equinox.ds.tests.tb12.notsetNS100";
+ final String NOTSET_NS110 = "org.eclipse.equinox.ds.tests.tb12.notsetNS110";
+ final String NOARGS_NS100 = "org.eclipse.equinox.ds.tests.tb12.NoArgs100";
+ final String NOARGS_NS110 = "org.eclipse.equinox.ds.tests.tb12.NoArgs110";
+ final String CC_NS100 = "org.eclipse.equinox.ds.tests.tb12.CcNS100";
+ final String CC_NS110 = "org.eclipse.equinox.ds.tests.tb12.CcNS110";
+ final String BC_NS100 = "org.eclipse.equinox.ds.tests.tb12.Bc100";
+ final String BC_NS110 = "org.eclipse.equinox.ds.tests.tb12.Bc110";
+ final String MAP_NS100 = "org.eclipse.equinox.ds.tests.tb12.MapNS100";
+ final String MAP_NS110 = "org.eclipse.equinox.ds.tests.tb12.MapNS110";
+ final String CC_BC_MAP_NS100 = "org.eclipse.equinox.ds.tests.tb12.CcBcMapNS100";
+ final String CC_BC_MAP_NS110 = "org.eclipse.equinox.ds.tests.tb12.CcBcMapNS110";
+ final String INT_NS110 = "org.eclipse.equinox.ds.tests.tb12.IntNS110";
+ final String CC_BC_MAP_INT_NS110 = "org.eclipse.equinox.ds.tests.tb12.CcBcMapIntNS110";
+
+ PropertiesProvider bs = getBaseService(NOTSET_NS100);
+ ComponentContext cc = (bs instanceof ComponentContextProvider) ?
+ ((ComponentContextProvider) bs).getComponentContext() : null;
+ assertNotNull("Component context should be available", cc);
+
+ assertEquals("Activate method of " + NOTSET_NS100 + " should be called", 1 << 0, (1 << 0) & getBaseConfigData(bs));
+ cc.disableComponent(NOTSET_NS100);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + NOTSET_NS100 + " should be called", 1 << 1, (1 << 1) & getBaseConfigData(bs));
+
+ bs = getBaseService(NOTSET_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + NOTSET_NS110 + " should be called", 1 << 0, (1 << 0) & getBaseConfigData(bs));
+ cc.disableComponent(NOTSET_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + NOTSET_NS110 + " should be called", 1 << 1, (1 << 1) & getBaseConfigData(bs));
+
+ bs = getBaseService(NOARGS_NS100); // INVALID COMPONENT FOR XML NS 1.0.0
+ assertEquals("Component " + NOARGS_NS100 + " should not be activated", -1, getBaseConfigData(bs));
+
+ bs = getBaseService(NOARGS_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + NOARGS_NS110 + " should be called", 1 << 2, (1 << 2) & getBaseConfigData(bs));
+ cc.disableComponent(NOARGS_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + NOARGS_NS110 + " should be called", 1 << 3, (1 << 3) & getBaseConfigData(bs));
+
+ bs = getBaseService(CC_NS100); // INVALID COMPONENT FOR XML NS 1.0.0
+ assertEquals("Component " + CC_NS100 + " should not be activated", -1, getBaseConfigData(bs));
+
+ bs = getBaseService(CC_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + CC_NS110 + " should be called", 1 << 4, (1 << 4) & getBaseConfigData(bs));
+ cc.disableComponent(CC_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + CC_NS110 + " should be called", 1 << 5, (1 << 5) & getBaseConfigData(bs));
+
+ bs = getBaseService(BC_NS100); // INVALID COMPONENT FOR XML NS 1.0.0
+ assertEquals("Component " + BC_NS100 + " should not be activated", -1, getBaseConfigData(bs));
+
+ bs = getBaseService(BC_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + BC_NS110 + " should be called", 1 << 6, (1 << 6) & getBaseConfigData(bs));
+ cc.disableComponent(BC_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + BC_NS110 + " should be called", 1 << 7, (1 << 7) & getBaseConfigData(bs));
+
+ bs = getBaseService(MAP_NS100); // INVALID COMPONENT FOR XML NS 1.0.0
+ assertEquals("Component " + MAP_NS100 + " should not be activated", -1, getBaseConfigData(bs));
+
+ bs = getBaseService(MAP_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + MAP_NS110 + " should be called", 1 << 8, (1 << 8) & getBaseConfigData(bs));
+ cc.disableComponent(MAP_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + MAP_NS110 + " should be called", 1 << 9, (1 << 9) & getBaseConfigData(bs));
+
+ bs = getBaseService(CC_BC_MAP_NS100); // INVALID COMPONENT FOR XML NS 1.0.0
+ assertEquals("Component " + CC_BC_MAP_NS100 + " should not be activated", -1, getBaseConfigData(bs));
+
+ bs = getBaseService(CC_BC_MAP_NS110);
+ assertNotNull(bs);
+ assertEquals("Activate method of " + CC_BC_MAP_NS110 + " should be called", 1 << 10, (1 << 10) & getBaseConfigData(bs));
+ cc.disableComponent(CC_BC_MAP_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + CC_BC_MAP_NS110 + " should be called", 1 << 11, (1 << 11) & getBaseConfigData(bs));
+
+ bs = getBaseService(INT_NS110);
+ assertNotNull(bs);
+ cc.disableComponent(INT_NS110);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivate method of " + INT_NS110 + " should be called", 1 << 12, (1 << 12) & getBaseConfigData(bs));
+
+ bs = getBaseService(CC_BC_MAP_INT_NS110);
+ assertNotNull(bs);
+ cc.disableComponent(CC_BC_MAP_INT_NS110);
+ Thread.sleep(timeout * 3);
+ int data = getBaseConfigData(bs);
+ assertEquals("Deactivate method of " + CC_BC_MAP_INT_NS110 + " should be called", 1 << 13, (1 << 13) & data);
+
+ //// Testing Deactivation reasons ////
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_DISABLED", 1, 0xFF & (data >> 16));
+
+ final String CONT_EXP = "org.eclipse.equinox.ds.tests.tb12.ContextExp";
+
+ cc.enableComponent(CC_BC_MAP_INT_NS110);
+ Thread.sleep(timeout * 3);
+ bs = getBaseService(CC_BC_MAP_INT_NS110);
+ assertNotNull(bs);
+ cc.disableComponent(CONT_EXP);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_REFERENCE", 2, 0xFF & (getBaseConfigData(bs) >> 16));
+
+ cc.enableComponent(CONT_EXP);
+ Thread.sleep(timeout * 3);
+
+ bs = getBaseService(CC_BC_MAP_INT_NS110);
+ assertNotNull(bs);
+ ConfigurationAdmin cm = (ConfigurationAdmin) trackerCM.getService();
+ assertNotNull("The ConfigurationAdmin should be available", cm);
+ Configuration config = cm.getConfiguration(CC_BC_MAP_INT_NS110);
+ Dictionary properties = config.getProperties();
+ if (properties == null) {
+ properties = new Hashtable();
+ }
+ properties.put("configuration.dummy", "dummy");
+ config.update(properties);
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_CONFIGURATION_MODIFIED", 3, 0xFF & (getBaseConfigData(bs) >> 16));
+
+ cc.enableComponent(CC_BC_MAP_INT_NS110);
+ Thread.sleep(timeout * 3);
+
+ bs = getBaseService(CC_BC_MAP_INT_NS110);
+ assertNotNull(bs);
+ config = cm.getConfiguration(CC_BC_MAP_INT_NS110);
+ config.delete();
+ Thread.sleep(timeout * 3);
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_CONFIGURATION_DELETED", 4, 0xFF & (getBaseConfigData(bs) >> 16));
+
+ cc.enableComponent(CC_BC_MAP_INT_NS110);
+ Thread.sleep(timeout * 3);
+
+ cc.enableComponent(INT_NS110);
+ Thread.sleep(timeout * 3);
+
+ bs = getBaseService(INT_NS110);
+ assertNotNull(bs);
+ ComponentContext ccIntNS110 = (bs instanceof ComponentContextProvider) ?
+ ((ComponentContextProvider) bs).getComponentContext() : null;
+ assertNotNull("Component context should be available for " + INT_NS110, ccIntNS110);
+ ccIntNS110.getComponentInstance().dispose();
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_DISPOSED", 5, 0xFF & (getBaseConfigData(bs) >> 16));
+
+ bs = getBaseService(CC_BC_MAP_INT_NS110);
+ assertNotNull(bs);
+ tb12.stop();
+ assertEquals("Deactivation reason shall be DEACTIVATION_REASON_BUNDLE_STOPPED", 6, 0xFF & (getBaseConfigData(bs) >> 16));
+
+ uninstallBundle(tb12);
+ }
+
+ public void testBindUnbindParams() throws Exception {
+ Bundle tb13 = installBundle("tb13");
+ tb13.start();
+ waitBundleStart();
+
+ final String SR_NS100 = "org.eclipse.equinox.ds.tests.tb13.SrNS100";
+ final String SR_NS110 = "org.eclipse.equinox.ds.tests.tb13.SrNS110";
+ final String CE_NS100 = "org.eclipse.equinox.ds.tests.tb13.CeNS100";
+ final String CE_NS110 = "org.eclipse.equinox.ds.tests.tb13.CeNS110";
+ final String CE_MAP_NS100 = "org.eclipse.equinox.ds.tests.tb13.CeMapNS100";
+ final String CE_MAP_NS110 = "org.eclipse.equinox.ds.tests.tb13.CeMapNS110";
+
+ ServiceReference ref = getContext().getServiceReference(ComponentManager.class.getName());
+ assertNotNull("Component Enabler Service Reference should be available", ref);
+ ComponentManager enabler = (ComponentManager) getContext().getService(ref);
+ assertNotNull("Component Enabler Service should be available", enabler);
+
+ PropertiesProvider bs = getBaseService(SR_NS100);
+ assertNotNull("Component " + SR_NS100 + " should be activated", bs);
+ assertEquals("Bind method of " + SR_NS100 + " should be called", 1 << 0, (1 << 0) & getBaseConfigData(bs));
+ enabler.enableComponent(SR_NS100, false);
+ Thread.sleep(timeout * 3);
+ assertEquals("Unbind method of " + SR_NS100 + " should be called", 1 << 1, (1 << 1) & getBaseConfigData(bs));
+
+ bs = getBaseService(SR_NS110);
+ assertNotNull("Component " + SR_NS110 + " should be activated", bs);
+ assertEquals("Bind method of " + SR_NS110 + " should be called", 1 << 0, (1 << 0) & getBaseConfigData(bs));
+ enabler.enableComponent(SR_NS110, false);
+ Thread.sleep(timeout * 3);
+ assertEquals("Unbind method of " + SR_NS110 + " should be called", 1 << 1, (1 << 1) & getBaseConfigData(bs));
+
+ bs = getBaseService(CE_NS100);
+ assertNotNull("Component " + CE_NS100 + " should be activated", bs);
+ assertEquals("Bind method of " + CE_NS100 + " should be called", 1 << 2, (1 << 2) & getBaseConfigData(bs));
+ enabler.enableComponent(CE_NS100, false);
+ Thread.sleep(timeout * 3);
+ assertEquals("Unbind method of " + CE_NS100 + " should be called", 1 << 3, (1 << 3) & getBaseConfigData(bs));
+
+ bs = getBaseService(CE_NS110);
+ assertNotNull("Component " + CE_NS110 + " should be activated", bs);
+ assertEquals("Bind method of " + CE_NS110 + " should be called", 1 << 2, (1 << 2) & getBaseConfigData(bs));
+ enabler.enableComponent(CE_NS110, false);
+ Thread.sleep(timeout * 3);
+ assertEquals("Unbind method of " + CE_NS110 + " should be called", 1 << 3, (1 << 3) & getBaseConfigData(bs));
+
+ bs = getBaseService(CE_MAP_NS100);
+ assertNull("Component " + CE_MAP_NS100 + " should not be activated", bs);
+
+ bs = getBaseService(CE_MAP_NS110);
+ assertNotNull("Component " + CE_MAP_NS110 + " should be activated", bs);
+ assertEquals("Bind method of " + CE_MAP_NS110 + " should be called", 1 << 4, (1 << 4) & getBaseConfigData(bs));
+ enabler.enableComponent(CE_MAP_NS110, false);
+ Thread.sleep(timeout * 3);
+ assertEquals("Unbind method of " + CE_MAP_NS110 + " should be called", 1 << 5, (1 << 5) & getBaseConfigData(bs));
+
+ getContext().ungetService(ref);
+ uninstallBundle(tb13);
+ }
+
+ public void testOptionalNames() throws Exception {
+ Bundle tb14 = installBundle("tb14");
+ tb14.start();
+ waitBundleStart();
+ PropertiesProvider bs;
+
+ final String OPT_NAME_100 = "org.eclipse.equinox.ds.tests.tb14.Optional";
+ final String OPT_NAME_110 = "org.eclipse.equinox.ds.tests.tb14.Optional2";
+ final String OPT_REF_100 = "org.eclipse.equinox.ds.tests.tb14.OptRef100";
+ final String OPT_REF_110 = "org.eclipse.equinox.ds.tests.tb14.OptRef110";
+
+ assertNull("Component " + OPT_NAME_100 + " should not be activated", getBaseService(OPT_NAME_100));
+ assertNotNull("Component " + OPT_NAME_110 + " should be activated", getBaseService(OPT_NAME_110));
+
+ assertNull("Component " + OPT_REF_100 + " should not be activated", getBaseService(OPT_REF_100));
+ assertNotNull("Component " + OPT_REF_110 + " should be activated", bs = getBaseService(OPT_REF_110));
+
+ ComponentContext cc = (bs instanceof ComponentContextProvider) ?
+ ((ComponentContextProvider) bs).getComponentContext() : null;
+ assertNotNull("Component context should be available", cc);
+ assertNotNull("Optional reference name should be set to interface attribute", cc.locateService(ComponentContextProvider.class.getName()));
+
+ uninstallBundle(tb14);
+ }
+
+ public void testDisposingMultipleDependencies() throws Exception {
+ Bundle tb15 = installBundle("tb15");
+ tb15.start();
+ waitBundleStart();
+
+ final String C1 = "org.eclipse.equinox.ds.tests.tb15.Component1";
+ final String C2 = "org.eclipse.equinox.ds.tests.tb15.Component2";
+ final String C3 = "org.eclipse.equinox.ds.tests.tb15.Component3";
+
+ PropertiesProvider serviceC1 = getBaseService(C1);
+ assertNotNull("Component " + C1 + " should be activated", serviceC1);
+ PropertiesProvider serviceC2 = getBaseService(C2);
+ assertNotNull("Component " + C2 + " should be activated", serviceC2);
+ PropertiesProvider serviceC3 = getBaseService(C3);
+ assertNotNull("Component " + C3 + " should be activated", serviceC3);
+
+ ComponentContext cc = (serviceC1 instanceof ComponentContextProvider) ?
+ ((ComponentContextProvider) serviceC1).getComponentContext() : null;
+ assertNotNull("Component context should be available", cc);
+
+ cc.disableComponent(C1);
+ Thread.sleep(timeout * 3);
+
+ assertEquals("Component " + C3 + " should be deactivated first", 0, getBaseConfigData(serviceC3));
+ assertEquals("Component " + C2 + " should be deactivated second", 1, getBaseConfigData(serviceC2));
+ assertEquals("Component " + C1 + " should be deactivated third", 2, getBaseConfigData(serviceC1));
+
+ uninstallBundle(tb15);
+ }
+
+ public void testReferenceTargetProperty() throws Exception {
+ Bundle tb16 = installBundle("tb16");
+ tb16.start();
+ waitBundleStart();
+
+ final String EXPOSER = "org.eclipse.equinox.ds.tests.tb16.Exposer";
+ final String C1 = "org.eclipse.equinox.ds.tests.tb16.C1";
+ final String C2 = "org.eclipse.equinox.ds.tests.tb16.C2";
+
+ PropertiesProvider bs = getBaseService(EXPOSER);
+ ComponentContext cc = (bs instanceof ComponentContextProvider) ?
+ ((ComponentContextProvider) bs).getComponentContext() : null;
+ assertNotNull("Component context should be available", cc);
+
+ PropertiesProvider serviceC2 = getBaseService(C2);
+ // target property of referenced service of component Component2 should not be satisfied
+ assertNull("Component " + C2 + " should not be activated because of unsatisfied reference", serviceC2);
+
+ cc.enableComponent(C1);
+ Thread.sleep(timeout * 3);
+ assertNotNull("Component " + C1 + " should be available", getBaseService(C1));
+
+ serviceC2 = getBaseService(C2);
+ // target property of referenced service of component Component2 should now be satisfied
+ assertNotNull("Component " + C2 + " should be activated", serviceC2);
+
+ uninstallBundle(tb16);
+ }
+
+ class OverloadManager extends Thread {
+ private String compPrefix;
+ private int firstComp;
+ private int lastComp;
+
+ public OverloadManager(String compPrefix, int first, int last) {
+ this.compPrefix = compPrefix;
+ this.firstComp = first;
+ this.lastComp = last;
+ }
+
+ public void run() {
+ ConfigurationAdmin cm = (ConfigurationAdmin) trackerCM.getService();
+ assertNotNull("The ConfigurationAdmin should be available", cm);
+
+ try {
+ for (int i = firstComp; i <= lastComp; i++) {
+ Configuration config = cm.getConfiguration(compPrefix + i);
+ Dictionary properties = config.getProperties();
+ if (properties == null) {
+ properties = new Hashtable();
+ }
+ properties.put("component.index", new Integer(i));
+ config.update(properties);
+
+ sleep0(100);
+ }
+ } catch (IOException e) {
+ return;
+ }
+ }
+
+ public boolean isAllComponentsRunning() {
+ for (int i = firstComp; i <= lastComp; i++) {
+ if (getBaseService(compPrefix + i) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ public void testOverload() throws Exception {
+ Bundle tb17 = installBundle("tb17");
+ Bundle tb18 = installBundle("tb18");
+ Bundle tb19 = installBundle("tb19");
+ tb17.start();
+ tb18.start();
+ tb19.start();
+ waitBundleStart();
+
+ final String SCR = "org.eclipse.equinox.ds.tests";
+ final int startComp = 1;
+ final int lastComp = 10;
+ final int OVERLOAD_TIMEOUT = 60000; // max time allowed for processing in ms
+
+ OverloadManager manager17 = new OverloadManager(SCR + ".tb17.C", startComp, lastComp);
+ OverloadManager manager18 = new OverloadManager(SCR + ".tb18.C", startComp, lastComp);
+ OverloadManager manager19 = new OverloadManager(SCR + ".tb19.C", startComp, lastComp);
+
+ long startTime = System.currentTimeMillis();
+ manager17.start();
+ manager18.start();
+ manager19.start();
+
+ manager17.join();
+ manager18.join();
+ manager19.join();
+
+ // waiting SCR to process events
+ int successCount = 0;
+ while ((successCount < 5) && (System.currentTimeMillis() - startTime < OVERLOAD_TIMEOUT)) {
+ Thread.sleep(100);
+ if (!manager17.isAllComponentsRunning() || !manager18.isAllComponentsRunning() || !manager19.isAllComponentsRunning()) {
+ successCount = 0;
+ continue;
+ }
+ successCount++;
+ }
+
+ long elapsed = System.currentTimeMillis() - startTime;
+ log("testOverload(): Overload processing finished for " + elapsed + " ms.");
+
+ assertTrue("All components of tb17 should be activated", manager17.isAllComponentsRunning());
+ assertTrue("All components of tb18 should be activated", manager18.isAllComponentsRunning());
+ assertTrue("All components of tb19 should be activated", manager19.isAllComponentsRunning());
+
+ uninstallBundle(tb17);
+ uninstallBundle(tb18);
+ uninstallBundle(tb19);
+ }
+
+ /**
+ * Searches for component with name componentName which provides PropertiesProvider. Returns value of its
+ * "config.base.data" property.
+ *
+ * @param componentName - the name of the component to get data
+ * @return the value of property "config.base.data", provided by PropertiesProvider.getProperties().
+ * Returned value is -1 when component which provides PropertiesProvider and has specified name is
+ * not activated. Returned value is 0 when component with specified name is active but doesn't
+ * have property "config.base.data".
+ */
+ private int getBaseConfigData(String componentName) {
+ PropertiesProvider s = getBaseService(componentName);
+ return getBaseConfigData(s);
+ }
+
+ private int getBaseConfigData(PropertiesProvider s) {
+ Dictionary props = null;
+ int value = -1;
+ if (s != null) {
+ value = 0;
+ if ((props = s.getProperties()) != null) {
+ Object prop = props.get("config.base.data");
+ if (prop instanceof Integer) {
+ value = ((Integer)prop).intValue();
+ }
+ }
+ }
+ return value;
+ }
+
+ private PropertiesProvider getBaseService(String componentName) {
+ Object[] services = trackerBaseService.getServices();
+ if (services == null) {
+ return null;
+ }
+ for (int i = 0; i < services.length; i++) {
+ if (services[i] instanceof PropertiesProvider) {
+ PropertiesProvider s = (PropertiesProvider)services[i];
+ Dictionary props = s.getProperties();
+ if (props != null && ((String)props.get(ComponentConstants.COMPONENT_NAME)).equals(componentName)) {
+ return s;
+ }
+ }
+ }
+ return null;
+ }
+
+ private BundleContext getContext() {
+ return DSTestsActivator.getContext();
+ }
+
+ private Bundle installBundle(String bundle) throws BundleException {
+ Bundle b = installer.installBundle(bundle);
+ return b;
+ }
+
+ private void uninstallBundle(Bundle bundle) throws BundleException {
+ installer.uninstallBundle(bundle);
+ }
+
+ private ServiceRegistration registerService(String className, Object service, Dictionary props) {
+ ServiceRegistration sr = getContext().registerService(className, service, props);
+
+ registeredServices.put(service, sr);
+
+ return sr;
+ }
+
+ private void unregisterService(Object service) {
+ ServiceRegistration sr = (ServiceRegistration) registeredServices.get(service);
+ if (sr != null) {
+ sr.unregister();
+ registeredServices.remove(sr);
+ }
+ }
+
+ private void unregisterService(ServiceRegistration reg) {
+ Enumeration e = registeredServices.elements();
+ while(e.hasMoreElements()) {
+ Object service = e.nextElement();
+ if (reg == null || registeredServices.get(service) == reg) {
+ unregisterService(service);
+ }
+ }
+ }
+
+ private void unregisterAllServices() {
+ Enumeration e = registeredServices.elements();
+ while (e.hasMoreElements()) {
+ Object service = e.nextElement();
+ unregisterService(service);
+ }
+ }
+
+ private void log(String msg) {
+// System.out.println("[Declarative Service TC] " + msg);
+ }
+
+ public void sleep0(long millisToSleep) {
+ long start = System.currentTimeMillis();
+ do {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ }
+ } while (System.currentTimeMillis() - start < millisToSleep);
+ }
+
+ private void waitBundleStart() {
+ if (!synchronousBuild) {
+ sleep0(2 * timeout);
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DynamicWorker.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DynamicWorker.java
new file mode 100644
index 000000000..16cbfdab6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/DynamicWorker.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import java.util.Dictionary;
+
+public class DynamicWorker implements PropertiesProvider {
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/NamespaceProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/NamespaceProvider.java
new file mode 100644
index 000000000..187c8ecf0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/NamespaceProvider.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public interface NamespaceProvider {
+ public int getComponentNSID();
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/PropertiesProvider.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/PropertiesProvider.java
new file mode 100644
index 000000000..d9c253c6f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/PropertiesProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import java.util.Dictionary;
+
+public interface PropertiesProvider {
+
+ public Dictionary getProperties();
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/StaticWorker.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/StaticWorker.java
new file mode 100644
index 000000000..617efa495
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/StaticWorker.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+import java.util.Dictionary;
+
+public class StaticWorker implements PropertiesProvider {
+
+ public Dictionary getProperties() {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/TestHelper.java b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/TestHelper.java
new file mode 100644
index 000000000..f8324b072
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds.tests/src/org/eclipse/equinox/ds/tests/tbc/TestHelper.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 1997-2009 by ProSyst Software GmbH
+ * http://www.prosyst.com
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * ProSyst Software GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.ds.tests.tbc;
+
+public class TestHelper {
+
+ private static boolean activatedStandAlone = false;
+ private static boolean activatedServiceProvider = false;
+
+ public static void reset() {
+ activatedStandAlone = false;
+ activatedServiceProvider = false;
+ }
+
+ public static boolean isActivatedServiceProvider() {
+ return activatedServiceProvider;
+ }
+
+ public static void setActivatedServiceProvider(boolean activatedServiceProvider) {
+ TestHelper.activatedServiceProvider = activatedServiceProvider;
+ }
+
+ public static boolean isActivatedStandAlone() {
+ return activatedStandAlone;
+ }
+
+ public static void setActivatedStandAlone(boolean activatedStandAlone) {
+ TestHelper.activatedStandAlone = activatedStandAlone;
+ }
+
+}

Back to the top