}
public void testComponentTypeConfiguration() {
ServiceReference ref = Utils.getServiceReferenceByName(getContext(), FooService.class.getName(), fooProvider1.getInstanceName());
assertNotNull("Check FooService availability", ref);
FooService fs = (FooService) getContext().getService(ref);
Properties toCheck = fs.fooProps();
Integer intProp = (Integer) toCheck.get("intProp");
Boolean boolProp = (Boolean) toCheck.get("boolProp");
String strProp = (String) toCheck.get("strProp");
String[] strAProp = (String[]) toCheck.get("strAProp");
int[] intAProp = (int[]) toCheck.get("intAProp");
// Check updated
Integer updated = (Integer) toCheck.get("updated");
Dictionary dict = (Dictionary) toCheck.get("lastupdated");
assertEquals("Check intProp equality (1)", intProp, new Integer(2));
assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
assertEquals("Check strProp equality (1)", strProp, new String("foo"));
assertNotNull("Check strAProp not nullity (1)", strAProp);
String[] v = new String[] {"foo", "bar"};
for (int i = 0; i < strAProp.length; i++) {
if(!strAProp[i].equals(v[i])) { fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]); }
}
assertNotNull("Check intAProp not nullity", intAProp);
int[] v2 = new int[] {1, 2, 3};
for (int i = 0; i < intAProp.length; i++) {
if(intAProp[i] != v2[i]) { fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]); }
}
assertEquals("updated count ", 1, updated.intValue());
assertEquals("Last updated", 5, dict.size());
// change the field value
assertTrue("Invoke the fs service", fs.foo());
toCheck = fs.fooProps();
// Re-check the property (change)
intProp = (Integer) toCheck.get("intProp");
boolProp = (Boolean) toCheck.get("boolProp");