Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-10-01 14:55:06 +0000
committerThomas Watson2008-10-01 14:55:06 +0000
commit330b8eb6bcdaeaef03978dc107d9e3e1d1acc3c3 (patch)
treee7b5d0b42f8eb6a61bc382db39c4ccf813336532
parentb50fe02da4372f7c8a4dc59a735f599c7019a3de (diff)
downloadrt.equinox.bundles-330b8eb6bcdaeaef03978dc107d9e3e1d1acc3c3.tar.gz
rt.equinox.bundles-330b8eb6bcdaeaef03978dc107d9e3e1d1acc3c3.tar.xz
rt.equinox.bundles-330b8eb6bcdaeaef03978dc107d9e3e1d1acc3c3.zip
More tests
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/useradmin/tests/UserTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/useradmin/tests/UserTest.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/useradmin/tests/UserTest.java
index afd2241b4..69a63c638 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/useradmin/tests/UserTest.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/useradmin/tests/UserTest.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.useradmin.tests;
import junit.framework.TestCase;
import org.eclipse.equinox.compendium.tests.Activator;
+import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.useradmin.*;
@@ -34,6 +35,33 @@ public class UserTest extends TestCase {
Activator.getBundle(Activator.BUNDLE_USERADMIN).stop();
}
+ public void testCreate() throws Exception {
+ User user = (User) userAdmin.createRole("testUserCreate1", Role.USER); //$NON-NLS-1$
+ assertNotNull(user);
+ assertEquals("testUserCreate1", user.getName()); //$NON-NLS-1$
+ assertTrue(user.getType() == Role.USER);
+ user.getProperties().put("test", "valu");
+ }
+
+ public void testGetUser() {
+ User user = userAdmin.getUser("test", "valu");
+ assertNotNull(user);
+ assertEquals("testUserCreate1", user.getName()); //$NON-NLS-1$
+ assertTrue(user.getType() == Role.USER);
+ try {
+ Role[] roles = userAdmin.getRoles("(test=valu)");
+ assertNotNull(roles);
+ assertEquals("number of roles", 1, roles.length);
+ } catch (InvalidSyntaxException e) {
+ fail(e.getMessage());
+ }
+ userAdmin.removeRole(user.getName());
+ }
+
+ public void testRemovedUser() {
+ assertNull(userAdmin.getRole("testUserCreate1")); //$NON-NLS-1$
+ }
+
public void testUserCreateAndRemove() throws Exception {
User user = (User) userAdmin.createRole("testUserCreate", Role.USER); //$NON-NLS-1$
assertNotNull(user);

Back to the top