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 [9/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-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.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/OptionalSimpleFilterDependencies.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/OptionalSimpleFilterDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/OptionalSimpleFilterDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
}
Modified: felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.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/SimpleFilterDependencies.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/SimpleFilterDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency-filter/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/filter/SimpleFilterDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
}
Modified: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooProviderType1.java Mon Dec 1 09:44:13 2008
@@ -50,7 +50,7 @@
if (bc ==null) {
throw new RuntimeException("Injected bundle context null");
}
- m_context = bc;
+ m_context = bc;
}
public boolean foo() {
Modified: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java (original)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/CollectionMultipleDependencies.java Mon Dec 1 09:44:13 2008
@@ -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);
}
}