contexts.length);
assertEquals("Context name does not match", "deploy", contexts[0]);
// Test: Get the property of the deployed context. Check that the
// properties match.
ContextElement element = null;
try
{
element = container.getContextProperty("deploy");
}
catch (Exception e)
{
fail("Error getting context property");
}
assertNotNull(element);
assertEquals("getContextProperty returned invalid name", "deploy",
element.getName());
File f = new File(deploy_dir, "deploy");
assertEquals("getContextProperty returned invalid path", f.toURL()
.toString(), (new File(element.getPath())).toURL().toString());
assertEquals("getDisplayName returned unexpected name",
"Example TEST Context", element.getDisplayName());
assertEquals("getTypeDescription returned invalid deployment type",
"Deployed", element.getTypeDescription());
ArrayList criteria = element.getSelectionCriteria();
assertNotNull("The selection criteria for the context does not exist",
criteria);
assertEquals("The number of selection criteria do not match", 1,
criteria.size());
String criterion = (String) criteria.get(0);
assertEquals("The criterion does not match",
"sip-connector:(request.uri subdomain-of \"quik-j.com\")",
criterion);
// Test: Get the property of a context that is not deployed.
try
{
element = container.getContextProperty("test-context-1");
fail("Got properties of nonexistent context");
}
catch (Exception e)
{
}
// Test: Delete the context created above. Check that the delete
// operation is successful.
try
{
container.deleteContext("deploy");
}
catch (Exception e)
{
fail("The context could not be deleted: " + e.getMessage());
}
// Test: Delete a context that has not been created. Check that the
// delete operation fails.
try
{
container.deleteContext("test-context-2");
fail("The bogus context was deleted successfully");
}
catch (Exception e)
{
}
// Test: Start the example spr application . Check that it is started.
try
{
container.createContext(exampleAppSpr, "my-renamed-context", null);
}
catch (Exception e)
{
fail("The context could not be added");
}
// Test: Get a list of deployed context. Check that the list contains
// one element
contexts = container.listContexts();
assertNotNull("listContexts() returned a null object", contexts);
assertEquals("listContexts() returned a empty string", 1,
contexts.length);
assertEquals("Context name does not match", "my-renamed-context",
contexts[0]);
// Test: Get the property of the deployed context. Check that the
// properties match.
try
{
element = container.getContextProperty("my-renamed-context");
}
catch (Exception e)
{
fail("Error getting context property");
}
assertNotNull(element);
assertEquals("getContextProperty returned invalid name",
"my-renamed-context", element.getName());
f = new File(deploy_dir, "my-renamed-context");
assertEquals("getContextProperty returned invalid path", f.toURL()
.toString(), (new File(element.getPath())).toURL().toString());
// Test: Delete the context created above. Check that the delete
// operation is successful.
try
{