}
// Test: Get jiplet properties from a nonexistent context
try
{
JipletElement ele = container.getJipletProperty(context + "bogus",
full_jiplet);
fail("Jiplet property element returned for nonexistent context");
}
catch (Exception e)
{
}
// Test: Get jiplet properties for a nonexistent jiplet
try
{
JipletElement ele = container.getJipletProperty(context,
full_jiplet + "bogus");
fail("Jiplet property element is not null for nonexistent jiplet");
}
catch (Exception e)
{
}
// Test: Verify getting the full set of jiplet properties
JipletElement ele = null;
try
{
ele = container.getJipletProperty(context, full_jiplet);
}
catch (Exception e)
{
fail("Error getting Jiplet property element for full jiplet");
}
assertEquals("Jiplet property returned unexpected name",
"Example TEST SIP Registrar Jiplet", ele.getName());
assertEquals(
"Jiplet property returned unexpected description",
"This jiplet will receive REGISTER message in order to register user location",
removeWhitespace(ele.getDescription()));
assertEquals("Jiplet property returned unexpected connector name",
"sip-connector", ele.getConnectorName());
assertEquals("Jiplet property returned unexpected parent context",
context, ele.getParentContext());
// check init params
HashMap params = ele.getInitParams();
assertNotNull("Jiplet property returned null init params", params);
assertEquals("Incorrect number of init params", 2, params.size());
// param 1
assertEquals("sample-param init param is missing", true, params
.containsKey("sample-param"));
String value = (String) params.get("sample-param");
assertEquals("sample-param init param has the wrong value",
"some value", value);
// param 2
assertEquals("another-param init param is missing", true, params
.containsKey("another-param"));
value = (String) params.get("another-param");
assertEquals("another-param init param has the wrong value",
"another value", value);
// Test: Get properties for a minimally defined jiplet
try
{
ele = container.getJipletProperty(context, min_jiplet);
}
catch (Exception e)
{
fail("Error getting Jiplet property element for minimal jiplet");
}
assertEquals("Jiplet property returned unexpected name",
"Minimal TEST Jiplet", ele.getName());
assertEquals("Jiplet property returned unexpected description",
"no description available", ele.getDescription());
assertEquals("Jiplet property returned unexpected connector name",
container.getDefaultConnectorName(), ele.getConnectorName());
assertEquals("Jiplet property returned unexpected parent context",
context, ele.getParentContext());
// check init params
params = ele.getInitParams();
assertNull("Jiplet property returned non-null init params", params);
ArrayList list = ele.getSelectionCriteria();
assertNotNull("The selection criteria for the jiplet returned null",
list);
assertEquals(
"The selection criteria returned invalid number of selection criteria",
1, list.size());