]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3077, 2742 - Get rid of test/test accounts, and super-admin role. Removed...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 19 Nov 2010 07:55:59 +0000 (07:55 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 19 Nov 2010 07:55:59 +0000 (07:55 +0000)
17 files changed:
services/IntegrationTests/src/test/resources/test-data/xmlreplay/dev-master.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension-master.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/dimension.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/objectexit/object-exit.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/organization.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/security.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master-self-test.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-master.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/xml-replay-self-test.xml
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java
services/account/pstore/src/main/resources/db/mysql/test_account.sql
services/authentication/pstore/src/main/resources/db/mysql/test_authentication.sql
services/authorization-mgt/import/pom.xml
services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/driver/AuthorizationSeedDriver.java
services/authorization/pstore/src/main/resources/db/mysql/test_authorization.sql
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java

index fe48894ad84bd4897194901bca4c7c620f0c22cb..b1ef1ed0929d02c2a83af3aaad427d120accc705 100644 (file)
@@ -6,8 +6,8 @@
     <!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
     <dump payloads="false" dumpServiceResult="minimal" />\r
     \r
-    <auths default="test">\r
-       <auth ID="test">dGVzdDp0ZXN0</auth>\r
+    <auths default="admin@collectionspace.org">\r
+       <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
     </auths>\r
 \r
 \r
index 0df0d28acddc67d58c9fc7bb6701c22f586e1801..16baa30c205ff9100dbd628036f9bc1593ff9ca8 100755 (executable)
@@ -5,8 +5,8 @@
     <!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
     <dump payloads="false" dumpServiceResult="minimal" />\r
     \r
-    <auths default="test">\r
-       <auth ID="test">dGVzdDp0ZXN0</auth>\r
+    <auths default="admin@collectionspace.org">\r
+       <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
     </auths>\r
 \r
     \r
index 224859204632118a4f6b261500d2c7bbf17f55bf..d591c887fd8462ff62ee3bddc1b5903e49cc3474 100755 (executable)
@@ -2,7 +2,7 @@
 <xmlReplay>\r
     <auths>\r
         <!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
-        <auth ID="test">dGVzdDp0ZXN0</auth>\r
+        <auth ID="admin@collectionspace.org">59PnafP1k9rcuGNMxbCfyQ3TphxKBqecsJI2Yv5vrms=</auth>\r
         <auth ID="bigbird2010">YmlnYmlyZDIwMTA6YmlnYmlyZDIwMTA=</auth>\r
     </auths>\r
     \r
@@ -21,7 +21,7 @@
         </test>\r
 \r
         <!-- should succeed on auth="test" since test is admin user. -->\r
-        <test ID="dimension2"  auth="test">\r
+        <test ID="dimension2"  auth="admin@collectionspace.org">\r
             <!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
             <expectedCodes>201,403</expectedCodes>\r
             <method>POST</method>\r
@@ -37,7 +37,7 @@
 \r
     <testGroup ID="dimensionCRUDGroup" autoDeletePOSTS="true">\r
          <!-- should succeed on auth="test" since test is admin user. -->\r
-         <test ID="dimPOST"  auth="test">\r
+         <test ID="dimPOST"  auth="admin@collectionspace.org">\r
              <!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
              <expectedCodes>201</expectedCodes>\r
              <method>POST</method>\r
              </part>\r
          </test>\r
 \r
-        <test ID="dimGET"  auth="test">\r
+        <test ID="dimGET"  auth="admin@collectionspace.org">\r
             <!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
             <method>GET</method>\r
             <uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
         </test>\r
 \r
-        <test ID="dimPUT"  auth="test">\r
+        <test ID="dimPUT"  auth="admin@collectionspace.org">\r
             <method>PUT</method>\r
             <uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
             <part>\r
@@ -63,7 +63,7 @@
             </part>\r
         </test>\r
 \r
-        <test ID="dimGET2"  auth="test">\r
+        <test ID="dimGET2"  auth="admin@collectionspace.org">\r
             <method>GET</method>\r
             <uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
         </test>\r
@@ -73,4 +73,4 @@
 \r
 </xmlReplay>\r
         \r
-        
\ No newline at end of file
+        \r
index dabb8b13b113f09fdec794d21e98dcd43fe29a58..7e3c34c7862acc092b5f181a688549e6378a5770 100644 (file)
@@ -2,13 +2,13 @@
 <xmlReplay>\r
     <auths>\r
         <!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
-        <auth ID="test">dGVzdDp0ZXN0</auth>\r
+        <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
     </auths>\r
     \r
    <!-- ================================================================================ -->\r
     \r
      <testGroup ID="CRUDL" autoDeletePOSTS="true">\r
-         <test ID="oe1"  auth="test">\r
+         <test ID="oe1"  auth="admin@collectionspace.org">\r
              <method>POST</method>\r
              <uri>/cspace-services/objectexit/</uri>\r
              <part>\r
 \r
 </xmlReplay>\r
         \r
-        
\ No newline at end of file
+        \r
index e02a01c269e6bd5f33c6b0a3dea6eba21dfb9e24..60eb04d5e120bac7a250ea8a8e53d2e8cb4815a7 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <xmlReplay>\r
     <testGroup ID="organization" autoDeletePOSTS="true">\r
-        <test ID="OrgAuth1" auth="test">\r
+        <test ID="OrgAuth1" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/orgauthorities/</uri>\r
             <part>\r
index 5f32f3f045bac7cc18cc6db9abe7170c9a9ba866..8ffee79f5820c65ed7df9212fec83fadedc41913 100755 (executable)
@@ -2,8 +2,7 @@
 <xmlReplay>\r
     <auths>\r
         <!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
-        <auth ID="test">dGVzdDp0ZXN0</auth>\r
-        <auth ID="test-pahma">dGVzdC1wYWhtYTp0ZXN0</auth>\r
+        <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
         <auth ID="user1@museum1">dXNlcjFAbXVzZXVtMS5vcmc6dXNlcjFAbXVzZXVtMS5vcmc=</auth>\r
         <auth ID="bigbird2010">YmlnYmlyZDIwMTA6YmlnYmlyZDIwMTA=</auth>\r
         <auth ID="elmo2010">ZWxtbzIwMTA6ZWxtbzIwMTA=</auth>\r
@@ -22,7 +21,7 @@
         </test>\r
 \r
         <!--Next, set up permissions and roles, and test bigbird2010 and elmo2010. -->\r
-        <test ID="permBigbird" auth="test">\r
+        <test ID="permBigbird" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions</uri>\r
             <filename>security/1-bigbird-permission.xml</filename>\r
         -->\r
 \r
 \r
-        <test auth="test">\r
+        <test auth="admin@collectionspace.org">\r
             <method>DELETE</method>\r
             <uri>/cspace-services/authorization/permissions/${permBigbird.CSID}/permroles</uri>\r
             <!-- don't do <fromTestID>, no CSID of permrole on end of url, but deleteURL will put one there for you, so don't use it.\r
         </test>\r
 \r
         \r
-        <test ID="accountroles2" auth="test">\r
+        <test ID="accountroles2" auth="admin@collectionspace.org">\r
             <method>DELETE</method>\r
             <uri>/cspace-services/accounts/${accountBigbird.CSID}/accountroles</uri>\r
         </test>\r
         </test>\r
 \r
         <!--Next, set up permissions and roles, and test bigbird2010.-->\r
-        <test ID="permBigbird" auth="test">\r
+        <test ID="permBigbird" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions</uri>\r
             <filename>security/1-bigbird-permission.xml</filename>\r
         </test>\r
-        <test ID="roleTestCM"  auth="test">\r
+        <test ID="roleTestCM"  auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/roles</uri>\r
             <filename>security/3-role-test-cm.xml</filename>\r
         \r
         <!--  NOW **REMOVE** PERMROLES FROM BIGBIRD -->\r
         \r
-        <test ID="deletePermrolesBigbird" auth="test">\r
+        <test ID="deletePermrolesBigbird" auth="admin@collectionspace.org">\r
             <msg>Deleting permroles from bigbird2010</msg>\r
             <method>DELETE</method>\r
             <uri>/cspace-services/authorization/permissions/${permBigbird.CSID}/permroles</uri>\r
 \r
         <!--  NOW **ADD** PERMS CRU TO BIGBIRD -->\r
 \r
-        <test ID="permBigbird_CRU" auth="test">\r
+        <test ID="permBigbird_CRU" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions</uri>\r
             <filename>security/11-bigbird-permission-CRU.xml</filename>\r
         </test>\r
-        <test ID="bigbirdPermrolesCRU" auth="test">\r
+        <test ID="bigbirdPermrolesCRU" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles</uri>\r
             <filename>security/11-permissionroles-bigbird-CRU.xml</filename>\r
 \r
         <!--  NOW **REMOVE** PERMROLES FROM BIGBIRD -->\r
         \r
-        <test ID="deletePermrolesBigbird" auth="test">\r
+        <test ID="deletePermrolesBigbird" auth="admin@collectionspace.org">\r
             <msg>Deleting permroles from bigbird2010</msg>\r
             <method>DELETE</method>\r
             <uri>/cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles</uri>\r
         \r
         <!--  NOW **ADD** PERMS R TO BIGBIRD -->\r
 \r
-        <test ID="permBigbird_R" auth="test">\r
+        <test ID="permBigbird_R" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions</uri>\r
             <filename>security/12-bigbird-permission-R.xml</filename>\r
         </test>\r
-        <test ID="bigbirdPermroles_R" auth="test">\r
+        <test ID="bigbirdPermroles_R" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/authorization/permissions/${permBigbird_R.CSID}/permroles</uri>\r
             <filename>security/12-permissionroles-bigbird-R.xml</filename>\r
         </test>\r
         \r
         <!-- CLEANUP -->\r
-        <test  auth="test">\r
+        <test  auth="admin@collectionspace.org">\r
             <method>DELETE</method>\r
             <uri>/cspace-services/accounts/${accountBigbird.CSID}/accountroles</uri>\r
         </test>\r
 \r
 </xmlReplay>\r
         \r
-        
\ No newline at end of file
+        \r
index 1fae5a1edcaea32ceed49c1904d8ef12c111ccf6..e22bc05543175a66073a6e93b7b7f94ab2df9fc0 100755 (executable)
@@ -5,8 +5,8 @@
     <!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
     <dump payloads="false" dumpServiceResult="minimal" />\r
     \r
-    <auths default="test">\r
-       <auth ID="test">dGVzdDp0ZXN0</auth>\r
+    <auths default="admin@collectionspace.org">\r
+       <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
     </auths>\r
 \r
     \r
index c700ad0ed872356a9761539e4f72eb39c16a7c10..13c448c64d9e8e89276cdb43f9478c30a25e1d59 100755 (executable)
@@ -3,10 +3,10 @@
     <protoHostPort>http://localhost:8180</protoHostPort>\r
     \r
     <!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
-    <dump payloads="false" dumpServiceResult="minimal" />\r
+    <dump payloads="false" dumpServiceResult="full" />\r
     \r
-    <auths default="test">\r
-       <auth ID="test">dGVzdDp0ZXN0</auth>\r
+    <auths default="admin@collectionspace.org">\r
+       <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
     </auths>\r
 \r
     <!--\r
index 209013325d347c5e5599fd544cd9afed7446e80e..e786aed4acf442d36cda465a65014dacd8d97fb8 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <xmlReplay>\r
     <testGroup ID="selftestGroup" autoDeletePOSTS="true">\r
-        <test ID="OrgAuth1" auth="test">\r
+        <test ID="OrgAuth1" auth="admin@collectionspace.org">\r
             <method>POST</method>\r
             <uri>/cspace-services/orgauthorities/</uri>\r
             <part>\r
index 883911e32783ead8a2393b815affd46aec4ad97e..1f6ff42027f2469c7420789c18df51b5aafd7eed 100644 (file)
@@ -58,44 +58,6 @@ public class AccountTest {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    @Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
-    public void createTest(String testName) throws Exception {
-        AccountsCommon account = null;
-        try {
-            account = findAccount("test");
-            if (account != null) {
-                return;
-            }
-        } catch (NoResultException nre) {
-            //ignore
-        }
-        if (account == null) {
-            account = new AccountsCommon();
-        }
-        account.setScreenName("test");
-        account.setPersonRefName("test hello");
-        account.setEmail("test.test@berkeley.edu");
-        account.setUserId("test");
-        account.setStatus(Status.ACTIVE);
-        id = UUID.randomUUID().toString();
-        account.setCsid(id);
-
-        AccountTenant tenant = new AccountTenant();
-        tenant.setTenantId("1");
-        List<AccountTenant> tList = new ArrayList<AccountTenant>();
-        tList.add(tenant);
-        account.setTenants(tList);
-        em.getTransaction().begin();
-        em.persist(account);
-        // Commit the transaction
-        em.getTransaction().commit();
-        if (logger.isDebugEnabled()) {
-            logger.debug("created/updated account "
-                    + " screen name=" + account.getScreenName()
-                    + " email=" + account.getEmail());
-        }
-    }
 
     @SuppressWarnings("unchecked")
     @Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
index 7d8ee3bf4eb746b3010578f5d9d556c8a9a54f52..5d8021382fc0a9ff74a0aa1405161756c1f77221 100644 (file)
@@ -8,11 +8,11 @@ use cspace;
 -- Tenants
 -- default cspace --
 -- ONLY Needed for the hack below.
-INSERT INTO `cspace`.`tenants` (`id`, `name`, `created_at`) VALUES  ('1','collectionspace.org', now());
+-- INSERT INTO `cspace`.`tenants` (`id`, `name`, `created_at`) VALUES  ('1','collectionspace.org', now());
 
 -- Accounts
--- default test account --
-INSERT INTO `cspace`.`accounts_common` (`csid`, `email`, `phone`, `mobile`, `userid`, `status`, `screen_name`, `created_at`) VALUES  ('eeca40d7-dc77-4cc5-b489-16a53c75525a','test.test@berkeley.edu',NULL,NULL,'test','ACTIVE','test', now());
+-- default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --
+-- INSERT INTO `cspace`.`accounts_common` (`csid`, `email`, `phone`, `mobile`, `userid`, `status`, `screen_name`, `created_at`) VALUES  ('Bootstrapping-Account-DO-NOT-DELETE','bootstrap@collectionspace.org',NULL,NULL,'SPRING_ADMIN','ACTIVE','SPRING_ADMIN', now());
 
 -- Association of accounts with tenants
-INSERT INTO `cspace`.`accounts_tenants` (`TENANTS_ACCOUNTSCOMMON_CSID`, `tenant_id`) VALUES ('eeca40d7-dc77-4cc5-b489-16a53c75525a', '1');
+-- INSERT INTO `cspace`.`accounts_tenants` (`TENANTS_ACCOUNTSCOMMON_CSID`, `tenant_id`) VALUES ('Bootstrapping-Account-DO-NOT-DELETE', '1');
index 3f5f2ce02c7a903eeaa20a3e5edc34ff5b6ef643..8814ef3319b1238b9e91f6b1508408c86c3d44ff 100644 (file)
@@ -5,6 +5,5 @@
 --\r
 use cspace;\r
 \r
--- default test user --\r
--- This should go away.\r
-insert into `users` (`username`,`passwd`, `created_at`) VALUES ('test','n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=', now());\r
+-- default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --\r
+-- insert into `users` (`username`,`passwd`, `created_at`) VALUES ('SPRING_ADMIN','MzwE3RUaKmgxwDnLmmUd8pGYvooE4WzoYdS2o0oRyVQ=', now());\r
index f19330a42df801d94bb324f2db7fdb837226064b..cb70e5bba189db763ea4e7a62d224ad374bee53e 100644 (file)
                     <mainClass>org.collectionspace.ImportAuthz</mainClass>\r
                     <arguments>\r
                         <argument>-u</argument>\r
-                        <argument>test</argument>\r
+                        <argument>SPRING_ADMIN</argument>\r
                         <argument>-p</argument>\r
-                        <argument>test</argument>\r
+                        <argument>does_not_matter</argument>\r
                         <argument>-b</argument>\r
                         <argument>${basedir}/../../common/src/main/config/services/tenant-bindings.xml</argument>\r
                         <argument>-edir</argument>\r
index 9c6faab5a9155f438bf5589afb7d68f5c9e78796..9c08adb0675dce9db66251889ea8edcc5bfe3d80 100644 (file)
@@ -165,10 +165,10 @@ public class AuthorizationSeedDriver {
     }
 
     private void login() {
-        GrantedAuthority cspace_admin = new GrantedAuthorityImpl("ROLE_ADMINISTRATOR");
+        //GrantedAuthority cspace_admin = new GrantedAuthorityImpl("ROLE_ADMINISTRATOR");
         GrantedAuthority spring_security_admin = new GrantedAuthorityImpl("ROLE_SPRING_ADMIN");
         HashSet<GrantedAuthority> gauths = new HashSet<GrantedAuthority>();
-        gauths.add(cspace_admin);
+        //gauths.add(cspace_admin);
         gauths.add(spring_security_admin);
         Authentication authRequest = new UsernamePasswordAuthenticationToken(user, password, gauths);
         SecurityContextHolder.getContext().setAuthentication(authRequest);
index 177818f78bd5f56664df00f6c75da5c19e7341e6..4ac057be0948ebc744a4111a4c87463144b9f46d 100644 (file)
@@ -5,11 +5,10 @@
 --\r
 use cspace;\r
 \r
-insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0');\r
-insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('0', 'ROLE_ADMINISTRATOR', 'ADMINISTRATOR', 'CollectionSpace Administrator', now(), '0');\r
+-- insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0');\r
+-- insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('0', 'ROLE_ADMINISTRATOR', 'ADMINISTRATOR', 'CollectionSpace Administrator', now(), '0');\r
 \r
--- for default test account --\r
--- THESE SHOULD GO AWAY.\r
-insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('eeca40d7-dc77-4cc5-b489-16a53c75525a', 'test', '-1', 'ROLE_SPRING_ADMIN', now());\r
-insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('eeca40d7-dc77-4cc5-b489-16a53c75525a', 'test', '0', 'ROLE_ADMINISTRATOR', now());\r
+-- for default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --\r
+-- insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('Bootstrapping-Account-DO-NOT-DELETE', 'test', '-1', 'ROLE_SPRING_ADMIN', now());\r
+-- insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('Bootstrapping-Account-DO-NOT-DELETE', 'test', '0', 'ROLE_ADMINISTRATOR', now());\r
 \r
index eb5aa130f0253526b6b25141549fb6969ff20de4..b294704372ccd560461aceb2ce06ebfa4843a09c 100644 (file)
@@ -336,17 +336,27 @@ public class ServiceMain {
                }\r
                pstmt.close();\r
                // Fifth, fetch and save the default roles\r
+                       String springAdminRoleCSID = null;\r
                String querySpringRole = \r
                        "SELECT `csid` from `Roles` WHERE `rolename`='"+SPRING_ADMIN_ROLE+"'";\r
                        rs = stmt.executeQuery(querySpringRole);\r
-               if(!rs.next()) {\r
-                       throw new RuntimeException("Cannot find SPRING ADMIN role!");\r
+               if(rs.next()) {\r
+                       springAdminRoleCSID = rs.getString(1);\r
+               if (logger.isDebugEnabled()) {\r
+                       logger.debug("createDefaultAccounts found Spring Admin role: "\r
+                                       +springAdminRoleCSID);\r
+               }\r
+               } else {\r
+                String insertSpringAdminRoleSQL =\r
+                       "INSERT INTO `Roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) "\r
+                       + "VALUES ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0')";\r
+                       stmt.executeUpdate(insertSpringAdminRoleSQL);\r
+                       springAdminRoleCSID = "-1";\r
+               if (logger.isDebugEnabled()) {\r
+                       logger.debug("createDefaultAccounts CREATED Spring Admin role: "\r
+                                       +springAdminRoleCSID);\r
+               }\r
                }\r
-                       String springAdminRoleCSID = rs.getString(1);\r
-               if (logger.isDebugEnabled()) {\r
-                       logger.debug("createDefaultAccounts found Spring Admin role: "\r
-                                       +springAdminRoleCSID);\r
-               }\r
                rs.close();\r
                String getRoleCSIDSql =\r
                        "SELECT `csid` from `Roles` WHERE `tenant_id`=? and `rolename`=?";\r
index 8eaac972511f8f13201a56ee56179a209fa0135a..fbe0db723e1f1a29fc75012abdfff84ae0b9511e 100644 (file)
@@ -111,7 +111,8 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         setupCreate();
 
         AccountClient accountClient = new AccountClient();
-        accountClient.setAuth(true, "test", true, "test", true);
+        // This should not be needed - the auth is already set up
+        //accountClient.setAuth(true, "test", true, "test", true);
 
         // Submit the request to the service and store the response.
         AccountsCommon account =
@@ -147,7 +148,8 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         setupCreate();
 
         AccountClient accountClient = new AccountClient();
-        accountClient.setAuth(true, "test", true, "test", true);
+        // This should not be needed - the auth is already set up
+        //accountClient.setAuth(true, "test", true, "test", true);
 
         // Submit the request to the service and store the response.
         AccountsCommon account =
@@ -233,7 +235,9 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         }
         setupCreate();
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        collectionObjectClient.setAuth(false, "test", true, "test", true);
+        String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+        String pass = collectionObjectClient.getProperty(collectionObjectClient.PASSWORD_PROPERTY);
+        collectionObjectClient.setAuth(false, user, true, pass, true);
         String identifier = BaseServiceTest.createIdentifier();
         MultipartOutput multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
@@ -278,7 +282,8 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
             logger.debug(testBanner(testName));
         }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        collectionObjectClient.setAuth(true, "test", true, "", false);
+        String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+        collectionObjectClient.setAuth(true, user, true, "", false);
         String identifier = BaseServiceTest.createIdentifier();
         MultipartOutput multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
@@ -320,7 +325,8 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
             logger.debug(testBanner(testName));
         }
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        collectionObjectClient.setAuth(true, "test", true, "bar", true);
+        String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+        collectionObjectClient.setAuth(true, user, true, "bar", true);
         String identifier = BaseServiceTest.createIdentifier();
         MultipartOutput multipart = createCollectionObjectInstance(
                 collectionObjectClient.getCommonPartName(), identifier);
@@ -397,7 +403,7 @@ public class AuthenticationServiceTest extends AbstractServiceTestImpl {
         // Perform setup.
         setupDelete();
         AccountClient accountClient = new AccountClient();
-        accountClient.setAuth(true, "test", true, "test", true);
+        // accountClient.setAuth(true, "test", true, "test", true);
         // Submit the request to the service and store the response.
         ClientResponse<Response> res = accountClient.delete(barneyAccountId);
         int statusCode = res.getStatus();