ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1532846 - /ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java
Date Wed, 16 Oct 2013 18:26:45 GMT
Author: jawi
Date: Wed Oct 16 18:26:45 2013
New Revision: 1532846

URL: http://svn.apache.org/r1532846
Log:
Simplified test setup to make it more robust.


Modified:
    ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java

Modified: ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java?rev=1532846&r1=1532845&r2=1532846&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java
(original)
+++ ace/trunk/org.apache.ace.useradmin.ui.itest/src/org/apache/ace/useradmin/ui/test/UserEditorTest.java
Wed Oct 16 18:26:45 2013
@@ -18,10 +18,7 @@
  */
 package org.apache.ace.useradmin.ui.test;
 
-import java.io.ByteArrayInputStream;
-
 import org.apache.ace.it.IntegrationTestBase;
-import org.apache.ace.repository.Repository;
 import org.apache.ace.useradmin.ui.editor.GroupNotFoundException;
 import org.apache.ace.useradmin.ui.editor.UserAlreadyExistsException;
 import org.apache.ace.useradmin.ui.editor.UserDTO;
@@ -38,7 +35,6 @@ public class UserEditorTest extends Inte
     private static final String TEST_GROUP = "TestGroup";
 
     private volatile UserEditor m_userEditor;
-    private volatile Repository m_userRepository;
     private volatile UserAdmin m_userAdmin;
 
     public void GetUserBroken() {
@@ -278,34 +274,15 @@ public class UserEditorTest extends Inte
 
     @Override
     protected void configureAdditionalServices() throws Exception {
-        ByteArrayInputStream bis = new ByteArrayInputStream((
-            "<roles>" +
-                "    <group name=\"TestGroup\">" +
-                "        <properties>" +
-                "            <type>userGroup</type>" +
-                "        </properties>" +
-                "    </group>" +
-                "    <user name=\"TestUser\">" +
-                "        <properties>" +
-                "            <email>testUser@apache.org</email>" +
-                "        </properties>" +
-                "        <credentials>" +
-                "            <password type=\"String\">swordfish</password>"
+
-                "            <certificate type=\"byte[]\">42</certificate>" +
-                "        </credentials>" +
-                "        <memberof>TestGroup</memberof>" +
-                "    </user>" +
-                "</roles>").getBytes());
-
-        assertTrue("Committing test user data failed.", m_userRepository.commit(bis, m_userRepository.getRange().getHigh()));
-        User user = (User) m_userAdmin.getRole("TestUser");
-        int count = 0;
-        while ((user == null) && (count < 60)) {
-            Thread.sleep(100);
-            user = (User) m_userAdmin.getRole("TestUser");
-            count++;
-        }
-        assertNotNull("Failed to load the user", user);
+        Group group = (Group) m_userAdmin.createRole(TEST_GROUP, Role.GROUP);
+        group.getProperties().put("type", "userGroup");
+
+        User user = (User) m_userAdmin.createRole("TestUser", Role.USER);
+        user.getProperties().put("email", "testUser@apache.org");
+        user.getCredentials().put("password", "swordfish");
+        user.getCredentials().put("certificate", "42".getBytes());
+
+        group.addMember(user);
     }
 
     @Override
@@ -345,9 +322,6 @@ public class UserEditorTest extends Inte
                 .setService(UserAdmin.class)
                 .setRequired(true)
             )
-            .add(createServiceDependency()
-                .setService(Repository.class, "(&(name=users)(customer=apache))")
-                .setRequired(true))
         };
     }
 }



Mime
View raw message