Author: angelo.vandersijpt at luminis.eu
Date: Thu Oct 28 13:55:38 2010
New Revision: 213
Log:
AMDATU-121 Refactored the testing mechanism for a little more fine-grained
tests, and to reduce boiler plate in testing code.
Added:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/IntegrationTestBase.java
Removed:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/IntegrationTestRunner.java
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
Added:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/IntegrationTestBase.java
==============================================================================
--- (empty file)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/base/IntegrationTestBase.java
Thu Oct 28 13:55:38 2010
@@ -0,0 +1,292 @@
+/*
+ Copyright (C) 2010 Amdatu.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.amdatu.test.integration.base;
+
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentStateListener;
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.tracker.ServiceTracker;
+import org.junit.Assert;
+import org.junit.Before;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * This class works as a base for all our integration tests. The notable
components,
+ * <ul>
+ * <li>{@link #getDependencies} allows you to give a set of Dependency Manager
Components, which should all be
+ * started before the tests get started.</li>
+ * <li>{@link #configure} gives a standard set of options to start an
integration test. This configuration uses all
+ * Amdatu bundles; your test likely doesn't need that.</li>
+ * </ul>
+ */
+public abstract class IntegrationTestBase {
+ public final static String TEST_PREFIX = "> TESTING: ";
+ public final static int SERVICE_TIMEOUT = 30;
+
+ @Inject
+ protected BundleContext m_bundleContext;
+
+ protected DependencyManager m_manager;
+
+ /**
+ * This base-configure method includes all default options, and
instantiates all of Amdatu
+ */
+ public Option[] configure() {
+ return options(
+ mavenConfiguration(),
+
+ // Run test in a Felix container
+ frameworks(felix()),
+
+ // Setting this system property unfortunately is necessary with
the current Cassandra implementation
+
systemProperty("org.osgi.framework.system.packages.extra").value("sun.misc,com.sun.management"),
+
+ // Enable this line to allow a remote debugger to attach to the VM
in which Pax Exam runs
+ // new
VMOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+
+ // Install bundles we need to execute our test
+ provision(
+ compendium(),
+ dependencyManager(),
+ configAdmin(),
+ felixLog(),
+ paxWebJetty(),
+ PaxWebJsp(),
+ paxUserAdmin(),
+ slingMime(),
+ slingCommons(),
+ felixScr(),
+
+ // Amdatu platform bundles
+ // TODO: this works fine when running 'mvn install' since the
artifacts will then be deployed to the maven
+ // repository prior to running this integration test. With
'mvn integration-test' however, artifacts will
+ // not be deployed and so this will only work when artifacts
have been deployed to the maven repository
+ // before, possibly using outdated artifacts.
+ fileBasedConfiguration(),
+ amdatuHttpContext(),
+ amdatuConfigTemplateManager(),
+ amdatuCassandraApplication(),
+ amdatuShindigApplication(),
+ amdatuCassandraListener(),
+ amdatuCassandraPersistenceManager(),
+ amdatuTenantService(),
+ amdatuUserAdminCassandraStore(),
+ amdatuWink()
+
+ // And finally deploy ourselves
+// bundle(integrationTestJarFile().toURI().toString())
+ ));
+ }
+
+ /**
+ * Gets a list of Component objects which should be started before
+ * the test can start. You can include the test class in this too, so
+ * you can get the services you depend on injected.
+ */
+ protected Component[] getDependencies(DependencyManager manager) {
+ return new Component[0];
+ }
+
+ @Before
+ public void setupTest() {
+ m_manager = new DependencyManager(m_bundleContext);
+ Component[] components = getDependencies(m_manager);
+
+ final Semaphore semaphore = new Semaphore(1 - components.length);
+
+ ComponentStateListener listener = new ComponentCounter(semaphore);
+
+ // Register our listener for all the services...
+ for (Component component : components) {
+ component.addStateListener(listener);
+ }
+
+ // Then give them to the dependency manager...
+ for (Component component : components) {
+ m_manager.add(component);
+ }
+
+ // And wait for all the services to become active.
+ try {
+ if (!semaphore.tryAcquire(SERVICE_TIMEOUT, TimeUnit.SECONDS)) {
+ Assert.fail("Timed out waiting for all services to get
started, still "
+ + (-semaphore.availablePermits()) + " to go.");
+ }
+ }
+ catch (InterruptedException e) {
+ Assert.fail("Interrupted while waiting for services to get
started.");
+ }
+ }
+
+ /**
+ * Helper class that releases the given semaphore when each service it is
+ * listening to gets started.
+ */
+ private static class ComponentCounter implements ComponentStateListener {
+ private final Semaphore m_releaseOnStarted;
+
+ public ComponentCounter(Semaphore releaseOnStarted) {
+ m_releaseOnStarted = releaseOnStarted;
+ }
+
+ public void starting(Component component) {}
+
+ public void started(Component component) {
+ m_releaseOnStarted.release();
+ }
+
+ public void stopping(Component component) {}
+
+ public void stopped(Component component) {}
+ };
+
+ /**
+ * Helper method to get a given service by class. Will wait for
SERVICE_TIMEOUT seconds for the service,
+ * and fail if it does not become available.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> T getService(Class<T> serviceClass) {
+ T serviceInstance = null;
+
+ // First open a service tracker and wait let the service tracker wait
for the availability of our service
+ ServiceTracker serviceTracker = new ServiceTracker(m_bundleContext,
serviceClass.getName(), null);
+ serviceTracker.open();
+ try {
+ serviceInstance = (T)
serviceTracker.waitForService(SERVICE_TIMEOUT * 1000);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ Assert.fail(TEST_PREFIX + serviceClass + " service not available:
" + e.toString());
+ }
+
+ // Sometimes the service tracker is lying when he says that the
service is available, so check it!
+ ServiceReference serviceRef =
m_bundleContext.getServiceReference(serviceClass.getName());
+ if (serviceRef == null) {
+ Assert.fail("Service " + serviceClass + " not available, quitting
integration test");
+ }
+ else {
+ serviceInstance = (T) m_bundleContext.getService(serviceRef);
+ }
+
+ return serviceInstance;
+ }
+
+ protected File integrationTestJarFile() {
+ FileFilter ff = new FileFilter() {
+ public boolean accept(File pathname) {
+ return
pathname.getName().startsWith("org.amdatu.platform.integration-tests-")
+ && pathname.getName().endsWith(".jar");
+ }
+ };
+ return new File("target").listFiles(ff)[0];
+ }
+
+ ////////////////////////////////////////////////////////////
+ // A load of Pax Exam definitions for easier provisioning
+
+ protected static MavenArtifactProvisionOption amdatuWink() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("wink-application").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption
amdatuUserAdminCassandraStore() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("useradmin-cassandra-store").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption amdatuTenantService() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("tenant-service").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption
amdatuCassandraPersistenceManager() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("cassandra-persistencemanager").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption amdatuCassandraListener() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("cassandra-listener").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption amdatuShindigApplication() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("shindig-application").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption amdatuCassandraApplication()
{
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("cassandra-application").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption
amdatuConfigTemplateManager() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("config-template-manager").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption amdatuHttpContext() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("httpcontext").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption fileBasedConfiguration() {
+ return
mavenBundle().groupId("org.amdatu.platform").artifactId("filebased-configuration").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption felixScr() {
+ return
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.scr").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption slingCommons() {
+ return
mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.commons.osgi").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption slingMime() {
+ return
mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.commons.mime").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption paxUserAdmin() {
+ return
mavenBundle().groupId("org.ops4j.pax.useradmin").artifactId("pax-useradmin-service").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption PaxWebJsp() {
+ return
mavenBundle().groupId("org.ops4j.pax.web").artifactId("pax-web-jsp").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption paxWebJetty() {
+ return
mavenBundle().groupId("org.ops4j.pax.web").artifactId("pax-web-jetty-bundle").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption felixLog() {
+ return
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.log").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption configAdmin() {
+ return
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption dependencyManager() {
+ return
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject();
+ }
+
+ protected static MavenArtifactProvisionOption compendium() {
+ return
mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").versionAsInProject();
+ }
+
+}
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/CassandraDaemonIntegrationTest.java
Thu Oct 28 13:55:38 2010
@@ -23,7 +23,7 @@
import org.amdatu.platform.cassandra.application.CassandraDaemonService;
import
org.amdatu.platform.cassandra.listener.ColumnFamilyDefinition.ColumnType;
import
org.amdatu.platform.cassandra.listener.ColumnFamilyDefinition.CompareType;
-import org.amdatu.test.integration.IntegrationTestRunner;
+import org.amdatu.test.integration.base.IntegrationTestBase;
import org.apache.cassandra.thrift.InvalidRequestException;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,7 +37,7 @@
* @author ivol
*/
@RunWith(JUnit4TestRunner.class)
-public class CassandraDaemonIntegrationTest extends IntegrationTestRunner {
+public class CassandraDaemonIntegrationTest extends IntegrationTestBase {
private final static String KEYSPACE = "IntegrationTestKeySpace";
private final static String COLUMNFAMILY = "IntegrationTestColumnFamily";
@@ -50,10 +50,6 @@
@Test
public void testCassandraDaemonService() throws Exception {
- super.runTest("Cassandra Daemon Service");
- }
-
- public void run() throws Exception {
m_daemonService = getService(CassandraDaemonService.class);
// -1- Test adding/updating/removing keyspaces
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/TenantManagementServiceTest.java
Thu Oct 28 13:55:38 2010
@@ -16,18 +16,21 @@
*/
package org.amdatu.test.integration.tests;
+import static org.ops4j.pax.exam.CoreOptions.*;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Map;
+import java.util.Properties;
import junit.framework.Assert;
-
import org.amdatu.platform.tenant.Tenant;
import org.amdatu.platform.tenant.TenantDAO;
import org.amdatu.platform.tenant.TenantException;
import org.amdatu.platform.tenant.TenantManagementService;
-import org.amdatu.test.integration.IntegrationTestRunner;
+import org.amdatu.test.integration.base.IntegrationTestBase;
import org.amdatu.test.integration.mock.TenantDAOMock;
+import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -35,95 +38,121 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
/**
* This class provides an integration test for testing the Tenant Management
Service.
- *
+ *
* @author ivol
*/
@RunWith(JUnit4TestRunner.class)
-public class TenantManagementServiceTest extends IntegrationTestRunner {
+public class TenantManagementServiceTest extends IntegrationTestBase {
+
+ private volatile TenantManagementService m_tenantManagementService;
@Configuration
public Option[] configure() {
- return super.configure();
- }
+ return options(
+ mavenConfiguration(),
- @Test
- public void testTenantManagementService() throws Exception {
- super.runTest("Tenant Management Service");
+ // Run test in a Felix container
+ frameworks(felix()),
+
+ // Setting this system property unfortunately is necessary with
the current Cassandra implementation
+
systemProperty("org.osgi.framework.system.packages.extra").value("sun.misc,com.sun.management"),
+
+ // Enable this line to allow a remote debugger to attach to the VM
in which Pax Exam runs
+ // new
VMOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+
+ // Install bundles we need to execute our test
+ provision(
+ compendium(),
+ dependencyManager(),
+ configAdmin(),
+ felixLog(),
+
+ // Amdatu platform bundles
+ // TODO: this works fine when running 'mvn install' since the
artifacts will then be deployed to the maven
+ // repository prior to running this integration test. With
'mvn integration-test' however, artifacts will
+ // not be deployed and so this will only work when artifacts
have been deployed to the maven repository
+ // before, possibly using outdated artifacts.
+ amdatuConfigTemplateManager(),
+ amdatuCassandraApplication(),
+ amdatuCassandraListener(),
+ amdatuCassandraPersistenceManager(),
+ amdatuTenantService()
+
+ // And finally deploy ourselves
+ // bundle(integrationTestJarFile().toURI().toString())
+ ));
}
- public void run() throws Exception {
- // First we register a new in-memory TenantDAO service and register it
with a higher service rank then the default
- // Cassandra DAO such that our test framework will pick it up
- DependencyManager depMgr = new DependencyManager(m_bundleContext);
- Hashtable<String, Integer> ht = new Hashtable<String, Integer>();
- ht.put(Constants.SERVICE_RANKING, 1);
-
depMgr.add(depMgr.createComponent().setImplementation(TenantDAOMock.class).setInterface(
- TenantDAO.class.getName(), ht));
- System.out.println(TEST_PREFIX + "TenantDAOMock service registered");
+ public Component[] getDependencies(DependencyManager manager) {
+ // TODO update this, so we can get notified of a new tenant service
becoming available. Yay!
+ Component testComponent = manager.createComponent()
+ .setImplementation(this)
+ .add(manager.createServiceDependency()
+ .setService(TenantManagementService.class));
+
+ Properties props = new Properties();
+ props.put(Constants.SERVICE_RANKING, 1);
+ Component daoComponent = manager.createComponent()
+ .setInterface(TenantDAO.class.getName(), props)
+ .setImplementation(TenantDAOMock.class);
- try {
- ServiceReference[] tenantDAOs =
m_bundleContext.getServiceReferences(TenantDAO.class.getName(), null);
- for (ServiceReference ref : tenantDAOs) {
- System.out.println(TEST_PREFIX + "Tenant DAO = " +
m_bundleContext.getService(ref).getClass());
- }
- }
- catch (InvalidSyntaxException e) {}
+ return new Component[] {testComponent, daoComponent};
+ }
- TenantManagementService tenantService =
getService(TenantManagementService.class);
- System.out.println(TEST_PREFIX + "Testing " +
tenantService.getClass().getName());
+ // TODO pull this test apart into multiple tests
+ @Test
+ public void testTenantManagementService() throws Exception {
- Tenant[] allTenants = tenantService.getAllTenants();
+ Tenant[] allTenants = m_tenantManagementService.getAllTenants();
Assert.assertTrue("There are already tenants present in the storage",
- tenantService.getAllTenants().length == 0);
+ m_tenantManagementService.getAllTenants().length == 0);
int tenantCount = allTenants.length;
- Tenant tenant =
tenantService.createTentant("org.amdatu.test.integration.tests.testtenant",
"TEST");
- tenantService.updateTenant(tenant);
+ Tenant tenant =
m_tenantManagementService.createTentant("org.amdatu.test.integration.tests.testtenant",
"TEST");
+ m_tenantManagementService.updateTenant(tenant);
Assert.assertTrue("Added and updated 1 tenant, but the Tenant service
now holds "
- + tenantService.getAllTenants().length + " tenants, expected: " +
(tenantCount + 1), tenantService
+ + m_tenantManagementService.getAllTenants().length + " tenants,
expected: " + (tenantCount + 1), m_tenantManagementService
.getAllTenants().length == tenantCount + 1);
// Try to add a tenant with the same id, should throw an exception
try {
-
tenantService.createTentant("org.amdatu.test.integration.tests.testtenant",
"sdfsdfd");
+
m_tenantManagementService.createTentant("org.amdatu.test.integration.tests.testtenant",
"sdfsdfd");
Assert.assertTrue("Tenant with the same id could be created
twice", false);
}
catch (TenantException e) {}
- tenantService.deleteTenant(tenant);
+ m_tenantManagementService.deleteTenant(tenant);
- Assert.assertTrue(tenantService.getAllTenants().length == tenantCount);
+ Assert.assertTrue(m_tenantManagementService.getAllTenants().length ==
tenantCount);
- Tenant tenant1 =
tenantService.createTentant("org.amdatu.test.integration.tests.testtenant.1",
"TEST 1");
- Tenant tenant2 =
tenantService.createTentant("org.amdatu.test.integration.tests.testtenant.2",
"TEST 2");
- Tenant tenant3 =
tenantService.createTentant("org.amdatu.test.integration.tests.testtenant.3",
"TEST 3");
+ Tenant tenant1 =
m_tenantManagementService.createTentant("org.amdatu.test.integration.tests.testtenant.1",
"TEST 1");
+ Tenant tenant2 =
m_tenantManagementService.createTentant("org.amdatu.test.integration.tests.testtenant.2",
"TEST 2");
+ Tenant tenant3 =
m_tenantManagementService.createTentant("org.amdatu.test.integration.tests.testtenant.3",
"TEST 3");
tenant1.getProperties().put("hostname", "localhost");
tenant2.getProperties().put("hostname", "localhost");
tenant3.getProperties().put("hostname", "amdatu.org");
- tenantService.updateTenant(tenant1);
- tenantService.updateTenant(tenant2);
- tenantService.updateTenant(tenant3);
+ m_tenantManagementService.updateTenant(tenant1);
+ m_tenantManagementService.updateTenant(tenant2);
+ m_tenantManagementService.updateTenant(tenant3);
Map<String, String> filter = new HashMap<String, String>();
filter.put("hostname", "localhost");
- Assert.assertTrue(tenantService.getTenants(filter).length == 2);
+ Assert.assertTrue(m_tenantManagementService.getTenants(filter).length
== 2);
filter.put("hostname", "amdatu.org");
- Assert.assertTrue(tenantService.getTenants(filter).length == 1);
+ Assert.assertTrue(m_tenantManagementService.getTenants(filter).length
== 1);
- tenantService.deleteTenant(tenant1);
- tenantService.deleteTenant(tenant2);
- tenantService.deleteTenant(tenant3);
+ m_tenantManagementService.deleteTenant(tenant1);
+ m_tenantManagementService.deleteTenant(tenant2);
+ m_tenantManagementService.deleteTenant(tenant3);
// What happens if I remove a tenant that was already removed?
try {
- tenantService.deleteTenant(tenant);
+ m_tenantManagementService.deleteTenant(tenant);
Assert.assertTrue("Tenant with the same id could be deleted
twice", false);
}
catch (TenantException e) {}
Modified:
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
==============================================================================
---
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
(original)
+++
trunk/integration-tests/src/test/java/org/amdatu/test/integration/tests/UserAdminStoreTest.java
Thu Oct 28 13:55:38 2010
@@ -18,7 +18,7 @@
import junit.framework.Assert;
-import org.amdatu.test.integration.IntegrationTestRunner;
+import org.amdatu.test.integration.base.IntegrationTestBase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Inject;
@@ -37,7 +37,7 @@
* @author ivol
*/
@RunWith(JUnit4TestRunner.class)
-public class UserAdminStoreTest extends IntegrationTestRunner {
+public class UserAdminStoreTest extends IntegrationTestBase {
@Inject
protected BundleContext m_bundleContext;
@@ -50,11 +50,6 @@
@Test
public void testAdminStore() throws Exception {
- super.runTest("User Admin Store");
- }
-
- @SuppressWarnings("unchecked")
- public void run() throws Exception {
m_userAdmin = getService(UserAdmin.class);
// Start the test, first remove all existing roles