Migrate the test suites to the new junit4osgi development model (use getContext() to get the bundle context instead of context).
Add <parent> in pom files
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@722146 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/examples/junit4osgi/felix-command/metadata.xml b/ipojo/examples/junit4osgi/felix-command/metadata.xml
index 4021649..b1524c5 100644
--- a/ipojo/examples/junit4osgi/felix-command/metadata.xml
+++ b/ipojo/examples/junit4osgi/felix-command/metadata.xml
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
-->
-<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<component
className="org.apache.felix.ipojo.junit4osgi.command.JunitCommand"
diff --git a/ipojo/examples/junit4osgi/felix-command/pom.xml b/ipojo/examples/junit4osgi/felix-command/pom.xml
index 6b912ad..0b49f1d 100644
--- a/ipojo/examples/junit4osgi/felix-command/pom.xml
+++ b/ipojo/examples/junit4osgi/felix-command/pom.xml
@@ -17,13 +17,17 @@
under the License.
-->
<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>Junit4Osgi-Felix-Command</name>
<artifactId>
org.apache.felix.ipojo.junit4osgi.felix-command
</artifactId>
- <groupId>org.apache.felix</groupId>
<version>1.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
diff --git a/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml b/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml
index 4d7392a..9f3da35 100644
--- a/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml
+++ b/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
-->
-<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<component
className="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner"
diff --git a/ipojo/examples/junit4osgi/immediate-launcher/pom.xml b/ipojo/examples/junit4osgi/immediate-launcher/pom.xml
index 0328d91..c13726a 100644
--- a/ipojo/examples/junit4osgi/immediate-launcher/pom.xml
+++ b/ipojo/examples/junit4osgi/immediate-launcher/pom.xml
@@ -17,13 +17,17 @@
under the License.
-->
<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>Junit4Osgi-Immediate-Runner</name>
<artifactId>
org.apache.felix.ipojo.junit4osgi.immediate-runner
</artifactId>
- <groupId>org.apache.felix</groupId>
<version>1.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
diff --git a/ipojo/examples/junit4osgi/junit4osgi/metadata.xml b/ipojo/examples/junit4osgi/junit4osgi/metadata.xml
index db0dc94..7d59467 100644
--- a/ipojo/examples/junit4osgi/junit4osgi/metadata.xml
+++ b/ipojo/examples/junit4osgi/junit4osgi/metadata.xml
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
-->
-<?xml version="1.0" encoding="UTF-8"?>
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="org.apache.felix.ipojo http://people.apache.org/~clement/ipojo/schemas/core.xsd
org.apache.felix.ipojo.extender http://people.apache.org/~clement/ipojo/schemas/extender-pattern.xsd"
diff --git a/ipojo/examples/junit4osgi/junit4osgi/pom.xml b/ipojo/examples/junit4osgi/junit4osgi/pom.xml
index 26db137..b7b7774 100644
--- a/ipojo/examples/junit4osgi/junit4osgi/pom.xml
+++ b/ipojo/examples/junit4osgi/junit4osgi/pom.xml
@@ -17,11 +17,15 @@
under the License.
-->
<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>Junit4Osgi</name>
<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
- <groupId>org.apache.felix</groupId>
<version>1.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
diff --git a/ipojo/examples/junit4osgi/maven-junit4osgi-plugin/pom.xml b/ipojo/examples/junit4osgi/maven-junit4osgi-plugin/pom.xml
index 729d27d..4e60f93 100644
--- a/ipojo/examples/junit4osgi/maven-junit4osgi-plugin/pom.xml
+++ b/ipojo/examples/junit4osgi/maven-junit4osgi-plugin/pom.xml
@@ -18,8 +18,12 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.felix</groupId>
<artifactId>maven-junit4osgi-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.1.0-SNAPSHOT</version>
diff --git a/ipojo/examples/junit4osgi/swing-runner/metadata.xml b/ipojo/examples/junit4osgi/swing-runner/metadata.xml
index 2a5a610..958bfc4 100644
--- a/ipojo/examples/junit4osgi/swing-runner/metadata.xml
+++ b/ipojo/examples/junit4osgi/swing-runner/metadata.xml
@@ -16,7 +16,6 @@
specific language governing permissions and limitations
under the License.
-->
-<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<component
classname="org.apache.felix.ipojo.junit4osgi.command.SwingRunner">
diff --git a/ipojo/examples/junit4osgi/swing-runner/pom.xml b/ipojo/examples/junit4osgi/swing-runner/pom.xml
index 4931067..137e93b 100644
--- a/ipojo/examples/junit4osgi/swing-runner/pom.xml
+++ b/ipojo/examples/junit4osgi/swing-runner/pom.xml
@@ -17,11 +17,15 @@
under the License.
-->
<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<name>Junit4Osgi-Swing-GUI</name>
<artifactId>org.apache.felix.ipojo.junit4osgi.swing-gui</artifactId>
- <groupId>org.apache.felix</groupId>
<version>1.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
diff --git a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/component/FooProviderType1.java b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/component/FooProviderType1.java
index fc2ea2b..509e5d1 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/component/FooProviderType1.java
+++ b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/component/FooProviderType1.java
@@ -37,7 +37,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java
index 4ae87c5..3a02f60 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java
+++ b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java
@@ -33,7 +33,7 @@
public class EmptyCompositeTest extends OSGiTestCase {
public void testEmptyCompositeCreation() {
- Factory factory = Utils.getFactoryByName(context, "composite.empty");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
@@ -61,7 +61,7 @@
CompositeManager cm = (CompositeManager) ci;
ServiceContext sc = cm.getServiceContext();
try {
- assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, context.getServiceReferences(Factory.class.getName(), null).length);
+ assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length);
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e.getMessage());
}
@@ -69,7 +69,7 @@
}
public void testInstanceCreation1() {
- Factory factory = Utils.getFactoryByName(context, "composite.empty");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
@@ -85,7 +85,7 @@
CompositeManager cm = (CompositeManager) ci;
ServiceContext sc = cm.getServiceContext();
try {
- assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, context.getServiceReferences(Factory.class.getName(), null).length);
+ assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length);
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e.getMessage());
}
@@ -119,7 +119,7 @@
}
public void testInstanceCreation2() {
- Factory factory = Utils.getFactoryByName(context, "composite.empty");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
@@ -134,7 +134,7 @@
CompositeManager cm = (CompositeManager) ci;
ServiceContext sc = cm.getServiceContext();
try {
- assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, context.getServiceReferences(Factory.class.getName(), null).length);
+ assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length);
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e.getMessage());
}
@@ -169,7 +169,7 @@
}
public void testInstanceCreation3() {
- Factory factory = Utils.getFactoryByName(context, "composite.empty");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
@@ -184,7 +184,7 @@
CompositeManager cm = (CompositeManager) ci;
ServiceContext sc = cm.getServiceContext();
try {
- assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, context.getServiceReferences(Factory.class.getName(), null).length);
+ assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length);
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e.getMessage());
}
diff --git a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/FactoryManagementTest.java b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/FactoryManagementTest.java
index 1137f92..c70b643 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/FactoryManagementTest.java
+++ b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/FactoryManagementTest.java
@@ -62,12 +62,12 @@
public ComponentTypeDescription getComponentDescription() { return null; }
public String getClassName() { return ""; }
public int getState() { return Factory.VALID; }
- public BundleContext getBundleContext() { return context; }
+ public BundleContext getBundleContext() { return getContext(); }
}
public void setUp() {
- emptyFactory = Utils.getFactoryByName(context, "composite.empty");
+ emptyFactory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty-1");
try {
@@ -81,20 +81,20 @@
}
public void testOneLevelExposition() {
- ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
ServiceContext sc = Utils.getServiceContext(empty);
ServiceReference[] internalFactoryReferences = Utils.getServiceReferences(sc, Factory.class.getName(), null);
assertEquals("Check the number of available factories", parentsFactoryReferences.length, internalFactoryReferences.length);
for(int i = 0; i < parentsFactoryReferences.length; i++) {
- Factory factory = (Factory) context.getService(parentsFactoryReferences[i]);
+ Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]);
assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, internalFactoryReferences, sc));
}
}
public void testTwoLevelExposition() {
- ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
ServiceContext sc1 = Utils.getServiceContext(empty);
ServiceReference[] Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
@@ -116,7 +116,7 @@
assertEquals("Check the number of available factories - 3", Level1FactoryReferences.length, Level2FactoryReferences.length);
for(int i = 0; i < Level1FactoryReferences.length; i++) {
- Factory factory = (Factory) context.getService(parentsFactoryReferences[i]);
+ Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]);
assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, Level2FactoryReferences, sc2));
}
@@ -124,7 +124,7 @@
}
public void testDynamism() {
- ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ ServiceReference[] parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
ServiceContext sc1 = Utils.getServiceContext(empty);
ServiceReference[] Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
@@ -146,14 +146,14 @@
assertEquals("Check the number of available factories - 3", Level1FactoryReferences.length, Level2FactoryReferences.length);
for(int i = 0; i < Level1FactoryReferences.length; i++) {
- Factory factory = (Factory) context.getService(parentsFactoryReferences[i]);
+ Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]);
assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, Level2FactoryReferences, sc2));
}
// Publish fake1
- ServiceRegistration reg1 = context.registerService(Factory.class.getName(), fake1, null);
+ ServiceRegistration reg1 = getContext().registerService(Factory.class.getName(), fake1, null);
- parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
sc1 = Utils.getServiceContext(empty);
Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
sc2 = Utils.getServiceContext(empty2);
@@ -164,9 +164,9 @@
assertEquals("Check the number of available factories - 1.3", Level1FactoryReferences.length, Level2FactoryReferences.length);
// Publish fake2
- ServiceRegistration reg2 = context.registerService(Factory.class.getName(), fake2, null);
+ ServiceRegistration reg2 = getContext().registerService(Factory.class.getName(), fake2, null);
- parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
sc1 = Utils.getServiceContext(empty);
Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
sc2 = Utils.getServiceContext(empty2);
@@ -178,7 +178,7 @@
reg1.unregister();
- parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
sc1 = Utils.getServiceContext(empty);
Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
sc2 = Utils.getServiceContext(empty2);
@@ -190,7 +190,7 @@
reg2.unregister();
- parentsFactoryReferences = Utils.getServiceReferences(context, Factory.class.getName(), null);
+ parentsFactoryReferences = Utils.getServiceReferences(getContext(), Factory.class.getName(), null);
sc1 = Utils.getServiceContext(empty);
Level1FactoryReferences = Utils.getServiceReferences(sc1, Factory.class.getName(), null);
sc2 = Utils.getServiceContext(empty2);
diff --git a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRangeTest.java b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRangeTest.java
index 5b7b895..54f4648 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRangeTest.java
+++ b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRangeTest.java
@@ -37,7 +37,7 @@
public void setUp() {
- emptyFactory = Utils.getFactoryByName(context, "composite.empty");
+ emptyFactory = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty-1");
try {
@@ -82,9 +82,9 @@
assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
// Check invisibilty
- assertNull("Check foo service invisible inside the context", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -94,9 +94,9 @@
assertNull("Check foo service invisible inside the composite", sc2.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible from the context", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible from the context", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -134,9 +134,9 @@
assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
// Check invisibilty
- assertNull("Check foo service invisible inside the context", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -146,9 +146,9 @@
assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -157,7 +157,7 @@
public void testLevelOne3() {
ServiceContext sc2 = Utils.getServiceContext(empty);
- Factory fact1 = Utils.getFactoryByName(context, "COMPO-SimpleCheckServiceProvider");
+ Factory fact1 = Utils.getFactoryByName(getContext(), "COMPO-SimpleCheckServiceProvider");
Properties props = new Properties();
props.put("instance.name","client");
ComponentInstance client = null;
@@ -165,7 +165,7 @@
client = fact1.createComponentInstance(props, sc2);
} catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
- Factory fact2 = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ Factory fact2 = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
Properties props2 = new Properties();
props2.put("instance.name","provider");
ComponentInstance provider = null;
@@ -186,9 +186,9 @@
assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName()));
// Check invisibilty
- assertNull("Check foo service invisible inside the context", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -198,9 +198,9 @@
assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -251,9 +251,9 @@
// Check invisibilty
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -265,9 +265,9 @@
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -319,9 +319,9 @@
// Check invisibilty
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -333,9 +333,9 @@
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -356,7 +356,7 @@
ServiceContext sc2 = Utils.getServiceContext(empty2);
- Factory fact1 = Utils.getFactoryByName(context, "COMPO-SimpleCheckServiceProvider");
+ Factory fact1 = Utils.getFactoryByName(getContext(), "COMPO-SimpleCheckServiceProvider");
Properties props = new Properties();
props.put("instance.name","client");
ComponentInstance client = null;
@@ -364,7 +364,7 @@
client = fact1.createComponentInstance(props, sc2);
} catch(Exception e) { fail("Cannot instantiate the client : " + e.getMessage()); }
- Factory fact2 = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ Factory fact2 = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
Properties props2 = new Properties();
props2.put("instance.name","provider");
ComponentInstance provider = null;
@@ -387,9 +387,9 @@
// Check invisibilty
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -401,9 +401,9 @@
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -455,9 +455,9 @@
// Check invisibilty
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
@@ -469,9 +469,9 @@
assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName()));
assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName()));
assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName()));
- assertNull("Check foo service invisible inside the global", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName()));
try {
- assertNull("Check check service invisible inside the context", context.getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
+ assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)"));
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e);
}
diff --git a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRegistryTest.java b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRegistryTest.java
index 14b3f61..86d96f1 100644
--- a/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRegistryTest.java
+++ b/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/ServiceRegistryTest.java
@@ -104,7 +104,7 @@
public void testRegistrationAndListener() {
ComponentInstance im = new FakeComponent();
ComponentInstance im2 = new FakeComponent();
- ServiceRegistry registry = new ServiceRegistry(context);
+ ServiceRegistry registry = new ServiceRegistry(getContext());
assertNotNull("Assert registry not null", registry);
svcListener all = new svcListener();
try {
@@ -147,7 +147,7 @@
public void testRegistrationAndFilter() {
ComponentInstance im = new FakeComponent();
ComponentInstance im2 = new FakeComponent();
- ServiceRegistry registry = new ServiceRegistry(context);
+ ServiceRegistry registry = new ServiceRegistry(getContext());
svcListener filtered = new svcListener();
try {
@@ -185,7 +185,7 @@
public void testGetService() {
ComponentInstance im = new FakeComponent();
ComponentInstance im2 = new FakeComponent();
- ServiceRegistry registry = new ServiceRegistry(context);
+ ServiceRegistry registry = new ServiceRegistry(getContext());
try {
assertNull("Check that there is no available service", registry.getServiceReferences(null, null));
@@ -209,7 +209,7 @@
public void testGetFilteredService() {
ComponentInstance im = new FakeComponent();
ComponentInstance im2 = new FakeComponent();
- ServiceRegistry registry = new ServiceRegistry(context);
+ ServiceRegistry registry = new ServiceRegistry(getContext());
try {
assertNull("Check that there is no available service", registry.getServiceReferences(null, null));
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
index 95cda20..a60b711 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/FilteredExport.java
@@ -35,7 +35,7 @@
ComponentInstance foo1 = null, foo2 = null;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "BazProviderType");
+ fooProvider = Utils.getFactoryByName(getContext(), "BazProviderType");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
@@ -53,7 +53,7 @@
foo1.stop();
foo2.stop();
- Factory factory = Utils.getFactoryByName(context, "composite.export.5");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.export.5");
Properties props = new Properties();
props.put("instance.name","export");
try {
@@ -76,7 +76,7 @@
export1.start();
// Check that no foo service are available
- assertEquals("Check no foo service", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 0);
+ assertEquals("Check no foo service", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 0);
// Test invalidity
assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID);
@@ -206,19 +206,19 @@
private boolean isFooServiceProvided() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export1.getInstanceName());
return ref != null;
}
private int countFooServiceProvided() {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export1.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export1.getInstanceName()+")");
return refs.length;
}
private boolean invoke() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export1.getInstanceName());
if(ref == null) { return false; }
- BazService fs = (BazService) context.getService(ref);
+ BazService fs = (BazService) getContext().getService(ref);
return fs.foo();
}
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
index 355f02a..7d452d0 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/MultipleExport.java
@@ -35,7 +35,7 @@
ComponentInstance foo1 = null, foo2 = null;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "BazProviderType");
+ fooProvider = Utils.getFactoryByName(getContext(), "BazProviderType");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
@@ -53,7 +53,7 @@
foo1.stop();
foo2.stop();
- Factory factory = Utils.getFactoryByName(context, "composite.export.3");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.export.3");
Properties props = new Properties();
props.put("instance.name","export");
try {
@@ -76,7 +76,7 @@
export3.start();
// Check that no foo service are available
- assertEquals("Check no foo service", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 0);
+ assertEquals("Check no foo service", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 0);
// Test invalidity
assertTrue("Check invalidity - 0", export3.getState() == ComponentInstance.INVALID);
@@ -210,30 +210,30 @@
private boolean isFooServiceProvided() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export3.getInstanceName());
return ref != null;
}
private int countFooServiceProvided() {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
return refs.length;
}
private boolean invoke() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export3.getInstanceName());
if(ref == null) { return false; }
- BazService fs = (BazService) context.getService(ref);
- context.ungetService(ref);
+ BazService fs = (BazService) getContext().getService(ref);
+ getContext().ungetService(ref);
return fs.foo();
}
private boolean invoke(int nb) {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
if(refs == null) { return false; }
if (nb > refs.length) { return false; }
for(int i = 0; i < nb; i++) {
- BazService fs = (BazService) context.getService(refs[i]);
- context.ungetService(refs[i]);
+ BazService fs = (BazService) getContext().getService(refs[i]);
+ getContext().ungetService(refs[i]);
if(!fs.foo()) { return false; }
}
return true;
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
index be0babb..3879abe 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalExport.java
@@ -35,7 +35,7 @@
ComponentInstance foo1 = null, foo2 = null;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "BazProviderType");
+ fooProvider = Utils.getFactoryByName(getContext(), "BazProviderType");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
@@ -53,7 +53,7 @@
foo1.stop();
foo2.stop();
- Factory factory = Utils.getFactoryByName(context, "composite.export.2");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.export.2");
Properties props = new Properties();
props.put("instance.name","export");
try {
@@ -76,7 +76,7 @@
export2.start();
// Check that no foo service are available
- assertEquals("Check no foo service", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 0);
+ assertEquals("Check no foo service", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 0);
// Test validity
assertTrue("Check validity - 0", export2.getState() == ComponentInstance.VALID);
@@ -210,19 +210,19 @@
private boolean isFooServiceProvided() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export2.getInstanceName());
return ref != null;
}
private int countFooServiceProvided() {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export2.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export2.getInstanceName()+")");
return refs.length;
}
private boolean invoke() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export2.getInstanceName());
if(ref == null) { return false; }
- BazService fs = (BazService) context.getService(ref);
+ BazService fs = (BazService) getContext().getService(ref);
return fs.foo();
}
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
index 38538be..9c38800 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/OptionalMultipleExport.java
@@ -35,7 +35,7 @@
ComponentInstance foo1 = null, foo2 = null;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "BazProviderType");
+ fooProvider = Utils.getFactoryByName(getContext(), "BazProviderType");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
@@ -53,7 +53,7 @@
foo1.stop();
foo2.stop();
- Factory factory = Utils.getFactoryByName(context, "composite.export.4");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.export.4");
Properties props = new Properties();
props.put("instance.name","export");
try {
@@ -76,7 +76,7 @@
export3.start();
// Check that no foo service are available
- assertEquals("Check no foo service", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 0);
+ assertEquals("Check no foo service", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 0);
// Test invalidity
assertTrue("Check validity - 0", export3.getState() == ComponentInstance.VALID);
@@ -210,30 +210,30 @@
private boolean isFooServiceProvided() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export3.getInstanceName());
return ref != null;
}
private int countFooServiceProvided() {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
return refs.length;
}
private boolean invoke() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export3.getInstanceName());
if(ref == null) { return false; }
- BazService fs = (BazService) context.getService(ref);
- context.ungetService(ref);
+ BazService fs = (BazService) getContext().getService(ref);
+ getContext().ungetService(ref);
return fs.foo();
}
private boolean invoke(int nb) {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export3.getInstanceName()+")");
if(refs == null) { return false; }
if (nb > refs.length) { return false; }
for(int i = 0; i < nb; i++) {
- BazService fs = (BazService) context.getService(refs[i]);
- context.ungetService(refs[i]);
+ BazService fs = (BazService) getContext().getService(refs[i]);
+ getContext().ungetService(refs[i]);
if(!fs.foo()) { return false; }
}
return true;
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
index 22f51c9..54418e6 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/exporter/SimpleExport.java
@@ -35,7 +35,7 @@
ComponentInstance foo1 = null, foo2 = null;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "BazProviderType");
+ fooProvider = Utils.getFactoryByName(getContext(), "BazProviderType");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
@@ -53,7 +53,7 @@
foo1.stop();
foo2.stop();
- Factory factory = Utils.getFactoryByName(context, "composite.export.1");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.export.1");
Properties props = new Properties();
props.put("instance.name","export");
try {
@@ -76,7 +76,7 @@
export1.start();
// Check that no foo service are available
- assertEquals("Check no foo service", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 0);
+ assertEquals("Check no foo service", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 0);
// Test invalidity
assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID);
@@ -210,19 +210,19 @@
private boolean isFooServiceProvided() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export1.getInstanceName());
return ref != null;
}
private int countFooServiceProvided() {
- ServiceReference[] refs = Utils.getServiceReferences(context, BazService.class.getName(), "(instance.name="+export1.getInstanceName()+")");
+ ServiceReference[] refs = Utils.getServiceReferences(getContext(), BazService.class.getName(), "(instance.name="+export1.getInstanceName()+")");
return refs.length;
}
private boolean invoke() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), export1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), export1.getInstanceName());
if(ref == null) { return false; }
- BazService fs = (BazService) context.getService(ref);
+ BazService fs = (BazService) getContext().getService(ref);
return fs.foo();
}
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
index 653ccb2..c712945 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedFilteredImport.java
@@ -38,7 +38,7 @@
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.1");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.1");
try {
import1 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,7 +47,7 @@
import1.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
index 72c08f7..f215040 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedMultipleImport.java
@@ -38,7 +38,7 @@
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.2");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.2");
try {
import2 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,7 +47,7 @@
import2.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
index 06dad59..38cff7d 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalImport.java
@@ -38,7 +38,7 @@
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.3");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.3");
try {
import3 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,7 +47,7 @@
import3.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
index 06018f5..3cfa5e5 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedOptionalMultipleImport.java
@@ -38,7 +38,7 @@
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.4");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.4");
try {
import4 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,7 +47,7 @@
import4.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
index b416663..82deca3 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/DelayedSimpleImport.java
@@ -38,7 +38,7 @@
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.1");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.1");
try {
import1 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,7 +47,7 @@
import1.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
index d50be8d..761bd41 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/FilteredImport.java
@@ -39,7 +39,7 @@
public void setUp() {
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.5");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.5");
try {
import1 = compFact.createComponentInstance(p);
} catch(Exception e) {
@@ -47,10 +47,10 @@
}
import1.stop();
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
- fooProvider2 = Utils.getFactoryByName(context, "COMPO-FooProviderType-2");
+ fooProvider2 = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-2");
assertNotNull("Check fooProvider availability", fooProvider2);
Properties p1 = new Properties();
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
index eb54bac..135c6c8 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/MultipleImport.java
@@ -34,12 +34,12 @@
Factory fooProvider;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.2");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.2");
try {
import2 = compFact.createComponentInstance(p);
} catch(Exception e) {
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
index f24a46c..985b834 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalImport.java
@@ -34,12 +34,12 @@
Factory fooProvider;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.3");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.3");
try {
import3 = compFact.createComponentInstance(p);
} catch(Exception e) {
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
index e00d1ec..4269ef5 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/OptionalMultipleImport.java
@@ -34,12 +34,12 @@
Factory fooProvider;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.4");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.4");
try {
import2 = compFact.createComponentInstance(p);
} catch(Exception e) {
diff --git a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
index 429bac0..897d6e7 100644
--- a/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
+++ b/ipojo/tests/composite/import-export/src/main/java/org/apache/felix/ipojo/test/composite/importer/SimpleImport.java
@@ -34,12 +34,12 @@
Factory fooProvider;
public void setUp() {
- fooProvider = Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
+ fooProvider = Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
assertNotNull("Check fooProvider availability", fooProvider);
Properties p = new Properties();
p.put("instance.name","importer");
- Factory compFact = Utils.getFactoryByName(context, "composite.requires.1");
+ Factory compFact = Utils.getFactoryByName(getContext(), "composite.requires.1");
try {
import1 = compFact.createComponentInstance(p);
} catch(Exception e) {
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/InstanceScopeTest.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/InstanceScopeTest.java
index 7067245..6634062 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/InstanceScopeTest.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/InstanceScopeTest.java
@@ -18,7 +18,7 @@
ComponentInstance instance;
public void setUp() {
- factory = (CompositeFactory) Utils.getFactoryByName(context, "SCOPE-scope");
+ factory = (CompositeFactory) Utils.getFactoryByName(getContext(), "SCOPE-scope");
assertNotNull("Factory", factory);
try {
instance = factory.createComponentInstance(null);
@@ -35,9 +35,9 @@
}
public void testScope() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", ref);
- Architecture arch = (Architecture) context.getService(ref);
+ Architecture arch = (Architecture) getContext().getService(ref);
assertTrue("Validity", arch.getInstanceDescription().getState() == ComponentInstance.VALID);
// Get internal service
@@ -53,12 +53,12 @@
}
public void testGlobalUnavailability() {
- ServiceReference ref2 = Utils.getServiceReference(context, Service.class.getName(), null);
+ ServiceReference ref2 = Utils.getServiceReference(getContext(), Service.class.getName(), null);
assertNull("Check Service unavailability", ref2);
}
public void testScopeUnvailability() {
- CompositeFactory factory2 = (CompositeFactory) Utils.getFactoryByName(context, "SCOPE-badscope");
+ CompositeFactory factory2 = (CompositeFactory) Utils.getFactoryByName(getContext(), "SCOPE-badscope");
assertNotNull("Factory", factory2);
ComponentInstance instance2 = null;
try {
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
index b194b36..f7e2cff 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
@@ -39,10 +39,10 @@
public void setUp() {
- fooFactory1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooProviderType-1");
- fooFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooProviderType-Dyn2");
- compoFactory = (ComponentFactory) Utils.getFactoryByName(context, "composite.inst.1");
- Factory fact = Utils.getFactoryByName(context, "composite.empty");
+ fooFactory1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-1");
+ fooFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooProviderType-Dyn2");
+ compoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.inst.1");
+ Factory fact = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty-X");
try {
@@ -192,9 +192,9 @@
} catch(Exception e) {
fail("Cannot instantiate under : " + e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, Architecture.class.getName(), "(architecture.instance=under)");
+ ServiceReference ref = Utils.getServiceReference(getContext(), Architecture.class.getName(), "(architecture.instance=under)");
assertNotNull("Check architecture availability", ref);
- Architecture arch = (Architecture) context.getService(ref);
+ Architecture arch = (Architecture) getContext().getService(ref);
InstanceDescription id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
@@ -204,15 +204,15 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReference(context, Architecture.class.getName(), "(architecture.instance=under)");
+ ref = Utils.getServiceReference(getContext(), Architecture.class.getName(), "(architecture.instance=under)");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -223,9 +223,9 @@
fact2.stop();
assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -236,9 +236,9 @@
fact3.stop();
assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID);
contained = id.getContainedInstances();
@@ -249,9 +249,9 @@
fact1.start();
assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
index 00f48b5..2f035ea 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/ConfigurableInstantiation.java
@@ -36,9 +36,9 @@
private ComponentFactory refuse2F;
public void setUp() {
- acceptF = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.5-accept");
- refuse1F = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.5-refuse1");
- refuse2F = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.5-refuse2");
+ acceptF = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.5-accept");
+ refuse1F = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.5-refuse1");
+ refuse2F = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.5-refuse2");
}
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
index 6974e4f..8b999e8 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
@@ -37,8 +37,8 @@
private ComponentInstance empty;
public void setUp() {
- bar2Factory = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.2");
- Factory fact = Utils.getFactoryByName(context, "composite.empty");
+ bar2Factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.2");
+ Factory fact = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
try {
@@ -128,9 +128,9 @@
ServiceContext sc = Utils.getServiceContext(under);
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -166,9 +166,9 @@
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
ServiceContext sc2 = Utils.getServiceContext(under);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -199,9 +199,9 @@
} catch(Exception e) {
fail("Cannot instantiate under : " + e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- Architecture arch = (Architecture) context.getService(ref);
+ Architecture arch = (Architecture) getContext().getService(ref);
InstanceDescription id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
@@ -211,15 +211,15 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -230,9 +230,9 @@
fact2.stop();
assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -243,9 +243,9 @@
fact3.stop();
assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID);
contained = id.getContainedInstances();
@@ -256,9 +256,9 @@
fact1.start();
assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -267,7 +267,7 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
- context.ungetService(ref);
+ getContext().ungetService(ref);
under.dispose();
fact2.start();
fact3.start();
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
index c6480b4..09cbd4b 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
@@ -37,8 +37,8 @@
private ComponentInstance empty;
public void setUp() {
- bar1Factory = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.3");
- Factory fact = Utils.getFactoryByName(context, "composite.empty");
+ bar1Factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.3");
+ Factory fact = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
try {
@@ -124,9 +124,9 @@
}
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -159,9 +159,9 @@
}
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -190,9 +190,9 @@
fail("Cannot instantiate under : " + e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- Architecture arch = (Architecture) context.getService(ref);
+ Architecture arch = (Architecture) getContext().getService(ref);
assertNotNull("Check architecture", arch);
InstanceDescription id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
@@ -203,16 +203,16 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -223,9 +223,9 @@
fact2.stop();
assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -236,9 +236,9 @@
fact3.stop();
assertTrue("Check instance invalidity", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -249,9 +249,9 @@
fact1.start();
assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -260,7 +260,7 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
- context.ungetService(ref);
+ getContext().ungetService(ref);
under.dispose();
fact2.start();
fact3.start();
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
index db7ecce..d27643e 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalMultipleInstantiation.java
@@ -34,10 +34,10 @@
private ComponentInstance empty;
public void setUp() {
- bar2Factory = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.4");
+ bar2Factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.4");
assertNotNull("Check bar2factory availability", bar2Factory);
- Factory fact = Utils.getFactoryByName(context, "composite.empty");
+ Factory fact = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty");
try {
@@ -127,9 +127,9 @@
ServiceContext sc = Utils.getServiceContext(under);
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -165,9 +165,9 @@
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
ServiceContext sc2 = Utils.getServiceContext(under);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
diff --git a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
index 0b2414f..193adaf 100644
--- a/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
+++ b/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
@@ -37,8 +37,8 @@
private ComponentInstance empty;
public void setUp() {
- bar1Factory = (ComponentFactory) Utils.getFactoryByName(context, "composite.bar.1");
- Factory fact = Utils.getFactoryByName(context, "composite.empty");
+ bar1Factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "composite.bar.1");
+ Factory fact = Utils.getFactoryByName(getContext(), "composite.empty");
Properties props = new Properties();
props.put("instance.name","empty-X");
try {
@@ -125,9 +125,9 @@
}
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
@@ -159,9 +159,9 @@
}
assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID);
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
@@ -189,9 +189,9 @@
} catch(Exception e) {
fail("Cannot instantiate under : " + e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- Architecture arch = (Architecture) context.getService(ref);
+ Architecture arch = (Architecture) getContext().getService(ref);
InstanceDescription id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
@@ -201,15 +201,15 @@
assertEquals("Check instance name" , id.getName(), "under");
assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
- ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-1");
- ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-2");
- ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(context, "COMPO-FooBarProviderType-3");
+ ComponentFactory fact1 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-1");
+ ComponentFactory fact2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-2");
+ ComponentFactory fact3 = (ComponentFactory) Utils.getFactoryByName(getContext(), "COMPO-FooBarProviderType-3");
fact1.stop();
assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -220,9 +220,9 @@
fact2.stop();
assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
@@ -233,9 +233,9 @@
fact3.stop();
assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID);
contained = id.getContainedInstances();
@@ -246,9 +246,9 @@
fact1.start();
assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID);
- ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
assertNotNull("Check architecture availability", ref);
- arch = (Architecture) context.getService(ref);
+ arch = (Architecture) getContext().getService(ref);
id = arch.getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
contained = id.getContainedInstances();
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java
index 8e96fc7..5e936b3 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp0.java
@@ -41,9 +41,9 @@
private ComponentInstance under;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -66,7 +66,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-0");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-0");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -96,20 +96,20 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
- assertNotNull("Assert toto service - 1", context.getServiceReference(Toto.class.getName()));
+ assertNotNull("Assert toto service - 1", getContext().getServiceReference(Toto.class.getName()));
assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -144,15 +144,15 @@
assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -187,19 +187,19 @@
assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -234,17 +234,17 @@
assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
totoProv.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java
index f59961a..17613fc 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp1.java
@@ -40,9 +40,9 @@
private ComponentFactory tataFactory2;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -66,7 +66,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-1");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-1");
Properties props2 = new Properties();
try {
under = factory.createComponentInstance(props2);
@@ -95,19 +95,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -142,15 +142,15 @@
assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -185,19 +185,19 @@
assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -232,17 +232,17 @@
assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), under.getInstanceName()));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), under.getInstanceName()));
totoProv.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), under.getInstanceName()));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), under.getInstanceName()));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java
index 3628c7a..43e79b7 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp2.java
@@ -40,9 +40,9 @@
private ComponentFactory tataFactory2;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -65,7 +65,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-2");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-2");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -95,19 +95,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
@@ -128,15 +128,15 @@
Integer tata = (Integer) props.get("tata");
assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -155,19 +155,19 @@
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -186,17 +186,17 @@
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 6", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
totoProv.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java
index 9d8445a..41703e5 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp3.java
@@ -40,9 +40,9 @@
private ComponentFactory tataFactory2;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -65,7 +65,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-3");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-3");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -95,19 +95,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -126,15 +126,15 @@
Integer tata = (Integer) props.get("tata");
assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
props = tota.getProps();
toto = (Integer) props.get("toto");
@@ -151,37 +151,37 @@
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Stop the factory
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
totoProv.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAllOpt(tota);
//Check tata
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
tataFactory.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java
index ea821a7..c5b65af 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp4.java
@@ -40,9 +40,9 @@
private ComponentFactory tataFactory2;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -65,7 +65,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-4");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-4");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -95,19 +95,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -125,15 +125,15 @@
props = tota.getPropsTata();
Integer tata = (Integer) props.get("tata");
assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
props = tota.getProps();
toto = (Integer) props.get("toto");
@@ -150,37 +150,37 @@
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Stop the factory
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
totoProv.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAllOpt(tota);
// Check tata
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 6", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
tataFactory.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java
index 33c3e3f..f01dc7a 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp5.java
@@ -40,9 +40,9 @@
private ComponentFactory tataFactory2;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
tataFactory.stop();
@@ -65,7 +65,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-5");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-5");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -96,19 +96,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -126,15 +126,15 @@
props = tota.getPropsTata();
Integer tata = (Integer) props.get("tata");
assertEquals("Assert tata - 3", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -152,37 +152,37 @@
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Stop the factory
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
totoProv.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAllOpt(tota);
//Check tata
props = tota.getPropsTata();
tata = (Integer) props.get("tata");
assertEquals("Assert tata - 6", tata.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
tataFactory.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java
index 08384d6..09edbc6 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp6.java
@@ -40,8 +40,8 @@
private ComponentInstance under;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
tataFactory.stop();
@@ -64,7 +64,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-6");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-6");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -93,28 +93,28 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- ServiceReference refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- ServiceReference refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ ServiceReference refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ ServiceReference refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNull("Assert no toto service - 1", refToto);
assertNull("Assert no tata service - 1", refTata);
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNull("Assert no toto service - 2", refToto);
assertNull("Assert no tata service - 2", refTata);
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNotNull("Assert toto service - 3", refToto);
assertNotNull("Assert tata service - 3", refTata);
- Toto toto = (Toto) context.getService(refToto);
- Tata tata = (Tata) context.getService(refTata);
+ Toto toto = (Toto) getContext().getService(refToto);
+ Tata tata = (Tata) getContext().getService(refTata);
invokeAll(tata);
invokeToto(toto);
@@ -136,21 +136,21 @@
Integer tata_0 = (Integer) props.get("tata");
assertEquals("Assert tata - 3", tata_0.intValue(), 1);
- context.ungetService(refToto);
- context.ungetService(refTata);
+ getContext().ungetService(refToto);
+ getContext().ungetService(refTata);
toto = null;
tata = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNotNull("Assert toto service - 4", refToto);
assertNotNull("Assert tata service - 4", refTata);
- toto = (Toto) context.getService(refToto);
- tata = (Tata) context.getService(refTata);
+ toto = (Toto) getContext().getService(refToto);
+ tata = (Tata) getContext().getService(refTata);
invokeAll(tata);
invokeToto(toto);
@@ -170,16 +170,16 @@
props = tata.getPropsTata();
tata_0 = (Integer) props.get("tata");
assertEquals("Assert tata - 4", tata_0.intValue(), 2);
- context.ungetService(refToto);
- context.ungetService(refTata);
+ getContext().ungetService(refToto);
+ getContext().ungetService(refTata);
toto = null;
tata = null;
// Stop the factory
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNull("Assert no toto service - 5", refToto);
assertNull("Assert no tata service - 5", refTata);
@@ -187,12 +187,12 @@
totoProv.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNotNull("Assert toto service - 6", refToto);
assertNotNull("Assert tata service - 6", refTata);
- toto = (Toto) context.getService(refToto);
- tata = (Tata) context.getService(refTata);
+ toto = (Toto) getContext().getService(refToto);
+ tata = (Tata) getContext().getService(refTata);
invokeAll(tata);
invokeTotoOpt(toto);
@@ -200,20 +200,20 @@
props = tata.getPropsTata();
tata_0 = (Integer) props.get("tata");
assertEquals("Assert tata - 6", tata_0.intValue(), 1);
- context.ungetService(refToto);
- context.ungetService(refTata);
+ getContext().ungetService(refToto);
+ getContext().ungetService(refTata);
toto = null;
tata = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
tataFactory.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- refToto = Utils.getServiceReferenceByName(context, Toto.class.getName(), "ff");
- refTata = Utils.getServiceReferenceByName(context, Tata.class.getName(), "ff");
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ refToto = Utils.getServiceReferenceByName(getContext(), Toto.class.getName(), "ff");
+ refTata = Utils.getServiceReferenceByName(getContext(), Tata.class.getName(), "ff");
assertNull("Assert no toto service - 7", refToto);
assertNull("Assert no tata service - 7", refTata);
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java
index 3df2b55..2e2a2ef 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp7.java
@@ -40,9 +40,9 @@
private ComponentInstance under;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
Properties props = new Properties();
@@ -64,7 +64,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-7");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-7");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -95,19 +95,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -141,15 +141,15 @@
assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -184,19 +184,19 @@
assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -230,17 +230,17 @@
assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
totoProv.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java
index d09cd89..c11f643 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/provides/TestComp8.java
@@ -41,9 +41,9 @@
private ComponentInstance under;
public void setUp() {
- tataFactory = (ComponentFactory) Utils.getFactoryByName(context, "tata");
- totoFactory = (ComponentFactory) Utils.getFactoryByName(context, "toto");
- tataFactory2 = (ComponentFactory) Utils.getFactoryByName(context, "comp-6");
+ tataFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "tata");
+ totoFactory = (ComponentFactory) Utils.getFactoryByName(getContext(), "toto");
+ tataFactory2 = (ComponentFactory) Utils.getFactoryByName(getContext(), "comp-6");
tataFactory2.stop();
Properties props = new Properties();
@@ -65,7 +65,7 @@
totoProv.stop();
totoProv2.stop();
- Factory factory = Utils.getFactoryByName(context, "comp-8");
+ Factory factory = Utils.getFactoryByName(getContext(), "comp-8");
Properties props2 = new Properties();
props2.put("instance.name","ff");
try {
@@ -101,19 +101,19 @@
public void testSimple() {
// Neither factory nor instance
assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 1", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName()));
// Start the importer
totoProv.start();
assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 2", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName()));
// Start the factory
tataFactory.start();
assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 3", context.getServiceReference(Tota.class.getName()));
- ServiceReference ref = context.getServiceReference(Tota.class.getName());
- Tota tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName()));
+ ServiceReference ref = getContext().getServiceReference(Tota.class.getName());
+ Tota tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
Properties props = tota.getProps();
@@ -155,15 +155,15 @@
assertEquals("Assert tata5 - 3", tata5.intValue(), 1);
assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Start a second import
totoProv2.start();
assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 4", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -206,19 +206,19 @@
assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2);
assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
tataFactory.stop();
assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID);
- assertNull("Assert no tota service - 5", context.getServiceReference(Tota.class.getName()));
+ assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName()));
totoProv2.stop();
tataFactory.start();
assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID);
- assertNotNull("Assert tota service - 6", context.getServiceReference(Tota.class.getName()));
- ref = context.getServiceReference(Tota.class.getName());
- tota = (Tota) context.getService(ref);
+ assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName()));
+ ref = getContext().getServiceReference(Tota.class.getName());
+ tota = (Tota) getContext().getService(ref);
invokeAll(tota);
// Check toto
props = tota.getProps();
@@ -260,17 +260,17 @@
assertEquals("Assert tata5 - 6", tata5.intValue(), 1);
assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1);
assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1);
- context.ungetService(ref);
+ getContext().ungetService(ref);
tota = null;
// Is arch exposed
- assertNotNull("Test arch", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
+ assertNotNull("Test arch", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
totoProv.stop();
assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID);
- assertNotNull("Test arch-2", Utils.getServiceReferenceByName(context, Architecture.class.getName(), "ff"));
- assertNull("Assert no tota service - 7", context.getServiceReference(Tota.class.getName()));
+ assertNotNull("Test arch-2", Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "ff"));
+ assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName()));
under.dispose();
under = null;
diff --git a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java
index 7ee1868..4f90fad 100644
--- a/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java
+++ b/ipojo/tests/composite/service-providing/src/main/java/org/apache/felix/ipojo/test/composite/test/CompositeTest.java
@@ -34,7 +34,7 @@
public class CompositeTest extends OSGiTestCase {
public void testAPI() {
- Factory fact1 = Utils.getFactoryByName(context, "composite.empty");
+ Factory fact1 = Utils.getFactoryByName(getContext(), "composite.empty");
Properties p = new Properties();
p.put("instance.name","empty-1");
ComponentInstance empty = null;
@@ -47,10 +47,10 @@
ServiceContext sc = Utils.getServiceContext(empty);
- Factory fact2 = Utils.getFactoryByName(context, "composite.test.2");
+ Factory fact2 = Utils.getFactoryByName(getContext(), "composite.test.2");
Properties props2 = new Properties();
props2.put("instance.name","2"); // 2
- Factory fact3 = Utils.getFactoryByName(context, "composite.test.3");
+ Factory fact3 = Utils.getFactoryByName(getContext(), "composite.test.3");
Properties props3 = new Properties();
props3.put("instance.name","3");
ComponentInstance comp2 = null;
@@ -81,7 +81,7 @@
public void testInstantiator() {
String type = "composite.instantiator";
- Factory fact = Utils.getFactoryByName(context, type);
+ Factory fact = Utils.getFactoryByName(getContext(), type);
ComponentInstance ci = null;
Properties p = new Properties();
p.put("instance.name","mon_coeur");
@@ -92,21 +92,21 @@
}
assertTrue("Check ci", ci.getState() == ComponentInstance.VALID);
- ServiceReference ref = Utils.getServiceReferenceByName(context, BazService.class.getName(), "mon_coeur");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), BazService.class.getName(), "mon_coeur");
assertNotNull("Check ref",ref);
- BazService bs = (BazService) context.getService(ref);
+ BazService bs = (BazService) getContext().getService(ref);
assertTrue("Check invocation", bs.foo());
- context.ungetService(ref);
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "mon_coeur");
+ getContext().ungetService(ref);
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "mon_coeur");
assertNotNull("Check ref 2 ",ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
assertTrue("Check invocation", fs.foo());
- context.ungetService(ref);
+ getContext().ungetService(ref);
ci.dispose();
}
public void testAPI2() {
- Factory fact1 = Utils.getFactoryByName(context, "composite.empty");
+ Factory fact1 = Utils.getFactoryByName(getContext(), "composite.empty");
Properties p = new Properties();
p.put("instance.name","empty-2");
ComponentInstance empty = null;
@@ -151,7 +151,7 @@
public void testApplication() {
- Factory factory = Utils.getFactoryByName(context, "composite.test.1");
+ Factory factory = Utils.getFactoryByName(getContext(), "composite.test.1");
ComponentInstance ci = null;
Properties props = new Properties();
props.put("instance.name","Test");
@@ -165,12 +165,12 @@
ServiceReference[] refs = null;
try {
- refs = context.getServiceReferences(CheckService.class.getName(), "(instance.name=Test)");
+ refs = getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=Test)");
} catch (InvalidSyntaxException e) {
fail("Invalid filter : " + e.getMessage());
}
assertNotNull("Check refs not null", refs);
- CheckService cs = (CheckService) context.getService(refs[0]);
+ CheckService cs = (CheckService) getContext().getService(refs[0]);
assertTrue("Check invocation", cs.check());
ci.dispose();
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java
index f51485a..5aa2568 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/AggregateDependency.java
@@ -1,15 +1,18 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class AggregateDependency extends OSGiTestCase {
- private Element[] deps ;
+ private Element[] deps;
+
+ private IPOJOHelper helper;
public void setUp() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.AggregateDependency");
+ helper = new IPOJOHelper(this);
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.AggregateDependency");
deps = meta.getElements("requires");
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java
index c4ca4fb..9996972 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Architecture.java
@@ -1,20 +1,28 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class Architecture extends OSGiTestCase {
+
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
+
public void testArch() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Arch");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Arch");
String arch = meta.getAttribute("architecture");
assertNotNull("Architecture exists ", arch);
assertEquals("Architecture value", "true", arch);
}
public void testNoArch() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoArch");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NoArch");
String arch = meta.getAttribute("architecture");
assertNotNull("Architecture exists ", arch);
assertEquals("Architecture value", "false", arch);
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java
index a939d95..ddeea7d 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Dependency.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class Dependency extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testDependencyDeclaration() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Dependency");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Dependency");
Element[] deps = meta.getElements("requires");
// Check fs
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/EventAdmin.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/EventAdmin.java
index cc61cc3..bb93202 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/EventAdmin.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/EventAdmin.java
@@ -1,17 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class EventAdmin extends OSGiTestCase {
String type = "org.apache.felix.ipojo.test.scenarios.component.event.PubSub";
String namespace = "org.apache.felix.ipojo.handlers.event";
Element component;
+ private IPOJOHelper helper;
public void setUp() {
- component = Utils.getMetatadata(context, type);
+ helper = new IPOJOHelper(this);
+ component = helper.getMetadata(type);
assertNotNull("Check component", component);
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Extender.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Extender.java
index 28e9661..9f8a418 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Extender.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Extender.java
@@ -1,17 +1,22 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class Extender extends OSGiTestCase {
String type = "org.apache.felix.ipojo.test.scenarios.component.extender.Extender";
String namespace = "org.apache.felix.ipojo.extender";
-
+
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
public void testMetadata() {
- Element meta = Utils.getMetatadata(context, type);
+ Element meta = helper.getMetadata(type);
assertNotNull("Check meta", meta);
Element[] ext = meta.getElements("extender", namespace);
assertEquals("Check size", 1, ext.length);
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
index 0283992..d0d44a0 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class Factory extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testArch() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Factory");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Factory");
String fact = meta.getAttribute("public");
String name = meta.getAttribute("name");
assertNotNull("Factory exists ", fact);
@@ -17,7 +23,7 @@
}
public void testNoArch() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoFactory");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NoFactory");
String fact = meta.getAttribute("public");
String name = meta.getAttribute("name");
assertNotNull("Factory exists ", fact);
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java
index 52e85ae..8db422c 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/FilteredDependency.java
@@ -1,19 +1,21 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class FilteredDependency extends OSGiTestCase {
private Element[] deps ;
private Element[] froms;
+ private IPOJOHelper helper;
public void setUp() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.FilteredDependency");
+ helper = new IPOJOHelper(this);
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.FilteredDependency");
deps = meta.getElements("requires");
- Element meta2 = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.FromDependency");
+ Element meta2 = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.FromDependency");
froms = meta2.getElements("requires");
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/JMX.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/JMX.java
index 656d987..4e07d29 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/JMX.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/JMX.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class JMX extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testSimple() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.jmx.JMXSimple");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.jmx.JMXSimple");
/*
* org.apache.felix.ipojo.handlers.jmx:config domain="my-domain" usesmosgi="false"
org.apache.felix.ipojo.handlers.jmx:property field="m_foo" name="prop" rights="w" notification="true"
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java
index d1e8ea6..554de91 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleCallbacks.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class LifecycleCallbacks extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testCallbacks() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
Element[] cbs = meta.getElements("callback");
assertNotNull("Callbacks exists ", cbs);
assertEquals("Callbacks count ", 2, cbs.length);
@@ -22,13 +28,13 @@
}
public void testImmediate() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Immediate");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Immediate");
assertNotNull("Immediate attribute", meta.getAttribute("immediate"));
assertEquals("Immediate attribute value", "true", meta.getAttribute("immediate"));
}
public void testNoImmediate() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoImmediate");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NoImmediate");
assertNotNull("Immediate attribute", meta.getAttribute("immediate"));
assertEquals("Immediate attribute value", "false", meta.getAttribute("immediate"));
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java
index 06ac132..95a60ac 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/LifecycleController.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class LifecycleController extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testLFC() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Lifecycle");
Element[] ctrls = meta.getElements("controller");
assertNotNull("Controller exists ", ctrls);
Element ctrl = ctrls[0];
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java
index 0466402..7e9b970 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/OptionalDependency.java
@@ -1,16 +1,18 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.test.scenarios.component.ProvidesSimple;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class OptionalDependency extends OSGiTestCase {
private Element[] deps ;
+ private IPOJOHelper helper;
public void setUp() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.OptionalDependency");
+ helper = new IPOJOHelper(this);
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.OptionalDependency");
deps = meta.getElements("requires");
}
@@ -57,7 +59,7 @@
}
public void testNullable() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
Element[] deps = meta.getElements("requires");
Element fs = getDependencyById(deps, "fs");
String nullable = fs.getAttribute("nullable");
@@ -66,7 +68,7 @@
}
public void testNoNullable() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NullableDependency");
Element[] deps = meta.getElements("requires");
Element fs = getDependencyById(deps, "fs2");
String nullable = fs.getAttribute("nullable");
@@ -75,7 +77,7 @@
}
public void testDefaultImplmentation() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.DefaultImplementationDependency");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.DefaultImplementationDependency");
Element[] deps = meta.getElements("requires");
Element fs = getDependencyById(deps, "fs");
String di = fs.getAttribute("default-implementation");
@@ -99,25 +101,5 @@
fail("Dependency " + name + " not found");
return null;
}
-
- private String getBind(Element dep) {
- Element[] elem = dep.getElements("callback");
- for (int i = 0; elem != null && i < elem.length; i++) {
- if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
- return elem[i].getAttribute("method");
- }
- }
- return null;
- }
-
- private String getUnbind(Element dep) {
- Element[] elem = dep.getElements("callback");
- for (int i = 0; elem != null && i < elem.length; i++) {
- if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
- return elem[i].getAttribute("method");
- }
- }
- return null;
- }
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java
index 3dd0b13..0850190 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/PolicyDependency.java
@@ -1,15 +1,17 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class PolicyDependency extends OSGiTestCase {
private Element[] deps ;
+ private IPOJOHelper helper;
public void setUp() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PolicyDependency");
+ helper = new IPOJOHelper(this);
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.PolicyDependency");
deps = meta.getElements("requires");
}
@@ -71,25 +73,5 @@
fail("Dependency " + name + " not found");
return null;
}
-
- private String getBind(Element dep) {
- Element[] elem = dep.getElements("callback");
- for (int i = 0; elem != null && i < elem.length; i++) {
- if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) {
- return elem[i].getAttribute("method");
- }
- }
- return null;
- }
-
- private String getUnbind(Element dep) {
- Element[] elem = dep.getElements("callback");
- for (int i = 0; elem != null && i < elem.length; i++) {
- if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) {
- return elem[i].getAttribute("method");
- }
- }
- return null;
- }
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java
index c9d5a99..77fa697 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Properties.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class Properties extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testProperties() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Properties");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -40,7 +46,7 @@
}
public void testAbsentPropagation() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Properties");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -49,7 +55,7 @@
}
public void testPropagation() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Propagation");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Propagation");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -59,7 +65,7 @@
}
public void testNoPropagation() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.NoPropagation");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.NoPropagation");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -69,7 +75,7 @@
}
public void testPID() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ManagedServicePID");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ManagedServicePID");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -79,7 +85,7 @@
}
public void testAbsentPID() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.Properties");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Properties");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -88,7 +94,7 @@
}
public void testPropagationAndPID() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PropagationandPID");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.PropagationandPID");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
@@ -101,7 +107,7 @@
}
public void testPIDAndPropagation() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.PIDandPropagation");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.PIDandPropagation");
Element[] provs = meta.getElements("properties");
assertNotNull("Properties exists ", provs);
Element prov = provs[0];
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java
index 228bce7..6ddb3fa 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/RankedDependency.java
@@ -1,16 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.test.scenarios.component.MyComparator;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class RankedDependency extends OSGiTestCase {
private Element[] deps ;
+ private IPOJOHelper helper;
+
public void setUp() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.RankedDependency");
+ helper = new IPOJOHelper(this);
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.RankedDependency");
deps = meta.getElements("requires");
}
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
index 9bf7719..2b14b69 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/ServiceProdiving.java
@@ -3,30 +3,34 @@
import java.util.List;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
import org.apache.felix.ipojo.parser.ParseUtils;
import org.apache.felix.ipojo.test.scenarios.annotations.service.CheckService;
import org.apache.felix.ipojo.test.scenarios.annotations.service.FooService;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class ServiceProdiving extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testProvidesSimple() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesSimple");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ProvidesSimple");
Element[] provs = meta.getElements("provides");
assertNotNull("Provides exists ", provs);
- Element prov = provs[0];
}
public void testProvidesDouble() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesDouble");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ProvidesDouble");
Element[] provs = meta.getElements("provides");
assertNotNull("Provides exists ", provs);
- Element prov = provs[0];
}
public void testProvidesTriple() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesTriple");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ProvidesTriple");
Element[] provs = meta.getElements("provides");
assertNotNull("Provides exists ", provs);
Element prov = provs[0];
@@ -36,7 +40,7 @@
}
public void testProvidesQuatro() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesQuatro");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ProvidesQuatro");
Element[] provs = meta.getElements("provides");
assertNotNull("Provides exists ", provs);
Element prov = provs[0];
@@ -47,7 +51,7 @@
}
public void testProperties() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.ProvidesProperties");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ProvidesProperties");
Element[] provs = meta.getElements("provides");
assertNotNull("Provides exists ", provs);
Element prov = provs[0];
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/TemporalDependencies.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/TemporalDependencies.java
index db1b416..3d692df 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/TemporalDependencies.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/TemporalDependencies.java
@@ -1,13 +1,19 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class TemporalDependencies extends OSGiTestCase {
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testSimple() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalSimple");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalSimple");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -20,7 +26,7 @@
}
public void testDI() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithDI");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithDI");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -33,7 +39,7 @@
}
public void testEmptyArray() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithEmptyArray");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithEmptyArray");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -46,7 +52,7 @@
}
public void testNull() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithNull");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithNull");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -59,7 +65,7 @@
}
public void testNullable() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithNullable");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithNullable");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -72,7 +78,7 @@
}
public void testFilter() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithFilter");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithFilter");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
@@ -85,7 +91,7 @@
}
public void testTimeout() {
- Element meta = Utils.getMetatadata(context, "org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithTimeout");
+ Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.temporal.TemporalWithTimeout");
Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal");
assertNotNull("Temporal exists ", provs);
String field = provs[0].getAttribute("field");
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/WhiteBoard.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/WhiteBoard.java
index 4f9022a..b2e38d0 100644
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/WhiteBoard.java
+++ b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/WhiteBoard.java
@@ -1,8 +1,8 @@
package org.apache.felix.ipojo.test.scenarios.annotations;
import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.test.scenarios.util.Utils;
public class WhiteBoard extends OSGiTestCase {
@@ -10,8 +10,14 @@
String typeWO = "org.apache.felix.ipojo.test.scenarios.component.whiteboard.WhiteBoardWOModification";
String namespace = "org.apache.felix.ipojo.whiteboard";
+ private IPOJOHelper helper;
+
+ public void setUp() {
+ helper = new IPOJOHelper(this);
+ }
+
public void testMetadataWithOnModification() {
- Element meta = Utils.getMetatadata(context, typeWI);
+ Element meta = helper.getMetadata(typeWI);
assertNotNull("Check meta", meta);
Element[] ext = meta.getElements("wbp", namespace);
assertEquals("Check size", 1, ext.length);
@@ -29,7 +35,7 @@
}
public void testMetadataWithoutOnModification() {
- Element meta = Utils.getMetatadata(context, typeWO);
+ Element meta = helper.getMetadata(typeWO);
assertNotNull("Check meta", meta);
Element[] ext = meta.getElements("wbp", namespace);
assertEquals("Check size", 1, ext.length);
diff --git a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java b/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
deleted file mode 100644
index f64adb7..0000000
--- a/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.ipojo.test.scenarios.util;
-
-import java.util.Dictionary;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-public class Utils {
-
- public static Element getMetatadata(BundleContext bc, String component) {
- String elem = (String) bc.getBundle().getHeaders().get("iPOJO-Components");
- Assert.assertNotNull("iPOJO Components exists", elem);
- try {
- Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
- Element[] childs = element.getElements("component");
- for (int i = 0; i < childs.length; i++) {
- String name = childs[i].getAttribute("name");
- String clazz = childs[i].getAttribute("classname");
- if (name != null && name.equalsIgnoreCase(component)) {
- return childs[i];
- }
- if (clazz.equalsIgnoreCase(component)) {
- return childs[i];
- }
- }
- Assert.fail("Component " + component + " not found in " + bc.getBundle().getSymbolicName());
- } catch (ParseException e) {
- Assert.fail("Cannot parse the components from " + bc.getBundle().getSymbolicName() + ": " + e.getMessage());
- }
-
- return null;
-
- }
-
- public static Factory getFactoryByName(BundleContext bc, String factoryName) {
- ServiceReference[] refs;
- try {
- refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
- if (refs == null) {
- System.err.println("Cannot get the factory " + factoryName);
- return null;
- }
- return ((Factory) bc.getService(refs[0]));
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
- return null;
- }
- }
-
- public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName) {
- ServiceReference[] refs;
- try {
- refs = bc.getServiceReferences(HandlerFactory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName + ")");
- if (refs == null) {
- System.err.println("Cannot get the factory " + factoryName);
- return null;
- }
- return (HandlerFactory) bc.getService(refs[0]);
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
- return null;
- }
- }
-
- public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
- Factory fact = getFactoryByName(bc, factoryName);
-
- if (fact == null) {
- System.err.println("Factory " + factoryName + " not found");
- return null;
- }
-
- // if(fact.isAcceptable(configuration)) {
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- e.printStackTrace();
- Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
- return null;
- }
- // }
- // else {
- // System.err.println("Configuration not accepted by : " + factoryName);
- // return null;
- // }
- }
-
- public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
- Factory fact = getFactoryByName(bc, factoryName);
-
- if (fact == null) {
- System.err.println("Factory " + factoryName + " not found");
- return null;
- }
-
- try {
- Properties props = new Properties();
- props.put("instance.name",name);
- return fact.createComponentInstance(props);
- } catch (Exception e) {
- System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
- e.printStackTrace();
- return null;
- }
- }
-
- public static ServiceReference[] getServiceReferences(BundleContext bc, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- public static ServiceReference getServiceReference(BundleContext bc, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return null;
- } else {
- return refs[0];
- }
- }
-
- public static ServiceReference getServiceReferenceByName(BundleContext bc, String itf, String name) {
- ServiceReference[] refs = null;
- String filter = null;
- if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return null;
- } else {
- return refs[0];
- }
- }
-
- public static ServiceReference getServiceReferenceByPID(BundleContext bc, String itf, String pid) {
- ServiceReference[] refs = null;
- String filter = "(" + "service.pid" + "=" + pid + ")";
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- Assert.fail("A service lookup by PID returned several providers (" + refs.length + ")" + " for " + itf + " with " + pid);
- return null;
- }
- }
-
- public static Object getServiceObject(BundleContext bc, String itf, String filter) {
- ServiceReference ref = getServiceReference(bc, itf, filter);
- if (ref != null) {
- return bc.getService(ref);
- } else {
- return null;
- }
- }
-
- public static Object[] getServiceObjects(BundleContext bc, String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(bc, itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = bc.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
-// public static ServiceContext getServiceContext(ComponentInstance ci) {
-// if (ci instanceof CompositeManager) {
-// return ((CompositeManager) ci).getServiceContext();
-// } else {
-// throw new RuntimeException("Cannot get the service context form an non composite instance");
-// }
-// }
-
- public static Factory getFactoryByName(ServiceContext bc, String factoryName) {
- ServiceReference[] refs;
- try {
- refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
- if (refs == null) { return null; }
- return ((Factory) bc.getService(refs[0]));
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
- return null;
- }
- }
-
- public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
- Factory fact = getFactoryByName(bc, factoryName);
-
- if (fact == null) { return null; }
-
- if (fact.isAcceptable(configuration)) {
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- System.err.println(e.getMessage());
- e.printStackTrace();
- return null;
- }
- } else {
- System.err.println("Configuration not accepted by : " + factoryName);
- return null;
- }
- }
-
- public static ServiceReference[] getServiceReferences(ServiceContext bc, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- public static ServiceReference getServiceReference(ServiceContext bc, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return null;
- } else {
- return refs[0];
- }
- }
-
- public static ServiceReference getServiceReferenceByName(ServiceContext bc, String itf, String name) {
- ServiceReference[] refs = null;
- String filter = null;
- if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- try {
- refs = bc.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- System.err.println("Invalid Filter : " + filter);
- }
- if (refs == null) {
- return null;
- } else {
- return refs[0];
- }
- }
-
- public static Object getServiceObject(ServiceContext bc, String itf, String filter) {
- ServiceReference ref = getServiceReference(bc, itf, filter);
- if (ref != null) {
- return bc.getService(ref);
- } else {
- return null;
- }
- }
-
- public static Object[] getServiceObjects(ServiceContext bc, String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(bc, itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = bc.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- public static boolean contains(String string, String[] array) {
- for (int i = 0; array != null && i < array.length; i++) {
- if (array[i] != null && array[i].equals(string)) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean contains(int value, int[] array) {
- for (int i = 0; array != null && i < array.length; i++) {
- if (array[i] == value) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
index 3421eee..16c5d34 100644
--- a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
+++ b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
@@ -50,7 +50,7 @@
public void testBadFactory() {
try {
- new ComponentFactory(context, getElementFactoryWithNoClassName());
+ new ComponentFactory(getContext(), getElementFactoryWithNoClassName());
fail("A factory with no class name must be rejected");
} catch (ConfigurationException e) {
// OK.
@@ -59,7 +59,7 @@
public void testBadHandlerFactory1() {
try {
- new HandlerManagerFactory(context, getElementHandlerFactoryWithNoClassName());
+ new HandlerManagerFactory(getContext(), getElementHandlerFactoryWithNoClassName());
fail("An handler factory with no class name must be rejected");
} catch (ConfigurationException e) {
// OK.
@@ -68,7 +68,7 @@
public void testBadHandlerFactory2() {
try {
- new HandlerManagerFactory(context, getElementHandlerFactoryWithNoName());
+ new HandlerManagerFactory(getContext(), getElementHandlerFactoryWithNoName());
fail("An handler factory with no name must be rejected");
} catch (ConfigurationException e) {
// OK.
@@ -76,7 +76,7 @@
}
public void testCreationOnBadConstructor() {
- Factory factory = Utils.getFactoryByName(context, "BAD-BadConstructor");
+ Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadConstructor");
ComponentInstance ci;
try {
ci = factory.createComponentInstance(null);
@@ -88,7 +88,7 @@
}
public void testCreationOnBadFactory() {
- Factory factory = Utils.getFactoryByName(context, "BAD-BadFactory");
+ Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadFactory");
ComponentInstance ci;
try {
ci = factory.createComponentInstance(null);
@@ -100,7 +100,7 @@
}
public void testCreationOnBadFactory2() {
- Factory factory = Utils.getFactoryByName(context, "BAD-BadFactory2");
+ Factory factory = Utils.getFactoryByName(getContext(), "BAD-BadFactory2");
ComponentInstance ci;
try {
ci = factory.createComponentInstance(null);
@@ -115,7 +115,7 @@
Element elem = new Element("component", "");
elem.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"));
try {
- ComponentFactory fact = new ComponentFactory(context, elem);
+ ComponentFactory fact = new ComponentFactory(getContext(), elem);
fact.stop();
fail("A factory with no manipulation metadata must be rejected");
} catch (ConfigurationException e) {
diff --git a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCCallback.java b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCCallback.java
index 54fd891..2749e30 100644
--- a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCCallback.java
+++ b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCCallback.java
@@ -114,7 +114,7 @@
}
private Element getManipulationForComponent() {
- String header = (String) context.getBundle().getHeaders().get("iPOJO-Components");
+ String header = (String) getContext().getBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
@@ -144,7 +144,7 @@
public void testNothing() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNothing());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNothing());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -161,7 +161,7 @@
public void testNoTransition() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNoTransition());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNoTransition());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -178,7 +178,7 @@
public void testNoMethod() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNoMethod());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNoMethod());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -195,7 +195,7 @@
public void testBadMethod() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadMethod());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadMethod());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
if (ci.isStarted()) {
@@ -215,7 +215,7 @@
public void testBadMethod2() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadMethod2());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadMethod2());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.stop();
@@ -236,7 +236,7 @@
public void testBadTransition() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadTransition());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadTransition());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
diff --git a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCController.java b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCController.java
index cc72b98..3089aa3 100644
--- a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCController.java
+++ b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadLFCController.java
@@ -50,7 +50,7 @@
}
private Element getManipulationForComponent(String comp_name) {
- String header = (String) context.getBundle().getHeaders().get("iPOJO-Components");
+ String header = (String) getContext().getBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parseHeaderMetadata(header);
@@ -77,7 +77,7 @@
public void testNoField() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNoFieldController());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNoFieldController());
cf.start();
cf.stop();
fail("A lifecycle controller with a missing field must be rejected " + cf);
@@ -88,7 +88,7 @@
public void testBadField() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadFieldController());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadFieldController());
cf.start();
cf.stop();
fail("A lifecycle controller with a bad field must be rejected " + cf);
diff --git a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadServiceDependencies.java b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadServiceDependencies.java
index e0f6333..63bcc87 100644
--- a/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadServiceDependencies.java
+++ b/ipojo/tests/core/bad-configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadServiceDependencies.java
@@ -128,7 +128,7 @@
private Element getManipulationForComponent() {
- String header = (String) context.getBundle().getHeaders().get("iPOJO-Components");
+ String header = (String) getContext().getBundle().getHeaders().get("iPOJO-Components");
Element elem = null;
try {
elem = ManifestMetadataParser.parse(header);
@@ -158,7 +158,7 @@
public void testNothing() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNothing());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNothing());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -175,7 +175,7 @@
public void testNoField() {
try {
- ComponentFactory cf = new ComponentFactory(context, getNoField());
+ ComponentFactory cf = new ComponentFactory(getContext(), getNoField());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -192,7 +192,7 @@
public void testBadField() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadField());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadField());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -209,7 +209,7 @@
public void testBadFilter() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadFilter());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadFilter());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -226,7 +226,7 @@
public void testBadFrom() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadFrom());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadFrom());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
@@ -243,7 +243,7 @@
public void testBadType() {
try {
- ComponentFactory cf = new ComponentFactory(context, getBadType());
+ ComponentFactory cf = new ComponentFactory(getContext(), getBadType());
cf.start();
ComponentInstance ci = cf.createComponentInstance(props);
ci.dispose();
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
index 5b0d798..d912e17 100644
--- a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
@@ -20,8 +20,8 @@
private ConfigurationAdmin admin;
public void setUp() {
- factory = (ComponentFactory) Utils.getFactoryByName(context, "CA-ImmConfigurableProvider");
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "CA-ImmConfigurableProvider");
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
try {
Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ImmConfigurableProvider)");
@@ -77,16 +77,16 @@
String pid = configuration.getPid();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -101,11 +101,11 @@
fail(e.getMessage());
}
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -118,7 +118,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -146,8 +146,8 @@
System.out.println("PID : " + pid);
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -160,16 +160,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object -2", 1, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -182,7 +182,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -208,22 +208,22 @@
String pid = configuration.getPid();
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -238,11 +238,11 @@
fail(e.getMessage());
}
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
//assertEquals("Assert count", 2, count);
@@ -256,7 +256,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -283,14 +283,14 @@
String pid = configuration.getPid();
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -303,16 +303,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check object -1", 1, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -325,7 +325,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
index 867f66f..4ad16d7 100644
--- a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
@@ -20,8 +20,8 @@
private ConfigurationAdmin admin;
public void setUp() {
- factory = (ComponentFactory) Utils.getFactoryByName(context, "CA-ConfigurableProvider");
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "CA-ConfigurableProvider");
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
try {
Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ConfigurableProvider)");
@@ -78,16 +78,16 @@
System.out.println("PID : " + pid);
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -102,11 +102,11 @@
fail(e.getMessage());
}
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -119,7 +119,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -146,8 +146,8 @@
String pid = configuration.getPid();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -160,16 +160,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 1, count);
@@ -182,7 +182,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -208,22 +208,22 @@
String pid = configuration.getPid();
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -242,11 +242,11 @@
System.out.println("===");
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -259,7 +259,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -287,14 +287,14 @@
String pid = configuration.getPid();
System.out.println("PID : " + pid);
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -307,16 +307,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 1, count);
@@ -329,7 +329,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
index 1027afc..c050b16 100644
--- a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
@@ -28,11 +28,11 @@
public void setUp() {
- factImm = (ComponentFactory) Utils.getFactoryByName(context, factNameImm);
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factImm = (ComponentFactory) Utils.getFactoryByName(getContext(), factNameImm);
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
cleanConfigurationAdmin();
- listener = new ConfigurationMonitor(context);
+ listener = new ConfigurationMonitor(getContext());
}
public void tearDown() {
@@ -67,11 +67,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -95,11 +95,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -128,14 +128,14 @@
}
- Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ Architecture arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- FooService fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -159,13 +159,13 @@
fail(e.getMessage());
}
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -210,11 +210,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
// int count1 = ((Integer) p.get("count")).intValue();
@@ -250,11 +250,11 @@
} catch (Exception e) {
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
// int count = ((Integer) p.get("count")).intValue();
@@ -296,11 +296,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
// int count = ((Integer) p.get("count")).intValue();
@@ -336,11 +336,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
// count = ((Integer) p.get("count")).intValue();
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
index 1b39dc4..043c84d 100644
--- a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
@@ -28,11 +28,11 @@
public void setUp() {
- factSvc = (ComponentFactory) Utils.getFactoryByName(context, factNameSvc);
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factSvc = (ComponentFactory) Utils.getFactoryByName(getContext(), factNameSvc);
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
cleanConfigurationAdmin();
- listener = new ConfigurationMonitor(context);
+ listener = new ConfigurationMonitor(getContext());
}
public void tearDown() {
@@ -67,11 +67,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -94,11 +94,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -127,14 +127,14 @@
}
- Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ Architecture arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check no object", 0, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- FooService fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -157,13 +157,13 @@
fail(e.getMessage());
}
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -208,11 +208,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -248,11 +248,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -294,11 +294,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -334,11 +334,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java
index 52f734a..4610f9d 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java
@@ -40,12 +40,12 @@
p1.put("foo", "foo");
p1.put("bar", "2");
p1.put("baz", "baz");
- instance = Utils.getComponentInstance(context, type, p1);
+ instance = Utils.getComponentInstance(getContext(), type, p1);
Properties p2 = new Properties();
p2.put("instance.name","instance2");
- instance2 = Utils.getComponentInstance(context, type, p2);
+ instance2 = Utils.getComponentInstance(getContext(), type, p2);
}
public void tearDown() {
@@ -56,7 +56,7 @@
}
public void testStatic() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -65,7 +65,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
@@ -74,24 +74,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testStaticNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
Object barP = fooRef.getProperty("bar");
@@ -100,7 +100,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
@@ -109,24 +109,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testDynamic() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -137,7 +137,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -145,13 +145,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -161,7 +161,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -169,12 +169,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -184,7 +184,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -192,13 +192,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -208,7 +208,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -216,13 +216,13 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicString() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -233,7 +233,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -241,13 +241,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", "0");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -257,7 +257,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -265,12 +265,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testPropagation() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -281,7 +281,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -291,13 +291,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -312,11 +312,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -326,7 +326,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -336,13 +336,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -357,7 +357,7 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
}
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java
index 639ea4b..754d33a 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java
@@ -52,7 +52,7 @@
p.put("foo", "foo");
p.put("bar", "2");
p.put("baz", "baz");
- instance1 = Utils.getComponentInstance(context, type, p);
+ instance1 = Utils.getComponentInstance(getContext(), type, p);
assertEquals("instance1 created", ComponentInstance.VALID,instance1.getState());
type = "CONFIG-FooProviderType-3";
@@ -62,13 +62,13 @@
p1.put("bar", "2");
p1.put("baz", "baz");
p1.put("managed.service.pid", "instance");
- instance2 = Utils.getComponentInstance(context, type, p1);
+ instance2 = Utils.getComponentInstance(getContext(), type, p1);
type = "CONFIG-FooProviderType-3";
Properties p2 = new Properties();
p2.put("instance.name","instance-3");
p2.put("managed.service.pid", "instance-3");
- instance3 = Utils.getComponentInstance(context, type, p2);
+ instance3 = Utils.getComponentInstance(getContext(), type, p2);
}
public void tearDown() {
@@ -81,7 +81,7 @@
}
public void testStaticInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -90,7 +90,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -98,24 +98,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Re-check props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testStaticInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -124,7 +124,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
@@ -133,25 +133,25 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testStaticInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
Object barP = fooRef.getProperty("bar");
@@ -161,7 +161,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedService availability", msRef);
@@ -170,25 +170,25 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -199,7 +199,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -207,13 +207,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Re-check props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -223,7 +223,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -231,12 +231,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -247,7 +247,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -255,13 +255,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -271,7 +271,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -279,12 +279,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -295,7 +295,7 @@
assertEquals("Check bar equality", barP, null);
assertEquals("Check baz equality", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -303,13 +303,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -319,7 +319,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -327,13 +327,13 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicStringInstance1() {
assertEquals("Check instance1 state", ComponentInstance.VALID,instance1.getState());
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -344,7 +344,7 @@
assertEquals("Check bar equality - 1", barP, new Integer(2));
assertEquals("Check baz equality - 1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -353,7 +353,7 @@
conf.put("foo", "oof");
conf.put("bar", "0");
assertEquals("Check instance1 state (2)", ComponentInstance.VALID,instance1.getState());
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
PrimitiveHandler ph = (PrimitiveHandler) ms;
assertSame("Check the correct instance", ph.getInstanceManager(), instance1);
@@ -364,7 +364,7 @@
assertEquals("Check instance1 state (3)", ComponentInstance.VALID,instance1.getState());
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -374,7 +374,7 @@
assertEquals("Check baz equality - 2", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -382,12 +382,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicStringInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -398,7 +398,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -406,13 +406,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", "0");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -422,7 +422,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -430,12 +430,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -446,7 +446,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -456,13 +456,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -477,11 +477,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -492,7 +492,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -502,13 +502,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -523,11 +523,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -538,7 +538,7 @@
assertEquals("Check bar equality", barP, null);
assertEquals("Check baz equality", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -548,13 +548,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -569,7 +569,7 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
}
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java
index 982ff42..9803664 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java
@@ -37,7 +37,7 @@
Properties p1 = new Properties();
p1.put("instance.name","FooProvider-1");
- fooProvider1 = Utils.getComponentInstance(context, type, p1);
+ fooProvider1 = Utils.getComponentInstance(getContext(), type, p1);
Properties p2 = new Properties();
p2.put("instance.name","FooProvider-2");
@@ -46,11 +46,11 @@
p2.put("string", new String("bar"));
p2.put("strAProp", new String[] {"bar", "foo"});
p2.put("intAProp", new int[] {1, 2, 3});
- fooProvider2 = Utils.getComponentInstance(context, type, p2);
+ fooProvider2 = Utils.getComponentInstance(getContext(), type, p2);
Properties p3 = new Properties();
p3.put("instance.name","FooProvider-3");
- fooProvider3 = Utils.getComponentInstance(context, "CONFIG-FooProviderType-ConfNoValue", p3);
+ fooProvider3 = Utils.getComponentInstance(getContext(), "CONFIG-FooProviderType-ConfNoValue", p3);
}
public void tearDown() {
@@ -63,9 +63,9 @@
}
public void testComponentTypeConfiguration() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check FooService availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties toCheck = fs.fooProps();
Integer intProp = (Integer) toCheck.get("intProp");
@@ -115,14 +115,14 @@
}
fs = null;
- context.ungetService(ref);
+ getContext().ungetService(ref);
}
public void testInstanceConfiguration() {
- ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ ServiceReference sr = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "FooProvider-2");
assertNotNull("Check the availability of the FS service", sr);
- FooService fs = (FooService) context.getService(sr);
+ FooService fs = (FooService) getContext().getService(sr);
Properties toCheck = fs.fooProps();
// Check service properties
@@ -172,14 +172,14 @@
}
fs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
public void testNoValue() {
- ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ ServiceReference sr = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "FooProvider-3");
assertNotNull("Check the availability of the FS service", sr);
- FooService fs = (FooService) context.getService(sr);
+ FooService fs = (FooService) getContext().getService(sr);
Properties toCheck = fs.fooProps();
// Check service properties
@@ -220,7 +220,7 @@
}
fs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
}
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java
index d467ad0..899a3e5 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java
@@ -33,7 +33,7 @@
public void setUp() {
- Factory fact = Utils.getFactoryByName(context, "CONFIG-BothConfigurableCheckService");
+ Factory fact = Utils.getFactoryByName(getContext(), "CONFIG-BothConfigurableCheckService");
Properties props = new Properties();
props.put("instance.name","under-test");
props.put("b", "1");
@@ -78,9 +78,9 @@
}
public void testConfigurationPrimitive() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -121,9 +121,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -165,9 +165,9 @@
}
public void testConfigurationPrimitiveString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -208,9 +208,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -252,9 +252,9 @@
}
public void testConfigurationPrimitiveArrays() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -311,9 +311,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -371,9 +371,9 @@
}
public void testConfigurationPrimitiveArraysString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -430,9 +430,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -490,9 +490,9 @@
}
public void testConfigurationObj() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -511,9 +511,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -532,9 +532,9 @@
}
public void testConfigurationObjString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -553,9 +553,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -622,9 +622,9 @@
}
public void testConfigurationPrimitiveNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -665,9 +665,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -709,9 +709,9 @@
}
public void testConfigurationPrimitiveArraysNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -752,9 +752,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -812,9 +812,9 @@
}
public void testConfigurationObjNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
@@ -833,9 +833,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestComplexProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestComplexProperties.java
index f24cc59..dc33f52 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestComplexProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestComplexProperties.java
@@ -15,14 +15,14 @@
private CheckService m_check;
public void setUp() {
- m_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "complex");
+ m_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "complex");
assertNotNull("Complex service availability", m_ref);
- m_check = (CheckService) context.getService(m_ref);
+ m_check = (CheckService) getContext().getService(m_ref);
}
public void tearDown() {
m_check = null;
- context.ungetService(m_ref);
+ getContext().ungetService(m_ref);
}
public void testArray() {
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java
index 35335f8..0339b3f 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java
@@ -36,7 +36,7 @@
ComponentInstance instance2;
public void setUp() {
- Factory fact = Utils.getFactoryByName(context, "CONFIG-FieldConfigurableCheckService");
+ Factory fact = Utils.getFactoryByName(getContext(), "CONFIG-FieldConfigurableCheckService");
Properties props = new Properties();
props.put("instance.name","under-test");
props.put("b", "1");
@@ -84,9 +84,9 @@
}
public void testConfigurationPrimitive() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -109,9 +109,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -135,9 +135,9 @@
}
public void testConfigurationPrimitiveNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -160,9 +160,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -186,9 +186,9 @@
}
public void testConfigurationPrimitiveString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -211,9 +211,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -237,9 +237,9 @@
}
public void testConfigurationPrimitiveStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -262,9 +262,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -288,9 +288,9 @@
}
public void testConfigurationPrimitiveArrays() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -329,9 +329,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -371,9 +371,9 @@
}
public void testConfigurationPrimitiveArraysNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -396,9 +396,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -438,9 +438,9 @@
}
public void testConfigurationPrimitiveArraysString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -479,9 +479,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -521,9 +521,9 @@
}
public void testConfigurationPrimitiveArraysStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -546,9 +546,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -588,9 +588,9 @@
}
public void testConfigurationObj() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -603,9 +603,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -618,9 +618,9 @@
}
public void testConfigurationObjNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -631,9 +631,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -646,9 +646,9 @@
}
public void testConfigurationObjString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -661,9 +661,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -676,9 +676,9 @@
}
public void testConfigurationObjStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -689,9 +689,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java
index 63c3e8c..c4a6f8d 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java
@@ -36,7 +36,7 @@
ComponentInstance instance3;
public void setUp() {
- Factory fact = Utils.getFactoryByName(context, "CONFIG-MethodConfigurableCheckService");
+ Factory fact = Utils.getFactoryByName(getContext(), "CONFIG-MethodConfigurableCheckService");
Properties props = new Properties();
props.put("instance.name","under-test");
props.put("b", "1");
@@ -112,9 +112,9 @@
}
public void testConfigurationPrimitive() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -155,9 +155,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -199,9 +199,9 @@
}
public void testConfigurationPrimitiveString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -242,9 +242,9 @@
//
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -286,9 +286,9 @@
}
public void testConfigurationPrimitiveArrays() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -345,9 +345,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -405,9 +405,9 @@
}
public void testConfigurationPrimitiveArraysString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -464,9 +464,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -524,9 +524,9 @@
}
public void testConfigurationObj() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -545,9 +545,9 @@
reconfigure(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -566,9 +566,9 @@
}
public void testConfigurationObjString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -587,9 +587,9 @@
reconfigureString(instance);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -608,9 +608,9 @@
}
public void testConfigurationPrimitive2() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -651,9 +651,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -695,9 +695,9 @@
}
public void testConfigurationPrimitive2String() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -738,9 +738,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -782,9 +782,9 @@
}
public void testConfigurationPrimitiveArrays2() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -841,9 +841,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -901,9 +901,9 @@
}
public void testConfigurationPrimitiveArrays2String() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -960,9 +960,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -1020,9 +1020,9 @@
}
public void testConfigurationObj2() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -1041,9 +1041,9 @@
reconfigure(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -1062,9 +1062,9 @@
}
public void testConfigurationObj2String() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -1083,9 +1083,9 @@
reconfigureString(instance2);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -1152,9 +1152,9 @@
}
public void testConfigurationPrimitiveNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -1195,9 +1195,9 @@
reconfigure(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -1239,9 +1239,9 @@
}
public void testConfigurationPrimitiveStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -1282,9 +1282,9 @@
reconfigureString(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -1326,9 +1326,9 @@
}
public void testConfigurationPrimitiveArraysNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
@@ -1370,9 +1370,9 @@
reconfigure(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -1430,9 +1430,9 @@
}
public void testConfigurationPrimitiveArraysStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -1474,9 +1474,9 @@
reconfigureString(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -1534,9 +1534,9 @@
}
public void testConfigurationObjNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -1554,9 +1554,9 @@
reconfigure(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -1575,9 +1575,9 @@
}
public void testConfigurationObjStringNoValue() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -1595,9 +1595,9 @@
reconfigureString(instance3);
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java
index 9f8b7d7..47ddc81 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java
@@ -14,7 +14,7 @@
public void testPropertyModifier() {
ComponentInstance ci = null;
- Factory factory = Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.PropertyModifier");
+ Factory factory = Utils.getFactoryByName(getContext(), "org.apache.felix.ipojo.test.scenarios.component.PropertyModifier");
Properties props = new Properties();
props.put("cls", new String[] {FooService.class.getName()});
try {
@@ -23,18 +23,18 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), ci.getInstanceName());
assertNotNull("Check ref", ref);
// Check the service property
// Not exposed here:
assertNull("Classes -0", ref.getProperty("classes"));
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
assertTrue(check.check());
// Property exposed now.
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), ci.getInstanceName());
Class[] str = (Class[]) ref.getProperty("classes");
assertEquals("Classes size", 1, str.length);
assertEquals("Classes[0]", FooService.class.getName(), str[0].getName());
@@ -53,7 +53,7 @@
}
// Check the service property
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), ci.getInstanceName());
assertNotNull("Check ref", ref);
str = (Class[]) ref.getProperty("classes");
assertEquals("Classes size -3", 2, str.length);
@@ -61,7 +61,7 @@
assertEquals("Classes[1] -3", CheckService.class.getName(), str[1].getName());
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
p = check.getProps();
str2 = (Class[]) p.get("classes");
assertEquals("Classes size -4", 2, str2.length);
@@ -69,7 +69,7 @@
assertEquals("Classes[1] -4", CheckService.class.getName(), str2[1].getName());
ci.dispose();
- context.ungetService(ref);
+ getContext().ungetService(ref);
}
diff --git a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestSuperMethodProperties.java b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestSuperMethodProperties.java
index c458ec5..fc5ce65 100644
--- a/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestSuperMethodProperties.java
+++ b/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestSuperMethodProperties.java
@@ -32,7 +32,7 @@
ComponentInstance instance;
public void setUp() {
- Factory fact = Utils.getFactoryByName(context, "CONFIG-ParentMethodConfigurableCheckService");
+ Factory fact = Utils.getFactoryByName(getContext(), "CONFIG-ParentMethodConfigurableCheckService");
Properties props = new Properties();
props.put("instance.name","under-test");
props.put("b", "1");
@@ -69,9 +69,9 @@
}
public void testConfigurationPrimitive() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -112,9 +112,9 @@
reconfigure();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -156,9 +156,9 @@
}
public void testConfigurationPrimitiveString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
Byte b = (Byte) props.get("b");
@@ -199,9 +199,9 @@
reconfigureString();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (Byte) props.get("b");
@@ -243,9 +243,9 @@
}
public void testConfigurationPrimitiveArrays() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -302,9 +302,9 @@
reconfigure();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -362,9 +362,9 @@
}
public void testConfigurationPrimitiveArraysString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
byte[] b = (byte[]) props.get("bs");
@@ -421,9 +421,9 @@
reconfigureString();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
b = (byte[]) props.get("bs");
@@ -481,9 +481,9 @@
}
public void testConfigurationObj() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -502,9 +502,9 @@
reconfigure();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
@@ -523,9 +523,9 @@
}
public void testConfigurationObjString() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- CheckService check = (CheckService) context.getService(ref);
+ CheckService check = (CheckService) getContext().getService(ref);
Properties props = check.getProps();
String s = (String) props.get("string");
@@ -544,9 +544,9 @@
reconfigureString();
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Test check service availability", ref);
- check = (CheckService) context.getService(ref);
+ check = (CheckService) getContext().getService(ref);
props = check.getProps();
s = (String) props.get("string");
diff --git a/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index e7040e7..b82cf3c 100644
--- a/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java b/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
index 09066ed..1e89772 100644
--- a/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
+++ b/ipojo/tests/core/external-handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
@@ -42,7 +42,7 @@
p.put("b", "b");
p.put("c", "c");
props.put("csh.map", p);
- instance = Utils.getComponentInstance(context, "HANDLER-HandlerTester", props);
+ instance = Utils.getComponentInstance(getContext(), "HANDLER-HandlerTester", props);
}
public void tearDown() {
@@ -57,13 +57,13 @@
ServiceReference[] refs = null;
String filter = "("+"instance.name"+"="+name+")";
try {
- refs = context.getServiceReferences(CheckService.class.getName(), filter);
+ refs = getContext().getServiceReferences(CheckService.class.getName(), filter);
} catch (InvalidSyntaxException e) { System.err.println("Invalid Filter : " + filter);}
if(refs != null) { sr = refs[0]; }
assertNotNull("Check the check service availability", sr);
- CheckService cs = (CheckService) context.getService(sr);
+ CheckService cs = (CheckService) getContext().getService(sr);
Properties p = cs.getProps();
assertEquals("Assert 'simple' equality", p.get("Simple"), "simple");
assertEquals("Assert 'a' equality", p.get("Map1"), "a");
@@ -71,7 +71,7 @@
assertEquals("Assert 'c' equality", p.get("Map3"), "c");
cs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
public void testConfiguration2() {
@@ -81,12 +81,12 @@
ServiceReference[] refs = null;
String filter = "("+"instance.name"+"="+name+")";
try {
- refs = context.getServiceReferences(CheckService.class.getName(), filter);
+ refs = getContext().getServiceReferences(CheckService.class.getName(), filter);
} catch (InvalidSyntaxException e) { System.err.println("Invalid Filter : " + filter);}
if(refs != null) { sr = refs[0]; }
assertNotNull("Check the check service availability", sr);
- CheckService cs = (CheckService) context.getService(sr);
+ CheckService cs = (CheckService) getContext().getService(sr);
Properties p = cs.getProps();
assertEquals("Assert 'simple' equality", p.get("Simple"), "Simple");
assertEquals("Assert 'a' equality", p.get("Map1"), "a");
@@ -94,7 +94,7 @@
assertEquals("Assert 'c' equality", p.get("Map3"), "c");
cs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
@@ -105,18 +105,18 @@
ServiceReference[] refs = null;
String filter = "("+"instance.name"+"="+name+")";
try {
- refs = context.getServiceReferences(CheckService.class.getName(), filter);
+ refs = getContext().getServiceReferences(CheckService.class.getName(), filter);
} catch (InvalidSyntaxException e) { System.err.println("Invalid Filter : " + filter);}
if(refs != null) { sr = refs[0]; }
assertNotNull("Check the check service availability", sr);
- CheckService cs = (CheckService) context.getService(sr);
+ CheckService cs = (CheckService) getContext().getService(sr);
Properties p = cs.getProps();
assertEquals("Assert 'simple' equality", p.get("Simple"), "Simple");
assertEquals("Size of p", 3, p.size()); // instance name, simple and changes.
cs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
public void testLifecycle() {
@@ -126,17 +126,17 @@
ServiceReference[] refs = null;
String filter = "("+"instance.name"+"="+name+")";
try {
- refs = context.getServiceReferences(CheckService.class.getName(), filter);
+ refs = getContext().getServiceReferences(CheckService.class.getName(), filter);
} catch (InvalidSyntaxException e) { System.err.println("Invalid Filter : " + filter);}
if(refs != null) { sr = refs[0]; }
assertNotNull("Check the check service availability", sr);
- ServiceReference sr_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "HandlerTest-1");
- Architecture arch = (Architecture) context.getService(sr_arch);
+ ServiceReference sr_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "HandlerTest-1");
+ Architecture arch = (Architecture) getContext().getService(sr_arch);
assertEquals("Check instance validity - 0", arch.getInstanceDescription().getState(), ComponentInstance.VALID);
- CheckService cs = (CheckService) context.getService(sr);
+ CheckService cs = (CheckService) getContext().getService(sr);
Properties p = cs.getProps();
Integer changes = (Integer) p.get("changes");
assertNotNull("Check changes no null", changes);
@@ -160,8 +160,8 @@
cs = null;
arch = null;
- context.ungetService(sr_arch);
- context.ungetService(sr);
+ getContext().ungetService(sr_arch);
+ getContext().ungetService(sr);
}
public void testAvailability() {
@@ -170,23 +170,23 @@
ServiceReference[] refs = null;
String filter = "("+"instance.name"+"="+name+")";
try {
- refs = context.getServiceReferences(CheckService.class.getName(), filter);
+ refs = getContext().getServiceReferences(CheckService.class.getName(), filter);
} catch (InvalidSyntaxException e) { System.err.println("Invalid Filter : " + filter);}
if(refs != null) { sr = refs[0]; }
assertNotNull("Check the check service availability", sr);
- ServiceReference sr_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "HandlerTest-1");
- Architecture arch = (Architecture) context.getService(sr_arch);
+ ServiceReference sr_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "HandlerTest-1");
+ Architecture arch = (Architecture) getContext().getService(sr_arch);
assertEquals("Check validity", arch.getInstanceDescription().getState(), ComponentInstance.VALID);
// Kill the handler factory
- HandlerManagerFactory f = (HandlerManagerFactory) Utils.getHandlerFactoryByName(context, "check");
+ HandlerManagerFactory f = (HandlerManagerFactory) Utils.getHandlerFactoryByName(getContext(), "check");
f.stop();
- sr = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "HandlerTest-1");
+ sr = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "HandlerTest-1");
assertNull("Check the check service unavailability", sr);
- sr_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "HandlerTest-1");
+ sr_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "HandlerTest-1");
assertNull("Check the architecture unavailability", sr_arch);
// The instance is disposed, restart the handler
@@ -200,13 +200,13 @@
p.put("b", "b");
p.put("c", "c");
props.put("csh.map", p);
- instance = Utils.getComponentInstance(context, "HANDLER-HandlerTester", props);
+ instance = Utils.getComponentInstance(getContext(), "HANDLER-HandlerTester", props);
- sr = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "HandlerTest-1");
+ sr = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "HandlerTest-1");
assertNotNull("Check the check service availability - 2", sr);
- sr_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "HandlerTest-1");
- arch = (Architecture) context.getService(sr_arch);
+ sr_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "HandlerTest-1");
+ arch = (Architecture) getContext().getService(sr_arch);
assertEquals("Check validity - 2", arch.getInstanceDescription().getState(), ComponentInstance.VALID);
}
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index d1217a1..46593da 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
index 41dbcc2..ce53f39 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
@@ -54,21 +54,21 @@
// Factory multiple_optional;
public void setUp() {
- sr_fooProvider1 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-1");
- sr_fooProvider2 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-2");
- sr_fooProviderDyn2 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-Dyn2");
- sr_fooProvider3 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-3");
- sr_foobarProvider = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooBarProviderType-1");
+ sr_fooProvider1 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-1");
+ sr_fooProvider2 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-2");
+ sr_fooProviderDyn2 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-Dyn2");
+ sr_fooProvider3 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-3");
+ sr_foobarProvider = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooBarProviderType-1");
// sr_simple = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleCheckServiceProvider");
// sr_optional = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleOptionalCheckServiceProvider");
// sr_multiple = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleMultipleCheckServiceProvider");
// sr_multiple_optional = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleOptionalMultipleCheckServiceProvider");
- fooProvider1 = (Factory) context.getService(sr_fooProvider1);
- fooProvider2 = (Factory) context.getService(sr_fooProvider2);
- fooProviderDyn2 = (Factory) context.getService(sr_fooProviderDyn2);
- fooProvider3 = (Factory) context.getService(sr_fooProvider3);
- foobarProvider = (Factory) context.getService(sr_foobarProvider);
+ fooProvider1 = (Factory) getContext().getService(sr_fooProvider1);
+ fooProvider2 = (Factory) getContext().getService(sr_fooProvider2);
+ fooProviderDyn2 = (Factory) getContext().getService(sr_fooProviderDyn2);
+ fooProvider3 = (Factory) getContext().getService(sr_fooProvider3);
+ foobarProvider = (Factory) getContext().getService(sr_foobarProvider);
// simple = (Factory) context.getService(sr_simple);
// optional = (Factory) context.getService(sr_optional);
// multiple = (Factory) context.getService(sr_multiple);
@@ -87,11 +87,11 @@
// optional = null;
// multiple_optional = null;
- context.ungetService(sr_fooProvider1);
- context.ungetService(sr_fooProvider2);
- context.ungetService(sr_fooProviderDyn2);
- context.ungetService(sr_fooProvider3);
- context.ungetService(sr_foobarProvider);
+ getContext().ungetService(sr_fooProvider1);
+ getContext().ungetService(sr_fooProvider2);
+ getContext().ungetService(sr_fooProviderDyn2);
+ getContext().ungetService(sr_fooProvider3);
+ getContext().ungetService(sr_foobarProvider);
// context.ungetService(sr_simple);
// context.ungetService(sr_optional);
// context.ungetService(sr_multiple);
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ConfigAdminTest.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ConfigAdminTest.java
index 3b6d440..07ee24c 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ConfigAdminTest.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ConfigAdminTest.java
@@ -36,9 +36,9 @@
private ManagedServiceFactory getFactoryByName(String pid) {
ServiceReference[] refs;
try {
- refs = context.getServiceReferences(ManagedServiceFactory.class.getName(), "(service.pid="+pid+")");
+ refs = getContext().getServiceReferences(ManagedServiceFactory.class.getName(), "(service.pid="+pid+")");
if(refs == null) { return null; }
- return ((org.osgi.service.cm.ManagedServiceFactory) context.getService(refs[0]));
+ return ((org.osgi.service.cm.ManagedServiceFactory) getContext().getService(refs[0]));
} catch (InvalidSyntaxException e) {
System.err.println("Cannot get the factory " + pid + " : " + e.getMessage());
return null;
@@ -60,10 +60,10 @@
try {
f.updated("ok2", p);
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "ok2");
assertNotNull("Check instance creation", ref);
f.deleted("ok2");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "ok2");
assertNull("Check instance deletion", ref);
} catch (ConfigurationException e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
@@ -85,10 +85,10 @@
try {
f.updated("ok2", p);
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "ok2");
assertNotNull("Check instance creation", ref);
f.deleted("ok2");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "ok2");
assertNull("Check instance deletion", ref);
} catch (ConfigurationException e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
@@ -110,15 +110,15 @@
try {
f.updated("okkkk", p);
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
assertNotNull("Check instance creation", ref);
p.put("int", new Integer("4"));
f.updated("okkkk", p);
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
Integer test = (Integer) ref.getProperty("int");
assertEquals("Check instance modification", 4, test.intValue());
f.deleted("okkkk");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
assertNull("Check instance deletion", ref);
} catch (ConfigurationException e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
@@ -141,15 +141,15 @@
try {
f.updated("okkkk", p);
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
assertNotNull("Check instance creation", ref);
p.put("int", new Integer("4"));
f.updated("okkkk", p);
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
Integer test = (Integer) ref.getProperty("int");
assertEquals("Check instance modification", 4, test.intValue());
f.deleted("okkkk");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "okkkk");
assertNull("Check instance deletion", ref);
} catch (ConfigurationException e) {
fail("An acceptable configuration is rejected : " + e.getMessage());
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/FactoryProps.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/FactoryProps.java
index d2604d0..f18359f 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/FactoryProps.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/FactoryProps.java
@@ -36,7 +36,7 @@
// }
public void testSimpleExposition() {
- ServiceReference ref1 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-1");
+ ServiceReference ref1 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-1");
assertNotNull("The factory is available", ref1);
String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications");
assertEquals("Check array length", spec.length, 1);
@@ -44,7 +44,7 @@
}
public void testDoubleExposition() {
- ServiceReference ref1 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooBarProviderType-1");
+ ServiceReference ref1 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooBarProviderType-1");
assertNotNull("The factory is available", ref1);
String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications");
assertEquals("Check array length", spec.length, 2);
@@ -53,7 +53,7 @@
}
public void testProps() {
- ServiceReference ref1 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "Factories-FooProviderType-Dyn2");
+ ServiceReference ref1 = Utils.getServiceReferenceByName(getContext(), Factory.class.getName(), "Factories-FooProviderType-Dyn2");
assertNotNull("The factory is available", ref1);
PropertyDescription[] pd = (PropertyDescription[]) ref1.getProperty("component.properties");
assertEquals("Check property list size", pd.length, 5);
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ObedienceTest.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ObedienceTest.java
index e2f4af2..c650d5c 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ObedienceTest.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ObedienceTest.java
@@ -36,8 +36,8 @@
public class ObedienceTest extends OSGiTestCase {
public void testObedience() {
- assertNull("Check no foo service", context.getServiceReference(FooService.class.getName()));
- ComponentFactory factory = (ComponentFactory) Utils.getFactoryByName(context, "Factories-FooProviderType-1");
+ assertNull("Check no foo service", getContext().getServiceReference(FooService.class.getName()));
+ ComponentFactory factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "Factories-FooProviderType-1");
assertNotNull("Check factory existing", factory);
Properties props1 = new Properties();
@@ -56,59 +56,59 @@
assertTrue("Check foo1 validity", ci1.getState() == ComponentInstance.VALID);
assertTrue("Check foo2 validity", ci2.getState() == ComponentInstance.VALID);
- assertNotNull("Check foo service", context.getServiceReference(FooService.class.getName()));
- assertEquals("Check the number of Foo", Utils.getServiceReferences(context, FooService.class.getName(), null).length, 2);
+ assertNotNull("Check foo service", getContext().getServiceReference(FooService.class.getName()));
+ assertEquals("Check the number of Foo", Utils.getServiceReferences(getContext(), FooService.class.getName(), null).length, 2);
factory.stop();
assertTrue("Check foo1 invalidity ("+ci1.getState()+")", ci1.getState() == ComponentInstance.DISPOSED);
assertTrue("Check foo2 invalidity ("+ci1.getState()+")", ci2.getState() == ComponentInstance.DISPOSED);
- assertNull("Check no foo service", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check no foo service", getContext().getServiceReference(FooService.class.getName()));
factory.start();
- assertNull("Check no foo service", context.getServiceReference(FooService.class.getName()));
+ assertNull("Check no foo service", getContext().getServiceReference(FooService.class.getName()));
}
public void testDisposeAfterFactoryInvalidation() {
- ComponentFactory cf = (ComponentFactory) Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
+ ComponentFactory cf = (ComponentFactory) Utils.getFactoryByName(getContext(), "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
assertNotNull("Check factory availability -1", cf);
assertEquals("Check factory state -1", Factory.VALID, cf.getState());
- ServiceReference ref_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "SimpleInstance");
+ ServiceReference ref_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "SimpleInstance");
assertNotNull("Check Architecture availability -1", ref_arch);
- HandlerManagerFactory hf = (HandlerManagerFactory) Utils.getHandlerFactoryByName(context, "controller");
+ HandlerManagerFactory hf = (HandlerManagerFactory) Utils.getHandlerFactoryByName(getContext(), "controller");
assertNotNull("Check handler availability -1", hf);
assertEquals("Check handler state -1", Factory.VALID, hf.getState());
// Stop the handler
hf.stop();
- HandlerManagerFactory hf2 = (HandlerManagerFactory) Utils.getHandlerFactoryByName(context, "controller");
+ HandlerManagerFactory hf2 = (HandlerManagerFactory) Utils.getHandlerFactoryByName(getContext(), "controller");
assertNull("Check handler availability -2", hf2);
// Check the factory invalidity
- cf = (ComponentFactory) Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
+ cf = (ComponentFactory) Utils.getFactoryByName(getContext(), "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
assertNotNull("Check factory availability -2", cf);
assertEquals("Check factory state -2", Factory.INVALID, cf.getState());
// Check the instance disparition
- ref_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "SimpleInstance");
+ ref_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "SimpleInstance");
assertNull("Check Architecture availability -1", ref_arch);
// Restart the handler
hf.start();
- hf2 = (HandlerManagerFactory) Utils.getHandlerFactoryByName(context, "controller");
+ hf2 = (HandlerManagerFactory) Utils.getHandlerFactoryByName(getContext(), "controller");
assertNotNull("Check handler availability -3", hf2);
// Check the factory state
- cf = (ComponentFactory) Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
+ cf = (ComponentFactory) Utils.getFactoryByName(getContext(), "org.apache.felix.ipojo.test.scenarios.component.SimpleType");
assertNotNull("Check factory availability -3", cf);
assertEquals("Check factory state -3", Factory.VALID, cf.getState());
// Check the instance re-creation
- ref_arch = Utils.getServiceReferenceByName(context, Architecture.class.getName(), "SimpleInstance");
+ ref_arch = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "SimpleInstance");
assertNotNull("Check Architecture availability -3", ref_arch);
}
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java
index 2822832..e6b4d92 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java
@@ -34,7 +34,7 @@
* Configuration without the name property.
*/
public void testWithoutName() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
Properties p = new Properties();
p.put("int", new Integer(3));
@@ -55,7 +55,7 @@
* Configuration without the name property.
*/
public void testWithoutNameOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2opt");
Properties p = new Properties();
p.put("int", new Integer(3));
@@ -76,7 +76,7 @@
* Empty configuration.
*/
public void testEmptyConfiguration() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
Properties p = new Properties();
ComponentInstance ci = null;
@@ -90,7 +90,7 @@
* Empty configuration.
*/
public void testEmptyConfigurationOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2opt");
Properties p = new Properties();
ComponentInstance ci = null;
@@ -104,7 +104,7 @@
* Empty configuration (just the name).
*/
public void testEmptyConfiguration2() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ko");
ComponentInstance ci = null;
@@ -120,7 +120,7 @@
* Empty configuration (just the name).
*/
public void testEmptyConfiguration2opt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ko");
ComponentInstance ci = null;
@@ -137,7 +137,7 @@
* Null configuration (accept).
*/
public void testNull() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
ComponentInstance ci = null;
try {
@@ -150,7 +150,7 @@
* Null configuration (accept).
*/
public void testNullOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2opt");
ComponentInstance ci = null;
try {
@@ -163,7 +163,7 @@
* Null configuration (fail).
*/
public void testNull2() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
ComponentInstance ci = null;
try {
@@ -178,7 +178,7 @@
* Null configuration (success).
*/
public void testNull2Opt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
ComponentInstance ci = null;
try {
@@ -195,7 +195,7 @@
* Check static properties.
*/
public void testStaticOK() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -218,7 +218,7 @@
* Check static properties.
*/
public void testStaticOKopt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -241,7 +241,7 @@
* Check dynamic properties.
*/
public void testDynamicOK() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -266,7 +266,7 @@
* Check dynamic properties.
*/
public void testDynamicOKopt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dynopt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dynopt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -305,7 +305,7 @@
* Check inconsistent types.
*/
public void testDynamicBadType() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -328,7 +328,7 @@
* Check inconsistent types.
*/
public void testDynamicBadTypeOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dynopt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dynopt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -365,7 +365,7 @@
* Check good configuration (with overriding).
*/
public void testDynamicComplete() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -388,7 +388,7 @@
* Check good configuration (with overriding).
*/
public void testDynamicCompleteOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -426,7 +426,7 @@
* Check good configuration.
*/
public void testDynamicJustEnough() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -447,7 +447,7 @@
* Check good configuration.
*/
public void testDynamicJustEnoughOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -481,7 +481,7 @@
* Check good configuration.
*/
public void testDynamicMix() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -503,7 +503,7 @@
* Check good configuration.
*/
public void testDynamicMixOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -539,7 +539,7 @@
* Check uncomplete configuration.
*/
public void testDynamicUncomplete() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -560,7 +560,7 @@
* Check uncomplete configuration.
*/
public void testDynamicUncompleteOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -581,7 +581,7 @@
* Check good configuration (more properties).
*/
public void testDynamicMore() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -605,7 +605,7 @@
* Check good configuration (more properties).
*/
public void testDynamicMoreOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -629,7 +629,7 @@
* Check properties affecting services and component.
*/
public void testDoubleProps() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -654,7 +654,7 @@
* Check properties affecting services and component.
*/
public void testDoublePropsOpt() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-Dyn2opt");
Properties p = new Properties();
p.put("instance.name","ok");
@@ -679,7 +679,7 @@
* Check instance name unicity.
*/
public void testUnicity1() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
ComponentInstance ci1,ci2, ci3 = null;
try {
@@ -699,7 +699,7 @@
* Check instance name unicity.
*/
public void testUnicity2() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
ComponentInstance ci1,ci2, ci3 = null;
try {
@@ -725,7 +725,7 @@
* Check instance name unicity.
*/
public void testUnicity3() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
ComponentInstance ci1 = null,ci2 = null;
try {
@@ -749,8 +749,8 @@
* Check instance name unicity.
*/
public void testUnicity4() {
- Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
- Factory f2 = Utils.getFactoryByName(context, "Factories-FooProviderType-1");
+ Factory f = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-2");
+ Factory f2 = Utils.getFactoryByName(getContext(), "Factories-FooProviderType-1");
ComponentInstance ci1 = null,ci2 = null;
try {
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index d4ad3bf..35377c3 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
index be1d266..d26e61a 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
@@ -36,12 +36,12 @@
public void setUp() {
Properties p2 = new Properties();
p2.put("instance.name","fooProvider");
- fooProvider = Utils.getComponentInstance(context, "LFCB-FooProviderType-1", p2);
+ fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
fooProvider.stop();
Properties p1 = new Properties();
p1.put("instance.name","callback");
- instance = Utils.getComponentInstance(context, "LFCB-CallbackCheckService", p1);
+ instance = Utils.getComponentInstance(getContext(), "LFCB-CallbackCheckService", p1);
}
@@ -54,9 +54,9 @@
public void testCallback() {
// Check instance is invalid
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
@@ -64,13 +64,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check int property
@@ -81,7 +81,7 @@
fooProvider.stop();
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
@@ -89,13 +89,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check int property
@@ -105,8 +105,8 @@
assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
// Clean up
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
cs = null;
id_dep = null;
}
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSeveralFactoryTest.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSeveralFactoryTest.java
index 93d40ac..1fe3f1e 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSeveralFactoryTest.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSeveralFactoryTest.java
@@ -37,12 +37,12 @@
public void setUp() {
Properties p2 = new Properties();
p2.put("instance.name","fooProvider");
- fooProvider = Utils.getComponentInstance(context, "LFCB-FooProviderType-1", p2);
+ fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
fooProvider.stop();
Properties p1 = new Properties();
p1.put("instance.name","callback");
- instance = Utils.getComponentInstance(context, "LFCB-ImmediateCallbackCheckServiceSeveral", p1);
+ instance = Utils.getComponentInstance(getContext(), "LFCB-ImmediateCallbackCheckServiceSeveral", p1);
}
@@ -56,9 +56,9 @@
public void testCallback() {
// Check instance is invalid
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
@@ -66,13 +66,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
@@ -84,7 +84,7 @@
fooProvider.stop();
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
@@ -92,13 +92,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check int property
@@ -110,8 +110,8 @@
assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
// Clean up
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
cs = null;
id_dep = null;
}
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSingletonFactoryTest.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSingletonFactoryTest.java
index 5119622..ec55c3e 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSingletonFactoryTest.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSingletonFactoryTest.java
@@ -37,12 +37,12 @@
public void setUp() {
Properties p2 = new Properties();
p2.put("instance.name","fooProvider");
- fooProvider = Utils.getComponentInstance(context, "LFCB-FooProviderType-1", p2);
+ fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
fooProvider.stop();
Properties p1 = new Properties();
p1.put("instance.name","callback");
- instance = Utils.getComponentInstance(context, "LFCB-ImmediateCallbackCheckServiceSingleton", p1);
+ instance = Utils.getComponentInstance(getContext(), "LFCB-ImmediateCallbackCheckServiceSingleton", p1);
}
@@ -57,9 +57,9 @@
public void testCallback() {
// Check instance is invalid
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
@@ -67,13 +67,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
@@ -83,7 +83,7 @@
fooProvider.stop();
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
@@ -91,13 +91,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check int property
@@ -107,8 +107,8 @@
assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
// Clean up
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
cs = null;
id_dep = null;
}
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackTest.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackTest.java
index ea67fc1..f700aed 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackTest.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackTest.java
@@ -36,12 +36,12 @@
public void setUp() {
Properties p2 = new Properties();
p2.put("instance.name","fooProvider");
- fooProvider = Utils.getComponentInstance(context, "LFCB-FooProviderType-1", p2);
+ fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
fooProvider.stop();
Properties p1 = new Properties();
p1.put("instance.name","callback");
- instance = Utils.getComponentInstance(context, "LFCB-ImmediateCallbackCheckService", p1);
+ instance = Utils.getComponentInstance(getContext(), "LFCB-ImmediateCallbackCheckService", p1);
}
@@ -54,9 +54,9 @@
public void testCallback() {
// Check instance is invalid
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 1", id_dep.getCreatedObjects().length, 0);
@@ -64,13 +64,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
@@ -80,7 +80,7 @@
fooProvider.stop();
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
assertEquals("Check pojo count - 3", id_dep.getCreatedObjects().length, 1);
@@ -88,13 +88,13 @@
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check int property
@@ -104,8 +104,8 @@
assertEquals("Check pojo count - 4 ", id_dep.getCreatedObjects().length, 1);
// Clean up
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
cs = null;
id_dep = null;
}
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateLifeCycleControllerTest.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateLifeCycleControllerTest.java
index bd6d336..4b41f25 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateLifeCycleControllerTest.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateLifeCycleControllerTest.java
@@ -33,21 +33,21 @@
private Factory factory;
public void setUp() {
- factory = Utils.getFactoryByName(context, "LFC-Test-Immediate");
+ factory = Utils.getFactoryByName(getContext(), "LFC-Test-Immediate");
}
public void testOne() {
Properties props = new Properties();
props.put("conf", "foo");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test-Immediate", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test-Immediate", props);
// The conf is correct, the PS must be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -1", ref);
- CheckService cs = (CheckService) context.getService(ref);
+ CheckService cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 1", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
// Reconfigure the instance with a bad configuration
@@ -59,7 +59,7 @@
}
// The instance should now be invalid
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -2", ref);
// Reconfigure the instance with a valid configuration
@@ -70,11 +70,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable (2) : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -3", ref);
- cs = (CheckService) context.getService(ref);
+ cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 2", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
@@ -84,12 +84,12 @@
Properties props = new Properties();
props.put("conf", "bar");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test-Immediate", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test-Immediate", props);
assertEquals("check under state", under.getState(), ComponentInstance.INVALID);
// The conf is incorrect, the PS must not be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -1", ref);
// Reconfigure the instance with a correct configuration
@@ -100,11 +100,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -2", ref);
- CheckService cs = (CheckService) context.getService(ref);
+ CheckService cs = (CheckService) getContext().getService(ref);
assertTrue("Check state ", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
diff --git a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ParentCallbackTestCase.java b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ParentCallbackTestCase.java
index 8a00224..569493b 100644
--- a/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ParentCallbackTestCase.java
+++ b/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ParentCallbackTestCase.java
@@ -36,12 +36,12 @@
public void setUp() {
Properties p2 = new Properties();
p2.put("instance.name","fooProvider");
- fooProvider = Utils.getComponentInstance(context, "LFCB-FooProviderType-1", p2);
+ fooProvider = Utils.getComponentInstance(getContext(), "LFCB-FooProviderType-1", p2);
fooProvider.stop();
Properties p1 = new Properties();
p1.put("instance.name","callback");
- instance = Utils.getComponentInstance(context, "LFCB-ParentCallbackCheckService", p1);
+ instance = Utils.getComponentInstance(getContext(), "LFCB-ParentCallbackCheckService", p1);
}
@@ -54,46 +54,46 @@
public void testCallback() {
// Check instance is invalid
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
// Start fooprovider
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// Check int property
assertEquals("Check pojo count - 2", id_dep.getCreatedObjects().length, 1);
fooProvider.stop();
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
fooProvider.start();
// Check instance validity
- id_dep = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id_dep.getState() == ComponentInstance.VALID);
// Check service providing
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Clean up
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
cs = null;
id_dep = null;
}
diff --git a/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/ImmediateLifeCycleControllerTest.java b/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/ImmediateLifeCycleControllerTest.java
index 25b3054..9cd60f7 100644
--- a/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/ImmediateLifeCycleControllerTest.java
+++ b/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/ImmediateLifeCycleControllerTest.java
@@ -33,21 +33,21 @@
private Factory factory;
public void setUp() {
- factory = Utils.getFactoryByName(context, "LFC-Test-Immediate");
+ factory = Utils.getFactoryByName(getContext(), "LFC-Test-Immediate");
}
public void testOne() {
Properties props = new Properties();
props.put("conf", "foo");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test-Immediate", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test-Immediate", props);
// The conf is correct, the PS must be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -1", ref);
- CheckService cs = (CheckService) context.getService(ref);
+ CheckService cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 1", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
// Reconfigure the instance with a bad configuration
@@ -59,7 +59,7 @@
}
// The instance should now be invalid
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -2", ref);
// Reconfigure the instance with a valid configuration
@@ -70,11 +70,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable (2) : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -3", ref);
- cs = (CheckService) context.getService(ref);
+ cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 2", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
@@ -84,12 +84,12 @@
Properties props = new Properties();
props.put("conf", "bar");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test-Immediate", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test-Immediate", props);
assertEquals("check under state", under.getState(), ComponentInstance.INVALID);
// The conf is incorrect, the PS must not be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -1", ref);
// Reconfigure the instance with a correct configuration
@@ -100,11 +100,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -2", ref);
- CheckService cs = (CheckService) context.getService(ref);
+ CheckService cs = (CheckService) getContext().getService(ref);
assertTrue("Check state ", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
diff --git a/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/LifeCycleControllerTest.java b/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/LifeCycleControllerTest.java
index 407200d..68f8600 100644
--- a/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/LifeCycleControllerTest.java
+++ b/ipojo/tests/core/lifecycle-controller/src/main/java/org/apache/felix/ipojo/test/scenarios/lfc/LifeCycleControllerTest.java
@@ -38,21 +38,21 @@
private Factory factory;
public void setUp() {
- factory = Utils.getFactoryByName(context, "LFC-Test");
+ factory = Utils.getFactoryByName(getContext(), "LFC-Test");
}
public void testOne() {
Properties props = new Properties();
props.put("conf", "foo");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test", props);
// The conf is correct, the PS must be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -1", ref);
- CheckService cs = (CheckService) context.getService(ref);
+ CheckService cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 1", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
// Reconfigure the instance with a bad configuration
@@ -64,7 +64,7 @@
}
// The instance should now be invalid
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -2", ref);
// Reconfigure the instance with a valid configuration
@@ -75,11 +75,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable (2) : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -3", ref);
- cs = (CheckService) context.getService(ref);
+ cs = (CheckService) getContext().getService(ref);
assertTrue("Check state 2", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
@@ -93,14 +93,14 @@
Properties props = new Properties();
props.put("conf", "bar");
props.put("instance.name","under");
- under = Utils.getComponentInstance(context, "LFC-Test", props);
+ under = Utils.getComponentInstance(getContext(), "LFC-Test", props);
// The conf is incorrect, but the test can appears only when the object is created : the PS must be provided
- ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -1", ref);
- System.out.println("CS received : " + context.getService(ref));
- CheckService cs = (CheckService) context.getService(ref);
+ System.out.println("CS received : " + getContext().getService(ref));
+ CheckService cs = (CheckService) getContext().getService(ref);
assertNotNull("Assert CS not null", cs);
try {
assertFalse("Check state (false)", cs.check());
@@ -110,7 +110,7 @@
}
// As soon as the instance is created, the service has to disappear :
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNull("Check service availability -2", ref);
// Reconfigure the instance with a correct configuration
@@ -121,11 +121,11 @@
fail("The reconfiguration is not unacceptable and seems unacceptable : " + props);
}
- ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+ ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), "under");
assertNotNull("Check service availability -3", ref);
- cs = (CheckService) context.getService(ref);
+ cs = (CheckService) getContext().getService(ref);
assertTrue("Check state ", cs.check());
- context.ungetService(ref);
+ getContext().ungetService(ref);
cs = null;
under.dispose();
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
index 2ae40ec..97b73df 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/dynamic/priority/SimpleDPDependencies.java
@@ -41,22 +41,22 @@
Properties prov = new Properties();
prov.put("instance.name","FooProvider-1");
prov.put("service.ranking", "1");
- fooProvider = Utils.getFactoryByName(context, "RankedFooProviderType").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "RankedFooProviderType").createComponentInstance(prov);
fooProvider.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider-2");
prov2.put("service.ranking", "0");
- fooProvider2 = Utils.getFactoryByName(context, "RankedFooProviderType").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "RankedFooProviderType").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "DPSimpleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "DPSimpleCheckServiceProvider").createComponentInstance(i1);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "DPObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "DPObjectCheckServiceProvider").createComponentInstance(i3);
} catch(Exception e) {
e.printStackTrace();
@@ -76,81 +76,81 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// Check grade
Integer grade = (Integer) cs.getProps().get("int");
assertEquals("Check first grade", 1, grade.intValue());
fooProvider.stop(); // Turn off the best provider.
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// Check grade
grade = (Integer) cs.getProps().get("int");
assertEquals("Check second grade", 0, grade.intValue());
fooProvider.start(); // Turn on the best provider.
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// Check grade
grade = (Integer) cs.getProps().get("int");
assertEquals("Check third grade", 1, grade.intValue());
// Increase the second provider grade.
- ServiceReference fs_ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference fs_ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check foo service (2) reference", fs_ref);
- FooService fs = (FooService) context.getService(fs_ref);
+ FooService fs = (FooService) getContext().getService(fs_ref);
fs.foo(); // Increase the grade (now = 2)
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// Check grade
grade = (Integer) cs.getProps().get("int");
assertEquals("Check fourth grade", 2, grade.intValue());
// Increase the other provider grade.
- fs_ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProvider.getInstanceName());
+ fs_ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider.getInstanceName());
assertNotNull("Check foo service (1) reference", fs_ref);
- fs = (FooService) context.getService(fs_ref);
+ fs = (FooService) getContext().getService(fs_ref);
fs.foo(); //(grade = 3)
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// Check grade
grade = (Integer) cs.getProps().get("int");
assertEquals("Check fifth grade", 3, grade.intValue());
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(fs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(fs_ref);
fooProvider.stop();
fooProvider2.stop();
}
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
index 23ccf55..8443197 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodOptionalDependencies.java
@@ -39,20 +39,20 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "StaticMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "StaticMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "StaticMRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "StaticMRefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "StaticMBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "StaticMBothOptionalCheckServiceProvider").createComponentInstance(i5);
} catch (Exception e) {
fail(e.getMessage());
}
@@ -71,14 +71,14 @@
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
@@ -95,11 +95,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -114,10 +114,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -132,19 +132,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -159,11 +159,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -178,10 +178,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -196,19 +196,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -223,11 +223,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -242,10 +242,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -260,8 +260,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
index adb4c4f..66f75fd 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MethodSimpleDependencies.java
@@ -38,22 +38,22 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "StaticMObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "StaticMObjectCheckServiceProvider").createComponentInstance(i3);
assertNotNull("check instance 3", instance3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "StaticMRefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "StaticMRefCheckServiceProvider").createComponentInstance(i4);
assertNotNull("check instance 4", instance4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "StaticMBothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "StaticMBothCheckServiceProvider").createComponentInstance(i5);
assertNotNull("check instance 5", instance5);
} catch(Exception e) { fail(e.getMessage()); }
@@ -72,19 +72,19 @@
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -99,29 +99,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -136,29 +136,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -173,13 +173,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
index 8352ec6..3b036a5 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
@@ -38,29 +38,29 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "StaticSimpleMultipleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "StaticSimpleMultipleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "StaticVoidMultipleCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "StaticVoidMultipleCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "StaticObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "StaticObjectMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "StaticRefMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "StaticRefMultipleCheckServiceProvider").createComponentInstance(i4);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -85,14 +85,14 @@
fooProvider1.start();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -108,10 +108,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -127,13 +127,13 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
@@ -141,14 +141,14 @@
fooProvider1.start();
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
@@ -164,10 +164,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, two providers are here
@@ -183,13 +183,13 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
@@ -197,14 +197,14 @@
fooProvider1.start();
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
@@ -220,10 +220,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, two providers are here
@@ -239,13 +239,13 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
@@ -253,14 +253,14 @@
fooProvider1.start();
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -276,10 +276,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double) props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, two providers are here
@@ -295,13 +295,13 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
index ca51add..dad741d 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
@@ -41,28 +41,28 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "StaticSimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "StaticSimpleOptionalCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "StaticVoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "StaticVoidOptionalCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "StaticObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "StaticObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "StaticRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "StaticRefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "StaticBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "StaticBothOptionalCheckServiceProvider").createComponentInstance(i5);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -82,14 +82,14 @@
}
public void atestSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -107,11 +107,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
@@ -129,13 +129,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestDelayedSimple() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
@@ -143,14 +143,14 @@
fooProvider.start();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -168,24 +168,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID); // Dependency broken
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -202,11 +202,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -223,10 +223,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -243,8 +243,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDelayedVoid() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
@@ -252,14 +252,14 @@
fooProvider.start();
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -277,24 +277,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3 (" + id.getState() + ")", id.getState() == ComponentInstance.INVALID); // Dependency broken
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -307,11 +307,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -324,10 +324,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -340,8 +340,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestDelayedObject() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
@@ -349,14 +349,14 @@
fooProvider.start();
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -374,24 +374,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID); // Dependency broken
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -404,11 +404,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -421,10 +421,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -437,19 +437,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void atestBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -462,11 +462,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -481,10 +481,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3 (" + id.getState() + ")", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -499,8 +499,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
index 800f445..a145022 100644
--- a/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
@@ -38,28 +38,28 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "StaticSimpleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "StaticSimpleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "StaticVoidCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "StaticVoidCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "StaticObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "StaticObjectCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "StaticRefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "StaticRefCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "StaticBothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "StaticBothCheckServiceProvider").createComponentInstance(i5);
} catch(Exception e) {
e.printStackTrace();
fail(e.getMessage()); }
@@ -82,58 +82,58 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNull("Check CheckService availability", cs_ref);
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- Object o = context.getService(cs_ref);
+ Object o = getContext().getService(cs_ref);
CheckService cs = (CheckService) o;
Properties props = cs.getProps();
//Check properties
@@ -149,41 +149,41 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -198,41 +198,41 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -247,41 +247,41 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -296,25 +296,25 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNull("Check CheckService availability - 2", cs_ref);
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java
index 2d36193..9ddcb09 100644
--- a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java
+++ b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java
@@ -36,29 +36,29 @@
try {
Properties prov = new Properties();
prov.put("instance.name","A");
- providerA = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ providerA = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
providerA.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","B");
- providerB = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov2);
+ providerB = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov2);
providerB.stop();
Properties prov3 = new Properties();
prov3.put("service.pid", "A");
- providerC = Utils.getFactoryByName(context, "SimplePIDCheckServiceProvider").createComponentInstance(prov3);
+ providerC = Utils.getFactoryByName(getContext(), "SimplePIDCheckServiceProvider").createComponentInstance(prov3);
providerC.stop();
Properties prov4 = new Properties();
prov4.put("service.pid", "D");
prov4.put("instance.name","D");
- providerD = Utils.getFactoryByName(context, "SimplePIDCheckServiceProvider").createComponentInstance(prov4);
+ providerD = Utils.getFactoryByName(getContext(), "SimplePIDCheckServiceProvider").createComponentInstance(prov4);
providerD.stop();
// Uses the component type from value
Properties i1 = new Properties();
i1.put("instance.name","Subscriber1");
- instance1 = Utils.getFactoryByName(context, "SimpleFromCheckServiceSubscriber").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleFromCheckServiceSubscriber").createComponentInstance(i1);
// Uses the instance configuration from value
Properties i2 = new Properties();
@@ -66,7 +66,7 @@
Properties ii2 = new Properties();
ii2.put("id1", "B");
i2.put("requires.from", ii2);
- instance2 = Utils.getFactoryByName(context, "SimpleFromCheckServiceSubscriber").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "SimpleFromCheckServiceSubscriber").createComponentInstance(i2);
// Uses the instance configuration from value (*)
Properties i3 = new Properties();
@@ -74,7 +74,7 @@
Properties ii3 = new Properties();
ii3.put("id1", "*");
i3.put("requires.from", ii3);
- instance3 = Utils.getFactoryByName(context, "SimpleFromCheckServiceSubscriber").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "SimpleFromCheckServiceSubscriber").createComponentInstance(i3);
// Uses the instance configuration from value, merge filter and from
Properties i4 = new Properties();
@@ -85,7 +85,7 @@
Properties iii4 = new Properties();
iii4.put("id1", "(service.pid=D)");
i4.put("requires.filters", iii4);
- instance4 = Utils.getFactoryByName(context, "SimpleFromCheckServiceSubscriber").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "SimpleFromCheckServiceSubscriber").createComponentInstance(i4);
} catch(Exception e) {
e.printStackTrace();
@@ -115,192 +115,192 @@
public void testFromInstanceName() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
providerA.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
providerA.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
providerA.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
providerA.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
providerB.stop();
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testFromPID() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
providerC.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
providerC.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
providerC.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
providerC.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
providerB.stop();
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testFromInstanceNameInstanceConfiguration() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
providerA.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
providerB.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
providerB.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
providerA.stop();
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testFromInstanceNameStar() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
providerA.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 0", id.getState() == ComponentInstance.VALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
providerB.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.VALID);
providerA.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID);
providerB.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.VALID);
id = null;
providerB.stop();
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
public void testFromAndFilter() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
providerA.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
providerD.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
providerD.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
providerD.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
providerD.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
providerA.stop();
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
}
diff --git a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
index 499b3f8..6334c5c 100644
--- a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
+++ b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/MultipleFilterDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider1.stop();
prov = new Properties();
prov.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Subscriber1");
- instance1 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "MultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Subscriber2");
Properties ii2 = new Properties();
ii2.put("id2", "(toto=A)");
i2.put("requires.filters", ii2);
- instance2 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "MultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Subscriber3");
Properties ii3 = new Properties();
ii3.put("id1", "(toto=A)");
i3.put("requires.filters", ii3);
- instance3 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
} catch(Exception e) {
e.printStackTrace();
@@ -86,45 +86,45 @@
public void testMultipleNotMatch() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
assertTrue("Check service invocation", cs_instance.check());
@@ -133,40 +133,40 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatch() {
@@ -174,28 +174,28 @@
fooProvider1.start();
fooProvider2.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -203,7 +203,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -211,23 +211,23 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -237,59 +237,59 @@
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleNotMatchInstance() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.start();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -302,40 +302,40 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatchInstance() {
@@ -344,21 +344,21 @@
fooProvider2.start();
instance3.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -366,7 +366,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -374,24 +374,24 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -400,59 +400,59 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleNotMatchInstanceWithoutFilter() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.start();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -465,40 +465,40 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatchInstanceWithoutFilter() {
@@ -506,21 +506,21 @@
fooProvider2.start();
instance2.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -528,7 +528,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -536,24 +536,24 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -562,10 +562,10 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
}
diff --git a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
index 445dc45..61bba51 100644
--- a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
+++ b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalMultipleFilterDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider1.stop();
prov = new Properties();
prov.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Subscriber1");
- instance1 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Subscriber2");
Properties ii2 = new Properties();
ii2.put("id2", "(toto=A)");
i2.put("requires.filters", ii2);
- instance2 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalMultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Subscriber3");
Properties ii3 = new Properties();
ii3.put("id1", "(toto=A)");
i3.put("requires.filters", ii3);
- instance3 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
} catch(Exception e) {
e.printStackTrace();
@@ -86,53 +86,53 @@
public void testMultipleNotMatch() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
assertTrue("Check service invocation", cs_instance.check());
@@ -141,28 +141,28 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
@@ -171,10 +171,10 @@
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatch() {
@@ -182,28 +182,28 @@
fooProvider1.start();
fooProvider2.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -211,7 +211,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -219,7 +219,7 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -227,7 +227,7 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -235,7 +235,7 @@
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -245,66 +245,66 @@
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleNotMatchInstance() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
fooProvider2.start();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -317,28 +317,28 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
@@ -347,10 +347,10 @@
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatchInstance() {
@@ -359,21 +359,21 @@
fooProvider2.start();
instance3.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -381,7 +381,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -389,7 +389,7 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -397,7 +397,7 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -405,7 +405,7 @@
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -414,66 +414,66 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleNotMatchInstanceWithoutFilter() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
fooProvider2.start();
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- CheckService cs2 = (CheckService) context.getService(cs_ref2);
+ CheckService cs2 = (CheckService) getContext().getService(cs_ref2);
// change the value of the property toto
cs2.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -486,28 +486,28 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
@@ -516,10 +516,10 @@
cs = null;
cs2 = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
public void testMultipleMatchInstanceWithoutFilter() {
@@ -529,21 +529,21 @@
fooProvider2.start();
instance2.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
- ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+ ServiceReference cs_ref2 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref2);
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
@@ -551,7 +551,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -559,7 +559,7 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -567,7 +567,7 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -575,7 +575,7 @@
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
@@ -584,10 +584,10 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
- context.ungetService(cs_ref2);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
+ getContext().ungetService(cs_ref2);
}
}
diff --git a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
index fe08278..628dbef 100644
--- a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
+++ b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider1.stop();
prov = new Properties();
prov.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Subscriber1");
- instance1 = Utils.getFactoryByName(context, "OptionalSimpleFilterCheckServiceSubscriber").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "OptionalSimpleFilterCheckServiceSubscriber").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Subscriber2");
Properties ii2 = new Properties();
ii2.put("id2", "(toto=A)");
i2.put("requires.filters", ii2);
- instance2 = Utils.getFactoryByName(context, "OptionalSimpleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalSimpleFilterCheckServiceSubscriber2").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Subscriber3");
Properties ii3 = new Properties();
ii3.put("id1", "(toto=A)");
i3.put("requires.filters", ii3);
- instance3 = Utils.getFactoryByName(context, "OptionalSimpleFilterCheckServiceSubscriber").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "OptionalSimpleFilterCheckServiceSubscriber").createComponentInstance(i3);
} catch(Exception e) {
e.printStackTrace();
@@ -86,81 +86,81 @@
public void testSimpleNotMatch() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 2", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertFalse("Check Nullable - 3", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 4", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertFalse("Check Nullable - 5", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 6", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertFalse("Check Nullable - 7", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 8", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
@@ -168,31 +168,31 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatch() {
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertFalse("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
@@ -200,7 +200,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -208,7 +208,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -216,7 +216,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -224,7 +224,7 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -232,7 +232,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -241,33 +241,33 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleNotMatchInstance() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -276,7 +276,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -285,7 +285,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -294,7 +294,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -302,7 +302,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -310,7 +310,7 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -318,7 +318,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -326,9 +326,9 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatchInstance() {
@@ -336,25 +336,25 @@
fooProvider1.start();
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertFalse("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -363,7 +363,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -371,7 +371,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -379,7 +379,7 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -387,7 +387,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -396,33 +396,33 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleNotMatchInstanceWithoutFilter() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
assertTrue("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -431,7 +431,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -440,7 +440,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -449,7 +449,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -457,7 +457,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -465,7 +465,7 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -473,7 +473,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -481,9 +481,9 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatchInstanceWithoutFilter() {
@@ -491,25 +491,25 @@
fooProvider1.start();
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
assertFalse("Check Nullable - 1", ((Boolean)cs_instance.getProps().get("Nullable")).booleanValue());
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -518,7 +518,7 @@
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -526,7 +526,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -534,7 +534,7 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
@@ -542,7 +542,7 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
assertTrue("Check service invocation", cs_instance.check());
assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
@@ -551,9 +551,9 @@
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
index a20c955..409e279 100644
--- a/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
+++ b/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider1.stop();
prov = new Properties();
prov.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Subscriber1");
- instance1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceSubscriber").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceSubscriber").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Subscriber2");
Properties ii2 = new Properties();
ii2.put("id2", "(toto=A)");
i2.put("requires.filters", ii2);
- instance2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceSubscriber2").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Subscriber3");
Properties ii3 = new Properties();
ii3.put("id1", "(toto=A)");
i3.put("requires.filters", ii3);
- instance3 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceSubscriber").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "SimpleFilterCheckServiceSubscriber").createComponentInstance(i3);
} catch(Exception e) {
e.printStackTrace();
@@ -86,214 +86,214 @@
public void testSimpleNotMatch() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatch() {
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleNotMatchInstance() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatchInstance() {
@@ -301,136 +301,136 @@
fooProvider1.start();
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleNotMatchInstanceWithoutFilter() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 4", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testSimpleMatchInstanceWithoutFilter() {
@@ -438,62 +438,62 @@
fooProvider1.start();
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+ CheckService cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("Check service invocation", cs_instance.check());
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
// change the value of the property toto
cs.check();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_instance_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_instance_ref);
- cs_instance = (CheckService) context.getService(cs_instance_ref);
+ cs_instance = (CheckService) getContext().getService(cs_instance_ref);
assertTrue("check CheckService invocation", cs_instance.check());
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
cs_instance = null;
- context.ungetService(cs_instance_ref);
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_instance_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index 534c85f..8dbe98e 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java
index 00ff782..3027fa0 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java
@@ -37,21 +37,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleCollectionCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleCollectionCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Optional");
- instance2 = Utils.getFactoryByName(context, "OptionalCollectionCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalCollectionCheckServiceProvider").createComponentInstance(i2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -68,19 +68,19 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -95,10 +95,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -114,10 +114,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -132,24 +132,24 @@
assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testOptional() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -165,10 +165,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -184,10 +184,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -203,10 +203,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -222,10 +222,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -241,8 +241,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedMultipleDependencies.java
index 1f9e102..4df02b9 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedMultipleDependencies.java
@@ -38,46 +38,46 @@
try {
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleMultipleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleMultipleCheckServiceProvider").createComponentInstance(i1);
instance1.stop();
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidMultipleCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidMultipleCheckServiceProvider").createComponentInstance(i2);
instance2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectMultipleCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefMultipleCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothMultipleCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothMultipleCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MapMultipleCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MapMultipleCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dict");
- instance7 = Utils.getFactoryByName(context, "DictMultipleCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "DictMultipleCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -105,14 +105,14 @@
public void testSimple() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -128,10 +128,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -147,13 +147,13 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance1.stop();
}
@@ -161,14 +161,14 @@
public void testVoid() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -184,10 +184,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -203,30 +203,30 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance2.stop();
}
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -242,10 +242,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -261,26 +261,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -296,10 +296,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -315,26 +315,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance4.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -355,10 +355,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -378,26 +378,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance5.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -418,10 +418,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -441,26 +441,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance6.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -481,10 +481,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -504,14 +504,14 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance7.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalDependencies.java
index caebfe7..8a0ff11 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalDependencies.java
@@ -39,41 +39,41 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
instance1.stop();
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
instance2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefOptionalCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothOptionalCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MapOptionalCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MapOptionalCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dict");
- instance7 = Utils.getFactoryByName(context, "DictOptionalCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "DictOptionalCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
} catch (Exception e) {
fail(e.getMessage());
@@ -103,14 +103,14 @@
public void testSimple() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
@@ -130,11 +130,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, a provider is here
@@ -153,22 +153,22 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance1.stop();
}
public void testVoid() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation - 1", ((Boolean) props.get("result")).booleanValue());
@@ -187,11 +187,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -210,22 +210,22 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance2.stop();
}
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -240,11 +240,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -259,8 +259,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
@@ -268,14 +268,14 @@
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -290,11 +290,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -309,8 +309,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
@@ -318,14 +318,14 @@
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -344,11 +344,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -367,8 +367,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance5.stop();
}
@@ -376,14 +376,14 @@
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -402,11 +402,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -425,8 +425,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance6.stop();
}
@@ -434,14 +434,14 @@
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -460,11 +460,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -483,8 +483,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance7.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalMultipleDependencies.java
index b458d9d..518a9d8 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedOptionalMultipleDependencies.java
@@ -37,31 +37,31 @@
try {
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i1);
instance1.stop();
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidOptionalMultipleCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidOptionalMultipleCheckServiceProvider").createComponentInstance(i2);
instance2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -82,14 +82,14 @@
public void testSimple() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -105,10 +105,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -124,10 +124,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -143,21 +143,21 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance1.stop();
}
public void testVoid() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -173,10 +173,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -192,10 +192,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -211,21 +211,21 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance2.stop();
}
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -241,10 +241,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue());
@@ -260,10 +260,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -279,21 +279,21 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -309,10 +309,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue());
@@ -328,10 +328,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -347,8 +347,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedSimpleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedSimpleDependencies.java
index a0b4ff0..4adf04b 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedSimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DelayedSimpleDependencies.java
@@ -37,41 +37,41 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleCheckServiceProvider").createComponentInstance(i1);
instance1.stop();
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidCheckServiceProvider").createComponentInstance(i2);
instance2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MapCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MapCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dict");
- instance7 = Utils.getFactoryByName(context, "DictCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "DictCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
} catch(Exception e) { fail(e.getMessage()); }
@@ -100,44 +100,44 @@
public void testSimple() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance1.stop();
}
public void testVoid() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -152,28 +152,28 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance2.stop();
}
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -188,29 +188,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -225,29 +225,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -267,29 +267,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance5.stop();
}
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -309,28 +309,28 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance6.stop();
}
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -350,13 +350,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance7.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
index 3db7ccc..175205a 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
@@ -42,29 +42,29 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Optional");
- instance2 = Utils.getFactoryByName(context, "SimpleOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "SimpleOptionalCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Multiple");
- instance3 = Utils.getFactoryByName(context, "SimpleMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "SimpleMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","OptionalMultiple");
- instance4 = Utils.getFactoryByName(context, "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
} catch(Exception e) {
throw new RuntimeException(e.getMessage());
}
@@ -106,9 +106,9 @@
}
public void testSimpleDependency() {
- ServiceReference arch_dep = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_dep = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_dep);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
// Check dependency handler invalidity
@@ -124,26 +124,26 @@
fooProvider1.start();
- ServiceReference arch_ps = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps);
- InstanceDescription id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ InstanceDescription id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
ProvidedServiceHandlerDescription psh = getPSDesc(id_ps);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps.getCreatedObjects().length, 1);
@@ -151,18 +151,18 @@
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
dhd = getDependencyDesc(id_dep);
assertFalse("Check dependency handler invalidity", dhd.isValid());
fooProvider1.start();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- arch_ps = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ arch_ps = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps.getState() == ComponentInstance.VALID);
psh = getPSDesc(id_ps);
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
@@ -170,36 +170,36 @@
assertEquals("Check dependency ref -3", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
psh = getPSDesc(id_ps);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertTrue("Check service reference - 1", dhd.getDependencies()[0].getUsedServices().contains(psh.getProvidedServices()[0].getServiceReference()));
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.INVALID);
dhd = getDependencyDesc(id_dep);
assertFalse("Check dependency handler invalidity", dhd.isValid());
id_dep = null;
cs = null;
- context.ungetService(arch_dep);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_dep);
+ getContext().ungetService(cs_ref);
}
public void testOptionalDependency() {
- ServiceReference arch_dep = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_dep = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_dep);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check dependency handler invalidity
@@ -215,26 +215,26 @@
fooProvider1.start();
- ServiceReference arch_ps = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps);
- InstanceDescription id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ InstanceDescription id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
ProvidedServiceHandlerDescription psh = getPSDesc(id_ps);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps.getCreatedObjects().length, 1);
@@ -242,18 +242,18 @@
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler invalidity", dhd.isValid());
fooProvider1.start();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- arch_ps = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ arch_ps = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps.getState() == ComponentInstance.VALID);
psh = getPSDesc(id_ps);
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
@@ -261,36 +261,36 @@
assertEquals("Check dependency ref -3", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps = ((Architecture) context.getService(arch_ps)).getInstanceDescription();
+ id_ps = ((Architecture) getContext().getService(arch_ps)).getInstanceDescription();
psh = getPSDesc(id_ps);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertTrue("Check service reference - 1", dhd.getDependencies()[0].getUsedServices().contains(psh.getProvidedServices()[0].getServiceReference()));
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler invalidity", dhd.isValid());
id_dep = null;
cs = null;
- context.ungetService(arch_dep);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_dep);
+ getContext().ungetService(cs_ref);
}
public void testMultipleDependency() {
- ServiceReference arch_dep = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_dep = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_dep);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.INVALID);
// Check dependency handler invalidity
@@ -305,27 +305,27 @@
fooProvider1.start();
- ServiceReference arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- InstanceDescription id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ InstanceDescription id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_ps1.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
assertEquals("Check used ref - 1 (" + dhd.getDependencies()[0].getUsedServices().size() + ")", dhd.getDependencies()[0].getUsedServices().size(), 0);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -334,32 +334,32 @@
// Start a second foo service provider
fooProvider2.start();
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
- ServiceReference arch_ps2 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider2.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps2 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
assertNotNull("Check architecture 2 availability", arch_ps2);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
- InstanceDescription id_ps2 = ((Architecture) context.getService(arch_ps2)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
+ InstanceDescription id_ps2 = ((Architecture) getContext().getService(arch_ps2)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
assertTrue("Check instance 2 invalidity - 1", id_ps2.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 3 ", dhd.getDependencies()[0].getServiceReferences().size(), 2);
assertEquals("Check used ref - 2 ", dhd.getDependencies()[0].getUsedServices().size(), 1); // provider 2 not already used
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
- id_ps2 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
+ id_ps2 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh1 = getPSDesc(id_ps1);
ProvidedServiceHandlerDescription psh2 = getPSDesc(id_ps2);
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -370,27 +370,27 @@
fooProvider2.stop();
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance validity - 1", id_ps1.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
assertEquals("Check used ref - 4 ", dhd.getDependencies()[0].getUsedServices().size(), 1);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -399,18 +399,18 @@
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertFalse("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertFalse("Check dependency handler invalidity", dhd.isValid());
fooProvider2.start();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider2.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
psh = getPSDesc(id_ps1);
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
@@ -419,15 +419,15 @@
assertEquals("Check dependency ref -3", dhd.getDependencies()[0].getServiceReferences().size(), 1);
assertEquals("Check used ref - 6 ", dhd.getDependencies()[0].getUsedServices().size(), 0);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertTrue("Check service reference - 4", dhd.getDependencies()[0].getUsedServices().contains(psh.getProvidedServices()[0].getServiceReference()));
@@ -435,21 +435,21 @@
fooProvider2.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertFalse("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertFalse("Check dependency handler invalidity", dhd.isValid());
id_dep = null;
cs = null;
- context.ungetService(arch_dep);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_dep);
+ getContext().ungetService(cs_ref);
}
public void testMultipleOptionalDependency() {
- ServiceReference arch_dep = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_dep = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_dep);
- InstanceDescription id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ InstanceDescription id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_dep.getState() == ComponentInstance.VALID);
// Check dependency handler invalidity
@@ -464,26 +464,26 @@
fooProvider1.start();
- ServiceReference arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- InstanceDescription id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ InstanceDescription id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -492,31 +492,31 @@
// Start a second foo service provider
fooProvider2.start();
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
- ServiceReference arch_ps2 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider2.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference arch_ps2 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
assertNotNull("Check architecture 2 availability", arch_ps2);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
- InstanceDescription id_ps2 = ((Architecture) context.getService(arch_ps2)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
+ InstanceDescription id_ps2 = ((Architecture) getContext().getService(arch_ps2)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
assertTrue("Check instance 2 invalidity - 1", id_ps2.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 3 ", dhd.getDependencies()[0].getServiceReferences().size(), 2);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
- id_ps2 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
+ id_ps2 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
ProvidedServiceHandlerDescription psh1 = getPSDesc(id_ps1);
ProvidedServiceHandlerDescription psh2 = getPSDesc(id_ps2);
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -526,26 +526,26 @@
fooProvider2.stop();
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider1.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler validity", dhd.isValid());
assertEquals("Check dependency ref - 2 ", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertEquals("Check POJO creation", id_ps1.getCreatedObjects().length, 1);
@@ -553,18 +553,18 @@
fooProvider1.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler invalidity", dhd.isValid());
fooProvider2.start();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- arch_ps1 = Utils.getServiceReferenceByName(context, Architecture.class.getName(), fooProvider2.getInstanceName());
+ arch_ps1 = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), fooProvider2.getInstanceName());
assertNotNull("Check architecture availability", arch_ps1);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id_ps1.getState() == ComponentInstance.VALID);
psh = getPSDesc(id_ps1);
assertTrue("Check instance validity", id_dep.getState() == ComponentInstance.VALID);
@@ -572,30 +572,30 @@
assertEquals("Check dependency ref -3", dhd.getDependencies()[0].getServiceReferences().size(), 1);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
// Check object graph
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
dhd = getDependencyDesc(id_dep);
- id_ps1 = ((Architecture) context.getService(arch_ps1)).getInstanceDescription();
+ id_ps1 = ((Architecture) getContext().getService(arch_ps1)).getInstanceDescription();
psh = getPSDesc(id_ps1);
assertEquals("Check Service Reference equality", psh.getProvidedServices()[0].getServiceReference(), dhd.getDependencies()[0].getServiceReference());
assertTrue("Check service reference - 4", dhd.getDependencies()[0].getUsedServices().contains(psh.getProvidedServices()[0].getServiceReference()));
fooProvider2.stop();
- id_dep = ((Architecture) context.getService(arch_dep)).getInstanceDescription();
+ id_dep = ((Architecture) getContext().getService(arch_dep)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id_dep.getState() == ComponentInstance.VALID);
dhd = getDependencyDesc(id_dep);
assertTrue("Check dependency handler invalidity", dhd.isValid());
id_dep = null;
cs = null;
- context.ungetService(arch_dep);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_dep);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/ListMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/ListMultipleDependencies.java
index 8c34214..5c0afee 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/ListMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/ListMultipleDependencies.java
@@ -37,21 +37,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleListCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleListCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Optional");
- instance2 = Utils.getFactoryByName(context, "OptionalListCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalListCheckServiceProvider").createComponentInstance(i2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -68,19 +68,19 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -95,10 +95,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -114,10 +114,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -132,24 +132,24 @@
assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testOptional() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -165,10 +165,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -184,10 +184,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -203,10 +203,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -222,10 +222,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -241,8 +241,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedMultipleDependencies.java
index 5997dac..f454970 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedMultipleDependencies.java
@@ -38,36 +38,36 @@
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectMultipleCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefMultipleCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothMultipleCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothMultipleCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapMultipleCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapMultipleCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dict");
- instance7 = Utils.getFactoryByName(context, "MDictMultipleCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictMultipleCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -91,17 +91,17 @@
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -117,10 +117,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -136,26 +136,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -171,10 +171,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -190,26 +190,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance4.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -229,10 +229,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -252,26 +252,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance5.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -291,10 +291,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -314,26 +314,26 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance6.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -353,10 +353,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -376,14 +376,14 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
+ getContext().ungetService(arch_ref);
instance7.stop();
- context.ungetService(cs_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalDependencies.java
index a071c88..e897558 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectOptionalCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefOptionalCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothOptionalCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapOptionalCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapOptionalCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dict");
- instance7 = Utils.getFactoryByName(context, "MDictOptionalCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictOptionalCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
} catch (Exception e) {
fail(e.getMessage());
@@ -87,14 +87,14 @@
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -111,11 +111,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -130,8 +130,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
@@ -139,14 +139,14 @@
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -161,11 +161,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -180,8 +180,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
@@ -189,14 +189,14 @@
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -215,11 +215,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -238,8 +238,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance5.stop();
}
@@ -247,14 +247,14 @@
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -273,11 +273,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -296,8 +296,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance6.stop();
}
@@ -305,14 +305,14 @@
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -331,11 +331,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -354,8 +354,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance7.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalMultipleDependencies.java
index 36ef22d..96e5f37 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedOptionalMultipleDependencies.java
@@ -38,21 +38,21 @@
try {
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -69,14 +69,14 @@
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -92,10 +92,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue());
@@ -111,10 +111,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -130,21 +130,21 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue());
@@ -160,10 +160,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue());
@@ -179,10 +179,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -198,8 +198,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedSimpleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedSimpleDependencies.java
index 9a3829c..b0e6f68 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedSimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodDelayedSimpleDependencies.java
@@ -38,31 +38,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapCheckServiceProvider").createComponentInstance(i6);
instance6.stop();
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "MDictCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictCheckServiceProvider").createComponentInstance(i7);
instance7.stop();
} catch(Exception e) { fail(e.getMessage()); }
@@ -85,15 +85,15 @@
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -108,29 +108,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -145,29 +145,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -182,29 +182,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance5.stop();
}
public void testMap() {
instance6.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -223,29 +223,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance6.stop();
}
public void testDict() {
instance7.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -264,13 +264,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance7.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodMultipleDependencies.java
index 93aaef5..b2aa4e5 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodMultipleDependencies.java
@@ -37,33 +37,33 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefMultipleCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothMultipleCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothMultipleCheckServiceProvider").createComponentInstance(i5);
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapMultipleCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapMultipleCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "MDictMultipleCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictMultipleCheckServiceProvider").createComponentInstance(i7);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -86,19 +86,19 @@
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -114,10 +114,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -133,10 +133,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -152,29 +152,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -190,10 +190,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -209,10 +209,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -228,29 +228,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -270,10 +270,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -293,10 +293,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -316,29 +316,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -358,10 +358,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -381,10 +381,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -404,29 +404,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -446,10 +446,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -469,10 +469,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -492,13 +492,13 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalDependencies.java
index 5bc6f10..8118bf5 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalDependencies.java
@@ -38,28 +38,28 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothOptionalCheckServiceProvider").createComponentInstance(i5);
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapOptionalCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapOptionalCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "MDictOptionalCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictOptionalCheckServiceProvider").createComponentInstance(i7);
} catch (Exception e) {
fail(e.getMessage());
}
@@ -82,14 +82,14 @@
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
@@ -106,11 +106,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -125,10 +125,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -143,19 +143,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -170,11 +170,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -189,10 +189,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -207,19 +207,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -234,11 +234,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -253,10 +253,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -271,19 +271,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -302,11 +302,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -325,10 +325,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -347,19 +347,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -378,11 +378,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -401,10 +401,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -423,8 +423,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalMultipleDependencies.java
index 10c246e..a1312f2 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodOptionalMultipleDependencies.java
@@ -37,21 +37,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
} catch(Exception e) { fail(e.getMessage()); }
@@ -69,14 +69,14 @@
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -92,10 +92,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -111,10 +111,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -130,10 +130,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -149,10 +149,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -168,19 +168,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -196,10 +196,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -215,10 +215,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -234,10 +234,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -253,10 +253,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -272,8 +272,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodSimpleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodSimpleDependencies.java
index 37dcefc..238a63d 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodSimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MethodSimpleDependencies.java
@@ -37,31 +37,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "MObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "MObjectCheckServiceProvider").createComponentInstance(i3);
assertNotNull("check instance 3", instance3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "MRefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "MRefCheckServiceProvider").createComponentInstance(i4);
assertNotNull("check instance 4", instance4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "MBothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "MBothCheckServiceProvider").createComponentInstance(i5);
assertNotNull("check instance 5", instance5);
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MMapCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MMapCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "MDictCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MDictCheckServiceProvider").createComponentInstance(i7);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -83,19 +83,19 @@
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -110,29 +110,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -147,29 +147,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -184,29 +184,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -225,29 +225,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -266,13 +266,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleDependencies.java
index f749e4f..837afc0 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/MultipleDependencies.java
@@ -37,29 +37,29 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleMultipleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleMultipleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidMultipleCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidMultipleCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefMultipleCheckServiceProvider").createComponentInstance(i4);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -80,19 +80,19 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -107,10 +107,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -126,10 +126,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -144,29 +144,29 @@
assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -182,10 +182,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -201,10 +201,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -220,29 +220,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -258,10 +258,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -277,10 +277,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -296,29 +296,29 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -334,10 +334,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -353,10 +353,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -372,13 +372,13 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalDependencies.java
index 7515e5e..61450be 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalDependencies.java
@@ -38,36 +38,36 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothOptionalCheckServiceProvider").createComponentInstance(i5);
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MapOptionalCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MapOptionalCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "DictOptionalCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "DictOptionalCheckServiceProvider").createComponentInstance(i7);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -91,14 +91,14 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -116,11 +116,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
@@ -138,24 +138,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -172,11 +172,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -193,10 +193,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -213,19 +213,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -238,11 +238,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -255,10 +255,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue()); // Nullable object.
@@ -271,19 +271,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -296,11 +296,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -313,10 +313,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -329,19 +329,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -354,11 +354,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -373,10 +373,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -391,19 +391,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -420,11 +420,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -443,10 +443,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -465,19 +465,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -494,11 +494,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -517,10 +517,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -539,8 +539,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleDependencies.java
index 077546f..7c1f0da 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalMultipleDependencies.java
@@ -38,29 +38,29 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidOptionalMultipleCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidOptionalMultipleCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -81,14 +81,14 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -104,10 +104,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -123,10 +123,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -142,10 +142,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -161,10 +161,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -180,19 +180,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -208,10 +208,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -227,10 +227,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -246,10 +246,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -265,10 +265,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -284,19 +284,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -312,10 +312,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -331,10 +331,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -350,10 +350,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -369,10 +369,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -388,19 +388,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -416,10 +416,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -435,10 +435,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -454,10 +454,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -473,10 +473,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -492,8 +492,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalNoNullableDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalNoNullableDependencies.java
index e4e3c31a..0326527 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalNoNullableDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/OptionalNoNullableDependencies.java
@@ -38,36 +38,36 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleOptionalNoNullableCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleOptionalNoNullableCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidOptionalNoNullableCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidOptionalNoNullableCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectOptionalNoNullableCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectOptionalNoNullableCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefOptionalNoNullableCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefOptionalNoNullableCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothOptionalNoNullableCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothOptionalNoNullableCheckServiceProvider").createComponentInstance(i5);
Properties i6 = new Properties();
i6.put("instance.name","Map");
- instance6 = Utils.getFactoryByName(context, "MapOptionalNoNullableCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "MapOptionalNoNullableCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Dictionary");
- instance7 = Utils.getFactoryByName(context, "DictOptionalNoNullableCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "DictOptionalNoNullableCheckServiceProvider").createComponentInstance(i7);
} catch(Exception e) {
e.getMessage();
fail(e.getMessage());
@@ -94,14 +94,14 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -116,11 +116,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
@@ -138,24 +138,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation - 1", props.get("result")); // Null, no provider
@@ -169,11 +169,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -190,10 +190,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result"));
@@ -207,19 +207,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -1", props.get("result")); // Null, no provider
@@ -232,11 +232,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -249,10 +249,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result")); // No provider.
@@ -265,19 +265,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -1", props.get("result")); //Null, no provider
@@ -290,11 +290,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -307,10 +307,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result")); // Null, no provider
@@ -323,19 +323,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -1", props.get("result")); // Null, no provider
@@ -348,11 +348,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -367,10 +367,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result")); // Null, no provider
@@ -385,19 +385,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -1", props.get("result")); // Null, no provider
@@ -414,11 +414,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -437,10 +437,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result")); // Null, no provider
@@ -459,19 +459,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -1", props.get("result")); // Null, no provider
@@ -488,11 +488,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -511,10 +511,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertNull("check CheckService invocation -3", props.get("result")); // Null, no provider
@@ -533,8 +533,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SetMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SetMultipleDependencies.java
index db097d4..9ec946d 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SetMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SetMultipleDependencies.java
@@ -37,21 +37,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleSetCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleSetCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Optional");
- instance2 = Utils.getFactoryByName(context, "OptionalSetCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalSetCheckServiceProvider").createComponentInstance(i2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -68,19 +68,19 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -95,10 +95,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -114,10 +114,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -132,24 +132,24 @@
assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testOptional() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -165,10 +165,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -184,10 +184,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -203,10 +203,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -222,10 +222,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -241,8 +241,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleDependencies.java
index aa26400..8c03ab2 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/SimpleDependencies.java
@@ -38,40 +38,40 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "VoidCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "VoidCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "ObjectCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "ObjectCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "RefCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "RefCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "BothCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "BothCheckServiceProvider").createComponentInstance(i5);
Properties i6 = new Properties();
i6.put("instance.name","Double");
- instance6 = Utils.getFactoryByName(context, "DoubleCheckServiceProvider").createComponentInstance(i6);
+ instance6 = Utils.getFactoryByName(getContext(), "DoubleCheckServiceProvider").createComponentInstance(i6);
Properties i7 = new Properties();
i7.put("instance.name","Map");
- instance7 = Utils.getFactoryByName(context, "MapCheckServiceProvider").createComponentInstance(i7);
+ instance7 = Utils.getFactoryByName(getContext(), "MapCheckServiceProvider").createComponentInstance(i7);
Properties i8 = new Properties();
i8.put("instance.name","Dictionary");
- instance8 = Utils.getFactoryByName(context, "DictCheckServiceProvider").createComponentInstance(i8);
+ instance8 = Utils.getFactoryByName(getContext(), "DictCheckServiceProvider").createComponentInstance(i8);
} catch(Exception e) {
e.printStackTrace();
fail(e.getMessage()); }
@@ -100,61 +100,61 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
assertTrue("check CheckService invocation", cs.check());
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- Object o = context.getService(cs_ref);
+ Object o = getContext().getService(cs_ref);
CheckService cs = (CheckService) o;
Properties props = cs.getProps();
//Check properties
@@ -170,29 +170,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -207,29 +207,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -244,29 +244,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -281,29 +281,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDouble() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance6.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance6.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance6.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance6.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
assertNotNull("Check cs", cs);
cs.check();
Properties props = cs.getProps();
@@ -320,29 +320,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testMap() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance7.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance7.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance7.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance7.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -361,29 +361,29 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testDict() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance8.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance8.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance8.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance8.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
@@ -402,13 +402,13 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/VectorMultipleDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/VectorMultipleDependencies.java
index 77f7329..9397917 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/VectorMultipleDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/VectorMultipleDependencies.java
@@ -37,21 +37,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider1");
- fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider1 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider1.stop();
Properties prov2 = new Properties();
prov2.put("instance.name","FooProvider2");
- fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+ fooProvider2 = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov2);
fooProvider2.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "SimpleVectorCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "SimpleVectorCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Optional");
- instance2 = Utils.getFactoryByName(context, "OptionalVectorCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "OptionalVectorCheckServiceProvider").createComponentInstance(i2);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -68,19 +68,19 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -95,10 +95,10 @@
assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -114,10 +114,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -132,24 +132,24 @@
assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testOptional() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
@@ -165,10 +165,10 @@
fooProvider1.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
@@ -184,10 +184,10 @@
fooProvider2.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
@@ -203,10 +203,10 @@
fooProvider1.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
@@ -222,10 +222,10 @@
fooProvider2.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
@@ -241,8 +241,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/DelayedOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/DelayedOptionalDependencies.java
index 611225b..3bcd003 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/DelayedOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/DelayedOptionalDependencies.java
@@ -39,31 +39,31 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "DISimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "DISimpleOptionalCheckServiceProvider").createComponentInstance(i1);
instance1.stop();
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "DIVoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "DIVoidOptionalCheckServiceProvider").createComponentInstance(i2);
instance2.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "DIObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "DIObjectOptionalCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "DIRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "DIRefOptionalCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "DIBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "DIBothOptionalCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
} catch (Exception e) {
fail(e.getMessage());
@@ -89,14 +89,14 @@
public void testSimple() {
instance1.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
@@ -116,11 +116,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, a provider is here
@@ -139,22 +139,22 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance1.stop();
}
public void testVoid() {
instance2.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation - 1", ((Boolean) props.get("result")).booleanValue());
@@ -173,11 +173,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -196,22 +196,22 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance2.stop();
}
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -226,11 +226,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -245,8 +245,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
@@ -254,14 +254,14 @@
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -276,11 +276,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -295,8 +295,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
@@ -304,14 +304,14 @@
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -326,11 +326,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -345,8 +345,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodDelayedOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodDelayedOptionalDependencies.java
index f87540a..a2ba8d0 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodDelayedOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodDelayedOptionalDependencies.java
@@ -39,21 +39,21 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "DIMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "DIMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
instance3.stop();
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "DIMRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "DIMRefOptionalCheckServiceProvider").createComponentInstance(i4);
instance4.stop();
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "DIMBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "DIMBothOptionalCheckServiceProvider").createComponentInstance(i5);
instance5.stop();
} catch (Exception e) {
fail(e.getMessage());
@@ -74,14 +74,14 @@
public void testObject() {
instance3.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -98,11 +98,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -117,8 +117,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance3.stop();
}
@@ -126,14 +126,14 @@
public void testRef() {
instance4.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -148,11 +148,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -167,8 +167,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
@@ -176,14 +176,14 @@
public void testBoth() {
instance5.start();
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue());
@@ -198,11 +198,11 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -217,8 +217,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
instance4.stop();
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodOptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodOptionalDependencies.java
index 82f58b5..cbfab94 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodOptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/MethodOptionalDependencies.java
@@ -39,20 +39,20 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "DIMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "DIMObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "DIMRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "DIMRefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "DIMBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "DIMBothOptionalCheckServiceProvider").createComponentInstance(i5);
} catch (Exception e) {
fail(e.getMessage());
}
@@ -71,14 +71,14 @@
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
@@ -95,11 +95,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -114,10 +114,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -132,19 +132,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -159,11 +159,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -178,10 +178,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -196,19 +196,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -1", ((Boolean) props.get("result")).booleanValue()); // False is returned (nullable)
@@ -223,11 +223,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertTrue("check CheckService invocation -2", ((Boolean) props.get("result")).booleanValue());
@@ -242,10 +242,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
// Check properties
assertFalse("check CheckService invocation -3", ((Boolean) props.get("result")).booleanValue());
@@ -260,8 +260,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
}
diff --git a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/OptionalDependencies.java b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/OptionalDependencies.java
index aed8630..d1ca439 100644
--- a/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/OptionalDependencies.java
+++ b/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/di/OptionalDependencies.java
@@ -38,28 +38,28 @@
try {
Properties prov = new Properties();
prov.put("instance.name","FooProvider");
- fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+ fooProvider = Utils.getFactoryByName(getContext(), "FooProviderType-1").createComponentInstance(prov);
fooProvider.stop();
Properties i1 = new Properties();
i1.put("instance.name","Simple");
- instance1 = Utils.getFactoryByName(context, "DISimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+ instance1 = Utils.getFactoryByName(getContext(), "DISimpleOptionalCheckServiceProvider").createComponentInstance(i1);
Properties i2 = new Properties();
i2.put("instance.name","Void");
- instance2 = Utils.getFactoryByName(context, "DIVoidOptionalCheckServiceProvider").createComponentInstance(i2);
+ instance2 = Utils.getFactoryByName(getContext(), "DIVoidOptionalCheckServiceProvider").createComponentInstance(i2);
Properties i3 = new Properties();
i3.put("instance.name","Object");
- instance3 = Utils.getFactoryByName(context, "DIObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+ instance3 = Utils.getFactoryByName(getContext(), "DIObjectOptionalCheckServiceProvider").createComponentInstance(i3);
Properties i4 = new Properties();
i4.put("instance.name","Ref");
- instance4 = Utils.getFactoryByName(context, "DIRefOptionalCheckServiceProvider").createComponentInstance(i4);
+ instance4 = Utils.getFactoryByName(getContext(), "DIRefOptionalCheckServiceProvider").createComponentInstance(i4);
Properties i5 = new Properties();
i5.put("instance.name","Both");
- instance5 = Utils.getFactoryByName(context, "DIBothOptionalCheckServiceProvider").createComponentInstance(i5);
+ instance5 = Utils.getFactoryByName(getContext(), "DIBothOptionalCheckServiceProvider").createComponentInstance(i5);
} catch(Exception e) { fail(e.getMessage()); }
}
@@ -79,14 +79,14 @@
}
public void testSimple() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance1.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance1.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
@@ -104,11 +104,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
@@ -126,24 +126,24 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testVoid() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance2.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -160,11 +160,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -181,10 +181,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -201,19 +201,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testObject() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance3.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -226,11 +226,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -243,10 +243,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -259,19 +259,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testRef() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance4.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance4.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -284,11 +284,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -301,10 +301,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -317,19 +317,19 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
public void testBoth() {
- ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.getInstanceName());
+ ServiceReference arch_ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), instance5.getInstanceName());
assertNotNull("Check architecture availability", arch_ref);
- InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ InstanceDescription id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
- ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance5.getInstanceName());
+ ServiceReference cs_ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance5.getInstanceName());
assertNotNull("Check CheckService availability", cs_ref);
- CheckService cs = (CheckService) context.getService(cs_ref);
+ CheckService cs = (CheckService) getContext().getService(cs_ref);
Properties props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
@@ -342,11 +342,11 @@
fooProvider.start();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
assertNotNull("Check CheckService availability", cs_ref);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
@@ -361,10 +361,10 @@
fooProvider.stop();
- id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+ id = ((Architecture) getContext().getService(arch_ref)).getInstanceDescription();
assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
- cs = (CheckService) context.getService(cs_ref);
+ cs = (CheckService) getContext().getService(cs_ref);
props = cs.getProps();
//Check properties
assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
@@ -379,8 +379,8 @@
id = null;
cs = null;
- context.ungetService(arch_ref);
- context.ungetService(cs_ref);
+ getContext().ungetService(arch_ref);
+ getContext().ungetService(cs_ref);
}
diff --git a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index 6abb0b1..cac57b2 100644
--- a/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/BadTests.java b/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/BadTests.java
index e9e0063..bdab8ab 100644
--- a/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/BadTests.java
+++ b/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/BadTests.java
@@ -147,12 +147,12 @@
*
*/
public void setUp() {
- m_utils = new EahTestUtils(context);
+ m_utils = new EahTestUtils(getContext());
/**
* Get the list of available components.
*/
try {
- String header = (String) context.getBundle().getHeaders().get(
+ String header = (String) getContext().getBundle().getHeaders().get(
"iPOJO-Components");
m_components = ManifestMetadataParser.parseHeaderMetadata(header)
.getElements("component");
@@ -279,21 +279,21 @@
Dictionary properties = new Hashtable();
// Provider
- ComponentFactory providerFactory = new ComponentFactory(context,
+ ComponentFactory providerFactory = new ComponentFactory(getContext(),
m_provider);
providerFactory.start();
properties.put("instance.name","Emperor of donuts");
ComponentInstance providerInstance = providerFactory
.createComponentInstance(properties);
ServiceReference providerService = IPojoTestUtils
- .getServiceReferenceByName(context, DonutProvider.class
+ .getServiceReferenceByName(getContext(), DonutProvider.class
.getName(), providerInstance.getInstanceName());
- DonutProvider provider = (DonutProvider) context
+ DonutProvider provider = (DonutProvider) getContext()
.getService(providerService);
// The consumer
properties = new Hashtable();
- ComponentFactory consumerFactory = new ComponentFactory(context,
+ ComponentFactory consumerFactory = new ComponentFactory(getContext(),
m_consumer);
consumerFactory.start();
properties.put("instance.name","Homer Simpson");
@@ -301,9 +301,9 @@
ComponentInstance consumerInstance = consumerFactory
.createComponentInstance(properties);
ServiceReference consumerService = IPojoTestUtils
- .getServiceReferenceByName(context, DonutConsumer.class
+ .getServiceReferenceByName(getContext(), DonutConsumer.class
.getName(), consumerInstance.getInstanceName());
- DonutConsumer consumer = (DonutConsumer) context
+ DonutConsumer consumer = (DonutConsumer) getContext()
.getService(consumerService);
/**
@@ -318,9 +318,9 @@
/**
* Destroy component's instances.
*/
- context.ungetService(providerService);
+ getContext().ungetService(providerService);
providerInstance.dispose();
- context.ungetService(consumerService);
+ getContext().ungetService(consumerService);
consumerInstance.dispose();
providerFactory.stop();
consumerFactory.stop();
@@ -344,7 +344,7 @@
m_publisher.removeAttribute(m_publisherName);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -376,7 +376,7 @@
m_publisher.removeAttribute(m_publisherField);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -411,7 +411,7 @@
m_publisher.addAttribute(unexistingField);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -447,7 +447,7 @@
m_publisher.addAttribute(badTypedField);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -478,7 +478,7 @@
// Remove the topics attribute of the publisher
m_publisher.removeAttribute(m_publisherTopics);
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
fact.start();
// Try to create an instance without specified topics
@@ -522,7 +522,7 @@
m_publisher.addAttribute(malformedTopics);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -559,7 +559,7 @@
m_publisher.addAttribute(malformedTopics);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
try {
fact.start();
// Should not be executed
@@ -591,7 +591,7 @@
// Remove the topics attribute of the publisher and replace with a
// malformed one
m_publisher.removeAttribute(m_publisherTopics);
- ComponentFactory fact = new ComponentFactory(context, m_provider);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_provider);
fact.start();
// Try to create an instance with malformed specified topics
@@ -634,7 +634,7 @@
m_subscriber.removeAttribute(m_subscriberName);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
try {
fact.start();
// Should not be executed
@@ -666,7 +666,7 @@
m_subscriber.removeAttribute(m_subscriberCallback);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
try {
fact.start();
// Should not be executed
@@ -696,7 +696,7 @@
// Remove the topics attribute of the subscriber
m_subscriber.removeAttribute(m_subscriberTopics);
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
fact.start();
// Try to create an instance without specified topics
@@ -741,7 +741,7 @@
m_subscriber.addAttribute(malformedTopics);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
try {
fact.start();
// Should not be executed
@@ -773,7 +773,7 @@
// Remove the topics attribute of the subscriber and replace with a
// malformed one
m_subscriber.removeAttribute(m_subscriberTopics);
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
fact.start();
// Try to create an instance with malformed specified topics
@@ -819,7 +819,7 @@
m_subscriber.addAttribute(unknownType);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
try {
fact.start();
// Should not be executed
@@ -856,7 +856,7 @@
m_subscriber.addAttribute(unknownType);
// Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(context, m_consumer);
+ ComponentFactory fact = new ComponentFactory(getContext(), m_consumer);
try {
fact.start();
// Should not be executed
diff --git a/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/GoodTests.java b/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/GoodTests.java
index 42e6272..ff949ac 100644
--- a/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/GoodTests.java
+++ b/ipojo/tests/handler/eventadmin/src/main/java/org/apache/felix/ipojo/test/GoodTests.java
@@ -283,7 +283,7 @@
throws UnacceptableConfiguration, MissingHandlerException,
ConfigurationException {
- m_utils = new EahTestUtils(context);
+ m_utils = new EahTestUtils(getContext());
Dictionary properties = new Hashtable();
// All the providers
@@ -336,9 +336,9 @@
// Get all the services references
for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
m_providersServices[i] = IPojoTestUtils.getServiceReferenceByName(
- context, DonutProvider.class.getName(),
+ getContext(), DonutProvider.class.getName(),
m_providersInstances[i].getInstanceName());
- m_providers[i] = (DonutProvider) context
+ m_providers[i] = (DonutProvider) getContext()
.getService(m_providersServices[i]);
}
m_synchronousProviders[0] = m_providers[1];
@@ -408,9 +408,9 @@
// Get all the services references
for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
m_consumersServices[i] = IPojoTestUtils.getServiceReferenceByName(
- context, DonutConsumer.class.getName(),
+ getContext(), DonutConsumer.class.getName(),
m_consumersInstances[i].getInstanceName());
- m_consumers[i] = (DonutConsumer) context
+ m_consumers[i] = (DonutConsumer) getContext()
.getService(m_consumersServices[i]);
}
m_quickConsumers[0] = m_consumers[0];
@@ -423,9 +423,9 @@
m_eventTrackerInstance = m_utils.getEventTrackerFactory()
.createComponentInstance(properties);
m_eventTrackerService = IPojoTestUtils.getServiceReferenceByName(
- context, EventTracker.class.getName(), m_eventTrackerInstance
+ getContext(), EventTracker.class.getName(), m_eventTrackerInstance
.getInstanceName());
- m_eventTracker = (EventTracker) context
+ m_eventTracker = (EventTracker) getContext()
.getService(m_eventTrackerService);
// Create the filtered consumer
@@ -440,10 +440,10 @@
.getDonutEventConsumerFactory().createComponentInstance(
properties);
m_filteredConsumersServices[i] = IPojoTestUtils
- .getServiceReferenceByName(context, DonutConsumer.class
+ .getServiceReferenceByName(getContext(), DonutConsumer.class
.getName(), m_filteredConsumersInstances[i]
.getInstanceName());
- m_filteredConsumers[i] = (DonutConsumer) context
+ m_filteredConsumers[i] = (DonutConsumer) getContext()
.getService(m_filteredConsumersServices[i]);
}
@@ -461,10 +461,10 @@
.getSynchronousDonutProviderFactory()
.createComponentInstance(properties);
m_topicsProvidersServices[i] = IPojoTestUtils
- .getServiceReferenceByName(context, DonutProvider.class
+ .getServiceReferenceByName(getContext(), DonutProvider.class
.getName(), m_topicsProvidersInstances[i]
.getInstanceName());
- m_topicsProviders[i] = (DonutProvider) context
+ m_topicsProviders[i] = (DonutProvider) getContext()
.getService(m_topicsProvidersServices[i]);
// Create consumer
@@ -476,10 +476,10 @@
m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory()
.createComponentInstance(properties);
m_topicsConsumersServices[i] = IPojoTestUtils
- .getServiceReferenceByName(context, DonutConsumer.class
+ .getServiceReferenceByName(getContext(), DonutConsumer.class
.getName(), m_topicsConsumersInstances[i]
.getInstanceName());
- m_topicsConsumers[i] = (DonutConsumer) context
+ m_topicsConsumers[i] = (DonutConsumer) getContext()
.getService(m_topicsConsumersServices[i]);
topics.remove("donut-subscriber");
}
@@ -721,23 +721,23 @@
public void tearDown() {
int index;
for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
- context.ungetService(m_providersServices[index]);
+ getContext().ungetService(m_providersServices[index]);
m_providersInstances[index].dispose();
}
for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
- context.ungetService(m_consumersServices[index]);
+ getContext().ungetService(m_consumersServices[index]);
m_consumersInstances[index].dispose();
}
- context.ungetService(m_eventTrackerService);
+ getContext().ungetService(m_eventTrackerService);
m_eventTrackerInstance.dispose();
for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- context.ungetService(m_filteredConsumersServices[i]);
+ getContext().ungetService(m_filteredConsumersServices[i]);
m_filteredConsumersInstances[i].dispose();
}
for (int i = 0; i < TOPICS_LIST.length; i++) {
- context.ungetService(m_topicsProvidersServices[i]);
+ getContext().ungetService(m_topicsProvidersServices[i]);
m_topicsProvidersInstances[i].dispose();
- context.ungetService(m_topicsConsumersServices[i]);
+ getContext().ungetService(m_topicsConsumersServices[i]);
m_topicsConsumersInstances[i].dispose();
}
diff --git a/ipojo/tests/integration-tests/pom.xml b/ipojo/tests/integration-tests/pom.xml
index f795d99..f1fb35c 100644
--- a/ipojo/tests/integration-tests/pom.xml
+++ b/ipojo/tests/integration-tests/pom.xml
@@ -13,8 +13,7 @@
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix.ipojo.junit4osgi
- </groupId>
+ <groupId>org.apache.felix</groupId>
<artifactId>maven-junit4osgi-plugin
</artifactId>
<version>1.1.0-SNAPSHOT</version>
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index eec3052..7fea38d 100644
--- a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
index 78e92e9..165d1e1 100644
--- a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
@@ -217,11 +217,11 @@
* Not manipulated.
*/
public void testCustomConstuctor() {
- FooService fs = new FooProviderType1(0, "foo", context);
+ FooService fs = new FooProviderType1(0, "foo", getContext());
Properties props = fs.fooProps();
assertEquals("Check bar", 0, ((Integer) props.get("bar")).intValue());
assertEquals("Check foo", "foo", props.get("foo"));
- assertEquals("Check context", context, props.get("context"));
+ assertEquals("Check context", getContext(), props.get("context"));
}
public void testSuperCall() {
diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index eec3052..7fea38d 100644
--- a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ExceptionTest.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ExceptionTest.java
index 737edbe..a0761e0 100644
--- a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ExceptionTest.java
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ExceptionTest.java
@@ -82,7 +82,7 @@
public void testTry() {
ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",ref);
- FooProviderType1 fs = (FooProviderType1) context.getService(ref);
+ FooProviderType1 fs = (FooProviderType1) getServiceObject(ref);
try {
fs.testTry();
} catch(Exception e) {
diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/GetComponentInstanceTest.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/GetComponentInstanceTest.java
index 1789a47..04efa5d 100644
--- a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/GetComponentInstanceTest.java
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/GetComponentInstanceTest.java
@@ -87,9 +87,6 @@
assertEquals("Check created pojo count", id.getCreatedObjects().length, 1);
assertEquals("Check instance description name", id.getName(), compName);
- // Unget the service
- context.ungetService(ref);
-
ci.dispose();
// Check that there is no more FooService
diff --git a/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java b/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java
index 0dba85d..6128a1d 100644
--- a/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java
+++ b/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/Annotation.java
@@ -13,7 +13,7 @@
public void setUp() {
try {
- clazz = context.getBundle().
+ clazz = getContext().getBundle().
loadClass("org.apache.felix.ipojo.test.scenarios.component.Annotation");
} catch (ClassNotFoundException e) {
fail("Cannot load the annotation class : " + e.getMessage());
diff --git a/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java b/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
index eec3052..7fea38d 100644
--- a/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
+++ b/ipojo/tests/manipulator/metadata/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {