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 [4/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/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java (original)
+++ felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java Mon Dec 1 09:44:13 2008
@@ -20,8 +20,8 @@
private ConfigurationAdmin admin;
public void setUp() {
- factory = (ComponentFactory) Utils.getFactoryByName(context, "CA-ConfigurableProvider");
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factory = (ComponentFactory) Utils.getFactoryByName(getContext(), "CA-ConfigurableProvider");
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
try {
Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ConfigurableProvider)");
@@ -78,16 +78,16 @@
System.out.println("PID : " + pid);
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -102,11 +102,11 @@
fail(e.getMessage());
}
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -119,7 +119,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -146,8 +146,8 @@
String pid = configuration.getPid();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -160,16 +160,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 1, count);
@@ -182,7 +182,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -208,22 +208,22 @@
String pid = configuration.getPid();
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message", mes);
assertEquals("Assert count", 1, count);
@@ -242,11 +242,11 @@
System.out.println("===");
- fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 2, count);
@@ -259,7 +259,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
@@ -287,14 +287,14 @@
String pid = configuration.getPid();
System.out.println("PID : " + pid);
- assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+ assertNull("check no instance", Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")"));
factory.start();
// The instance should be created, wait for the architecture service
- Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
- Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Utils.waitForService(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
+ Architecture architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
@@ -307,16 +307,16 @@
fail(e.getMessage());
}
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
//Invoke
- FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ FooService fs = (FooService) Utils.getServiceObject(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
- architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+ architecture = (Architecture) Utils.getServiceObject(getContext(), Architecture.class.getName(), "(architecture.instance="+pid+")");
assertEquals("Assert Message", "message2", mes);
assertEquals("Assert count", 1, count);
@@ -329,7 +329,7 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+ ServiceReference ref = Utils.getServiceReference(getContext(), FooService.class.getName(), "(instance.name=" + pid + ")");
assertNull("Check unavailability", ref);
}
Modified: felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java (original)
+++ felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java Mon Dec 1 09:44:13 2008
@@ -28,11 +28,11 @@
public void setUp() {
- factImm = (ComponentFactory) Utils.getFactoryByName(context, factNameImm);
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factImm = (ComponentFactory) Utils.getFactoryByName(getContext(), factNameImm);
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
cleanConfigurationAdmin();
- listener = new ConfigurationMonitor(context);
+ listener = new ConfigurationMonitor(getContext());
}
public void tearDown() {
@@ -67,11 +67,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -95,11 +95,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -128,14 +128,14 @@
}
- Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ Architecture arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- FooService fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -159,13 +159,13 @@
fail(e.getMessage());
}
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -210,11 +210,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
// int count1 = ((Integer) p.get("count")).intValue();
@@ -250,11 +250,11 @@
} catch (Exception e) {
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
// int count = ((Integer) p.get("count")).intValue();
@@ -296,11 +296,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
// int count = ((Integer) p.get("count")).intValue();
@@ -336,11 +336,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
// count = ((Integer) p.get("count")).intValue();
Modified: felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java (original)
+++ felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java Mon Dec 1 09:44:13 2008
@@ -28,11 +28,11 @@
public void setUp() {
- factSvc = (ComponentFactory) Utils.getFactoryByName(context, factNameSvc);
- admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+ factSvc = (ComponentFactory) Utils.getFactoryByName(getContext(), factNameSvc);
+ admin = (ConfigurationAdmin) Utils.getServiceObject(getContext(), ConfigurationAdmin.class.getName(), null);
assertNotNull("Check configuration admin availability", admin);
cleanConfigurationAdmin();
- listener = new ConfigurationMonitor(context);
+ listener = new ConfigurationMonitor(getContext());
}
public void tearDown() {
@@ -67,11 +67,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -94,11 +94,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -127,14 +127,14 @@
}
- Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ Architecture arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check no object", 0, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- FooService fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -157,13 +157,13 @@
fail(e.getMessage());
}
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), conf.getPid());
assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
- fs = (FooService) context.getService(ref);
+ arch = (Architecture) Utils.getServiceObject(getContext(), org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -208,11 +208,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -248,11 +248,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
@@ -294,11 +294,11 @@
fail(e.getMessage());
}
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties p = fs.fooProps();
String mes = p.getProperty("message");
int count = ((Integer) p.get("count")).intValue();
@@ -334,11 +334,11 @@
fail(e.getMessage());
}
- ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
assertNotNull("FS availability", ref);
- fs = (FooService) context.getService(ref);
+ fs = (FooService) getContext().getService(ref);
p = fs.fooProps();
mes = p.getProperty("message");
count = ((Integer) p.get("count")).intValue();
Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/DynamicallyConfigurableProperties.java Mon Dec 1 09:44:13 2008
@@ -40,12 +40,12 @@
p1.put("foo", "foo");
p1.put("bar", "2");
p1.put("baz", "baz");
- instance = Utils.getComponentInstance(context, type, p1);
+ instance = Utils.getComponentInstance(getContext(), type, p1);
Properties p2 = new Properties();
p2.put("instance.name","instance2");
- instance2 = Utils.getComponentInstance(context, type, p2);
+ instance2 = Utils.getComponentInstance(getContext(), type, p2);
}
public void tearDown() {
@@ -56,7 +56,7 @@
}
public void testStatic() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -65,7 +65,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
@@ -74,24 +74,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testStaticNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
Object barP = fooRef.getProperty("bar");
@@ -100,7 +100,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
@@ -109,24 +109,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testDynamic() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -137,7 +137,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -145,13 +145,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -161,7 +161,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -169,12 +169,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -184,7 +184,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -192,13 +192,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -208,7 +208,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -216,13 +216,13 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicString() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -233,7 +233,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -241,13 +241,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", "0");
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -257,7 +257,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -265,12 +265,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testPropagation() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -281,7 +281,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -291,13 +291,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -312,11 +312,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationNoValue() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -326,7 +326,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByName(context, ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+ ServiceReference msRef = Utils.getServiceReferenceByName(getContext(), ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -336,13 +336,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedServiceFactory ms = (ManagedServiceFactory) context.getService(msRef);
+ ManagedServiceFactory ms = (ManagedServiceFactory) getContext().getService(msRef);
try {
ms.updated(instance2.getInstanceName(), conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -357,7 +357,7 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
}
Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/ManagedServiceConfigurableProperties.java Mon Dec 1 09:44:13 2008
@@ -52,7 +52,7 @@
p.put("foo", "foo");
p.put("bar", "2");
p.put("baz", "baz");
- instance1 = Utils.getComponentInstance(context, type, p);
+ instance1 = Utils.getComponentInstance(getContext(), type, p);
assertEquals("instance1 created", ComponentInstance.VALID,instance1.getState());
type = "CONFIG-FooProviderType-3";
@@ -62,13 +62,13 @@
p1.put("bar", "2");
p1.put("baz", "baz");
p1.put("managed.service.pid", "instance");
- instance2 = Utils.getComponentInstance(context, type, p1);
+ instance2 = Utils.getComponentInstance(getContext(), type, p1);
type = "CONFIG-FooProviderType-3";
Properties p2 = new Properties();
p2.put("instance.name","instance-3");
p2.put("managed.service.pid", "instance-3");
- instance3 = Utils.getComponentInstance(context, type, p2);
+ instance3 = Utils.getComponentInstance(getContext(), type, p2);
}
public void tearDown() {
@@ -81,7 +81,7 @@
}
public void testStaticInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -90,7 +90,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -98,24 +98,24 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Re-check props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testStaticInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
Integer barP = (Integer) fooRef.getProperty("bar");
@@ -124,7 +124,7 @@
assertEquals("Check bar equality -1", barP, new Integer(2));
assertEquals("Check baz equality -1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
@@ -133,25 +133,25 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testStaticInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
Object barP = fooRef.getProperty("bar");
@@ -161,7 +161,7 @@
assertEquals("Check bar equality -1", barP, null);
assertEquals("Check baz equality -1", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedService availability", msRef);
@@ -170,25 +170,25 @@
conf.put("baz", "zab");
conf.put("bar", new Integer(2));
conf.put("foo", "foo");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
assertEquals("Check foo equality -2", fooP, "foo");
assertEquals("Check bar equality -2", barP, new Integer(2));
assertEquals("Check baz equality -2", bazP, "zab");
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -199,7 +199,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -207,13 +207,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Re-check props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -223,7 +223,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -231,12 +231,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -247,7 +247,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -255,13 +255,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -271,7 +271,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -279,12 +279,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -295,7 +295,7 @@
assertEquals("Check bar equality", barP, null);
assertEquals("Check baz equality", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedServiceFactory availability", msRef);
// Configuration of baz
@@ -303,13 +303,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", new Integer(0));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -319,7 +319,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -327,13 +327,13 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicStringInstance1() {
assertEquals("Check instance1 state", ComponentInstance.VALID,instance1.getState());
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -344,7 +344,7 @@
assertEquals("Check bar equality - 1", barP, new Integer(2));
assertEquals("Check baz equality - 1", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -353,7 +353,7 @@
conf.put("foo", "oof");
conf.put("bar", "0");
assertEquals("Check instance1 state (2)", ComponentInstance.VALID,instance1.getState());
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
PrimitiveHandler ph = (PrimitiveHandler) ms;
assertSame("Check the correct instance", ph.getInstanceManager(), instance1);
@@ -364,7 +364,7 @@
assertEquals("Check instance1 state (3)", ComponentInstance.VALID,instance1.getState());
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -374,7 +374,7 @@
assertEquals("Check baz equality - 2", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -382,12 +382,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testDynamicStringInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -398,7 +398,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -406,13 +406,13 @@
conf.put("baz", "zab");
conf.put("foo", "oof");
conf.put("bar", "0");
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -422,7 +422,7 @@
assertEquals("Check baz equality", bazP, "zab");
// Check field value
- FooService fs = (FooService) context.getService(fooRef);
+ FooService fs = (FooService) getContext().getService(fooRef);
Properties p = fs.fooProps();
fooP = (String) p.get("foo");
barP = (Integer) p.get("bar");
@@ -430,12 +430,12 @@
assertEquals("Check foo field equality", fooP, "oof");
assertEquals("Check bar field equality", barP, new Integer(0));
- context.ungetService(fooRef);
- context.ungetService(msRef);
+ getContext().ungetService(fooRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance1() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -446,7 +446,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "FooProvider-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "FooProvider-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -456,13 +456,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance1.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance1.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -477,11 +477,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance2() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
assertNotNull("Check FS availability", fooRef);
String fooP = (String) fooRef.getProperty("foo");
@@ -492,7 +492,7 @@
assertEquals("Check bar equality", barP, new Integer(2));
assertEquals("Check baz equality", bazP, "baz");
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -502,13 +502,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance2.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance2.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -523,11 +523,11 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
public void testPropagationInstance3() {
- ServiceReference fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ ServiceReference fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
assertNotNull("Check FS availability", fooRef);
Object fooP = fooRef.getProperty("foo");
@@ -538,7 +538,7 @@
assertEquals("Check bar equality", barP, null);
assertEquals("Check baz equality", bazP, null);
- ServiceReference msRef = Utils.getServiceReferenceByPID(context, ManagedService.class.getName(), "instance-3");
+ ServiceReference msRef = Utils.getServiceReferenceByPID(getContext(), ManagedService.class.getName(), "instance-3");
assertNotNull("Check ManagedService availability", msRef);
// Configuration of baz
@@ -548,13 +548,13 @@
conf.put("bar", new Integer(2));
conf.put("propagated1", "propagated");
conf.put("propagated2", new Integer(1));
- ManagedService ms = (ManagedService) context.getService(msRef);
+ ManagedService ms = (ManagedService) getContext().getService(msRef);
try {
ms.updated(conf);
} catch (ConfigurationException e) { fail("Configuration Exception : " + e); }
// Recheck props
- fooRef = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance3.getInstanceName());
+ fooRef = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), instance3.getInstanceName());
fooP = (String) fooRef.getProperty("foo");
barP = (Integer) fooRef.getProperty("bar");
bazP = (String) fooRef.getProperty("baz");
@@ -569,7 +569,7 @@
assertEquals("Check propagated1 equality", prop1, "propagated");
assertEquals("Check propagated2 equality", prop2, new Integer(1));
- context.ungetService(msRef);
+ getContext().ungetService(msRef);
}
}
Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java?rev=722146&r1=722145&r2=722146&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/SimpleProperties.java Mon Dec 1 09:44:13 2008
@@ -37,7 +37,7 @@
Properties p1 = new Properties();
p1.put("instance.name","FooProvider-1");
- fooProvider1 = Utils.getComponentInstance(context, type, p1);
+ fooProvider1 = Utils.getComponentInstance(getContext(), type, p1);
Properties p2 = new Properties();
p2.put("instance.name","FooProvider-2");
@@ -46,11 +46,11 @@
p2.put("string", new String("bar"));
p2.put("strAProp", new String[] {"bar", "foo"});
p2.put("intAProp", new int[] {1, 2, 3});
- fooProvider2 = Utils.getComponentInstance(context, type, p2);
+ fooProvider2 = Utils.getComponentInstance(getContext(), type, p2);
Properties p3 = new Properties();
p3.put("instance.name","FooProvider-3");
- fooProvider3 = Utils.getComponentInstance(context, "CONFIG-FooProviderType-ConfNoValue", p3);
+ fooProvider3 = Utils.getComponentInstance(getContext(), "CONFIG-FooProviderType-ConfNoValue", p3);
}
public void tearDown() {
@@ -63,9 +63,9 @@
}
public void testComponentTypeConfiguration() {
- ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), fooProvider1.getInstanceName());
+ ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check FooService availability", ref);
- FooService fs = (FooService) context.getService(ref);
+ FooService fs = (FooService) getContext().getService(ref);
Properties toCheck = fs.fooProps();
Integer intProp = (Integer) toCheck.get("intProp");
@@ -115,14 +115,14 @@
}
fs = null;
- context.ungetService(ref);
+ getContext().ungetService(ref);
}
public void testInstanceConfiguration() {
- ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-2");
+ ServiceReference sr = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "FooProvider-2");
assertNotNull("Check the availability of the FS service", sr);
- FooService fs = (FooService) context.getService(sr);
+ FooService fs = (FooService) getContext().getService(sr);
Properties toCheck = fs.fooProps();
// Check service properties
@@ -172,14 +172,14 @@
}
fs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
public void testNoValue() {
- ServiceReference sr = Utils.getServiceReferenceByName(context, FooService.class.getName(), "FooProvider-3");
+ ServiceReference sr = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), "FooProvider-3");
assertNotNull("Check the availability of the FS service", sr);
- FooService fs = (FooService) context.getService(sr);
+ FooService fs = (FooService) getContext().getService(sr);
Properties toCheck = fs.fooProps();
// Check service properties
@@ -220,7 +220,7 @@
}
fs = null;
- context.ungetService(sr);
+ getContext().ungetService(sr);
}
}