You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/12/01 18:44:17 UTC
svn commit: r722146 [7/15] - in /felix/trunk/ipojo:
examples/junit4osgi/felix-command/ examples/junit4osgi/immediate-launcher/
examples/junit4osgi/junit4osgi/ examples/junit4osgi/maven-junit4osgi-plugin/
examples/junit4osgi/swing-runner/ tests/composit...
Modified: felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/MultipleDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
Modified: felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/OptionalDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
Modified: felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-bindingpolicy/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/statics/SimpleDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
}
Modified: felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/FromDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}