usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdun...@apache.org
Subject [1/2] usergrid git commit: USERGRID-933: fix broken tests
Date Mon, 11 Jan 2016 08:32:25 GMT
Repository: usergrid
Updated Branches:
  refs/heads/master ce31acd72 -> 95fa52099


USERGRID-933: fix broken tests


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/27e29928
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/27e29928
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/27e29928

Branch: refs/heads/master
Commit: 27e299283f75b3a3adf8d00e6f01def3fffc490e
Parents: 35ff17f
Author: Mike Dunker <mdunker@apigee.com>
Authored: Mon Jan 11 00:12:28 2016 -0800
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Mon Jan 11 00:12:28 2016 -0800

----------------------------------------------------------------------
 .../cassandra/ManagementServiceImpl.java        | 27 ++++++++++++--------
 .../migration/AppInfoMigrationPluginTest.java   |  2 +-
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/27e29928/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 6d79161..a4259f7 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -193,14 +193,19 @@ public class ManagementServiceImpl implements ManagementService {
             return orgSysAdminEmail;
         }
         orgSysAdminEmail =  properties.getProperty( PROPERTIES_ORG_SYSADMIN_EMAIL );
-        orgSysAdminEmail = orgSysAdminEmail!=null ? orgSysAdminEmail : getDefaultSysAdminEmail();
+        if (orgSysAdminEmail == null || orgSysAdminEmail.isEmpty()) {
+            orgSysAdminEmail = getDefaultSysAdminEmail();
+        }
         return orgSysAdminEmail;
     }
 
     String defaultAdminSysAdminEmail = null;
     private String getDefaultAdminSystemEmail(){
         if( defaultAdminSysAdminEmail == null ){
-            defaultAdminSysAdminEmail = properties.getProperty(PROPERTIES_ADMIN_SYSADMIN_EMAIL,
getDefaultSysAdminEmail());
+            defaultAdminSysAdminEmail = properties.getProperty(PROPERTIES_ADMIN_SYSADMIN_EMAIL);
+            if (defaultAdminSysAdminEmail == null || defaultAdminSysAdminEmail.isEmpty())
{
+                defaultAdminSysAdminEmail = getDefaultSysAdminEmail();
+            }
         }
 
         return defaultAdminSysAdminEmail;
@@ -218,7 +223,8 @@ public class ManagementServiceImpl implements ManagementService {
             // swallow
         }
 
-        return adminSystemEmail != null ? adminSystemEmail : getDefaultAdminSystemEmail();
+        return (adminSystemEmail != null && !adminSystemEmail.isEmpty()) ?
+                adminSystemEmail : getDefaultAdminSystemEmail();
     }
 
     private String getAdminSystemEmailForOrganization(UUID organizationId) {
@@ -2505,7 +2511,7 @@ public class ManagementServiceImpl implements ManagementService {
     // token may contain the workflow organization id
     public ActivationState handleActivationTokenForAdminUser( UUID userId, String token )
throws Exception {
         TokenInfo tokenInfo = getTokenInfoFromAccessToken(token, TOKEN_TYPE_ACTIVATION, ADMIN_USER);
-        if (tokenInfo == null) {
+        if (tokenInfo != null) {
             AuthPrincipalInfo principal = tokenInfo.getPrincipal();
             if ((principal != null) && userId.equals(principal.getUuid())) {
                 UUID workflowOrgId = tokenInfo.getWorkflowOrgId();
@@ -2725,8 +2731,9 @@ public class ManagementServiceImpl implements ManagementService {
     @Override
     public void startAppUserPasswordResetFlow( UUID applicationId, User user ) throws Exception
{
         String token = getPasswordResetTokenForAppUser(applicationId, user.getUuid());
-        String resetPropertyUrl = getOrganizationConfigPropertyForApplication(applicationId,
PROPERTIES_USER_RESETPW_URL);
-        String reset_url = buildUserAppUrl( applicationId, resetPropertyUrl, user, token
);
+        String resetPropertyUrl = properties.getProperty( PROPERTIES_USER_RESETPW_URL );
+        String reset_url =
+                buildUserAppUrl( applicationId, resetPropertyUrl, user, token);
         Map<String, String> pageContext = hashMap( "reset_url", reset_url )
                 .map( "reset_url_base", resetPropertyUrl )
                 .map( "user_uuid", user.getUuid().toString() ).map( "raw_token", token )
@@ -3343,11 +3350,11 @@ public class ManagementServiceImpl implements ManagementService {
                     new SimpleEntityRef(CpNamingUtils.APPLICATION_INFO, applicationInfoId),
                     ORG_APP_RELATIONSHIP, Group.ENTITY_TYPE, Level.ALL_PROPERTIES);
 
-            Entity entity = r.getEntity();
+            Group org = (Group)r.getEntity();
 
-            if ( entity != null ) {
-                Map<Object, Object> entityProperties = em.getDictionaryAsMap(entity,
ORGANIZATION_CONFIG_DICTIONARY);
-                return new OrganizationConfig(orgConfigProperties, entity.getUuid(), entity.getName(),
entityProperties, false);
+            if ( org != null ) {
+                Map<Object, Object> entityProperties = em.getDictionaryAsMap(org, ORGANIZATION_CONFIG_DICTIONARY);
+                return new OrganizationConfig(orgConfigProperties, org.getUuid(), org.getPath(),
entityProperties, false);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/27e29928/stack/services/src/test/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPluginTest.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPluginTest.java
b/stack/services/src/test/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPluginTest.java
index e5b22c8..2973730 100644
--- a/stack/services/src/test/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPluginTest.java
+++ b/stack/services/src/test/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPluginTest.java
@@ -120,7 +120,7 @@ public class AppInfoMigrationPluginTest {
         List<Entity> deletedApps = new ArrayList<>();
 
         setup.getEmf().initializeApplicationV2(
-            CassandraService.DEFAULT_ORGANIZATION, AppInfoMigrationPlugin.SYSTEM_APP_ID,
CassandraService.MANAGEMENT_APPLICATION, null);
+            CassandraService.DEFAULT_ORGANIZATION, AppInfoMigrationPlugin.SYSTEM_APP_ID,
"systemapp", null);
 
         EntityManager systemAppEm = setup.getEmf().getEntityManager( AppInfoMigrationPlugin.SYSTEM_APP_ID
);
 


Mime
View raw message