[2/4] usergrid git commit: Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x
Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/f0508239 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/f0508239 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/f0508239 Branch: refs/heads/1.x Commit: f05082396c669d33fcb52fefda383e7ded227e4f Parents: cd51fb2 7a2e68f Author: Dave Johnson Authored: Mon Jan 4 11:20:23 2016 -0500 Committer: Dave Johnson Committed: Mon Jan 4 11:20:23 2016 -0500 -- .../org/apache/usergrid/tools/DuplicateOrgRepair.java | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) --
[3/4] usergrid git commit: Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x
Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/ebfa31af Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/ebfa31af Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/ebfa31af Branch: refs/heads/1.x Commit: ebfa31af71d2fa75dd485ce28f32c2c77052b9b9 Parents: f050823 6e1f5ec Author: Dave Johnson Authored: Thu Jan 7 14:03:55 2016 -0500 Committer: Dave Johnson Committed: Thu Jan 7 14:03:55 2016 -0500 -- .../usergrid/tools/DuplicateOrgRepair.java | 111 +-- 1 file changed, 78 insertions(+), 33 deletions(-) --
[1/4] usergrid git commit: This closes #450
Repository: usergrid Updated Branches: refs/heads/1.x a121f3796 -> a5045b86b This closes #450 Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/cd51fb23 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/cd51fb23 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/cd51fb23 Branch: refs/heads/1.x Commit: cd51fb2337e73af6477c2c1124dc15826c8038fc Parents: a2df8f9 Author: Dave Johnson Authored: Sun Dec 20 17:33:55 2015 -0500 Committer: Dave Johnson Committed: Sun Dec 20 17:33:55 2015 -0500 -- --
[4/4] usergrid git commit: Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x
Merge branch '1.x' of https://git-wip-us.apache.org/repos/asf/usergrid into 1.x Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/a5045b86 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/a5045b86 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/a5045b86 Branch: refs/heads/1.x Commit: a5045b86b9bad7f7c8adfb837b48c14784609dd9 Parents: ebfa31a a121f37 Author: Dave Johnson Authored: Mon Jan 11 16:34:35 2016 -0500 Committer: Dave Johnson Committed: Mon Jan 11 16:34:35 2016 -0500 -- .../usergrid/tools/DuplicateOrgRepair.java | 13 ++-- .../org/apache/usergrid/tools/ExportAdmins.java | 82 ++-- .../org/apache/usergrid/tools/ImportAdmins.java | 10 ++- .../org/apache/usergrid/tools/ToolBase.java | 2 +- 4 files changed, 58 insertions(+), 49 deletions(-) --
[1/2] usergrid git commit: Log org names on export
Repository: usergrid Updated Branches: refs/heads/1.x 6e1f5ec5b -> a121f3796 Log org names on export Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/4c927789 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/4c927789 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/4c927789 Branch: refs/heads/1.x Commit: 4c927789e81de65ad9b4e9958ac28af217482f8f Parents: 6e1f5ec Author: Dave Johnson Authored: Wed Jan 6 08:40:32 2016 -0500 Committer: Dave Johnson Committed: Wed Jan 6 08:40:32 2016 -0500 -- .../org/apache/usergrid/tools/ExportAdmins.java | 71 ++-- .../org/apache/usergrid/tools/ImportAdmins.java | 10 ++- 2 files changed, 44 insertions(+), 37 deletions(-) -- http://git-wip-us.apache.org/repos/asf/usergrid/blob/4c927789/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java -- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java index d5dd42c..57d87e6 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java @@ -46,44 +46,44 @@ import static org.apache.usergrid.persistence.cassandra.CassandraService.MANAGEM * Export Admin Users and metadata including organizations and passwords. * * Usage Example: - * + * * java -Xmx8000m -Dlog4j.configuration=file:/home/me/log4j.properties -classpath . \ * -jar usergrid-tools-1.0.2.jar ImportAdmins -writeThreads 100 -auditThreads 100 \ * -host casshost -inputDir=/home/me/export-data - * + * * If you want to provide any property overrides, put properties file named usergrid-custom-tools.properties * in the same directory where you run the above command. For example, you might want to set the Cassandra * client threads and export from a specific set of keyspaces: - * + * *cassandra.connections=110 *cassandra.system.keyspace=My_Usergrid *cassandra.application.keyspace=My_Usergrid_Applications *cassandra.lock.keyspace=My_Usergrid_Locks */ public class ExportAdmins extends ExportingToolBase { - + static final Logger logger = LoggerFactory.getLogger( ExportAdmins.class ); - + public static final String ADMIN_USERS_PREFIX = "admin-users"; public static final String ADMIN_USER_METADATA_PREFIX = "admin-user-metadata"; - + // map admin user UUID to list of organizations to which user belongs private Map> userToOrgsMap = new HashMap>(5); private Map orgNameToUUID = new HashMap(5); - + private Set orgsWritten = new HashSet(5); - + private Set duplicateOrgs = new HashSet(); - + private static final String READ_THREAD_COUNT = "readThreads"; private int readThreadCount; AtomicInteger userCount = new AtomicInteger( 0 ); - + boolean ignoreInvalidUsers = false; // true to ignore users with no credentials or orgs - - + + /** * Represents an AdminUser that has been read and is ready for export. */ @@ -93,7 +93,7 @@ public class ExportAdmins extends ExportingToolBase { BiMap orgNamesByUuid; } - + /** * Represents an organization associated with a user. */ @@ -138,7 +138,7 @@ public class ExportAdmins extends ExportingToolBase { } buildOrgMap(); - + // start write queue worker BlockingQueue writeQueue = new LinkedBlockingQueue(); @@ -180,7 +180,7 @@ public class ExportAdmins extends ExportingToolBase { } logger.debug( "Waiting for write thread to complete" ); - + boolean done = false; while ( !done ) { writeThread.join( 1, 0 ); @@ -188,7 +188,7 @@ public class ExportAdmins extends ExportingToolBase { logger.info( "Wrote {} users", userCount.get() ); } } - + @Override @SuppressWarnings("static-access") @@ -225,7 +225,7 @@ public class ExportAdmins extends ExportingToolBase { execService.submit( new OrgMapWorker( organization ) ); count++; } - + if ( count % 1000 == 0 ) { logger.info("Queued {} org map workers", count); } @@ -237,24 +237,24 @@ public class ExportAdmins extends ExportingToolBase { while ( !execService.awaitTermination( 10, TimeUnit.SECONDS ) ) { logger.info( "Processed {} orgs for map", userToOrgsMap.size() ); } - + logger.info("Org map complete, counted {} organizations", count); } pub
[2/2] usergrid git commit: Logging improvements and limit = 1000 for queries
Logging improvements and limit = 1000 for queries Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/a121f379 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/a121f379 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/a121f379 Branch: refs/heads/1.x Commit: a121f37967eafe18b796a30f171e1d9c2098454d Parents: 4c92778 Author: Dave Johnson Authored: Wed Jan 6 13:50:11 2016 -0500 Committer: Dave Johnson Committed: Wed Jan 6 13:50:11 2016 -0500 -- .../org/apache/usergrid/tools/DuplicateOrgRepair.java | 13 ++--- .../java/org/apache/usergrid/tools/ExportAdmins.java | 11 +++ .../main/java/org/apache/usergrid/tools/ToolBase.java | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/usergrid/blob/a121f379/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java -- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java b/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java index a33ca0e..4363dbd 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/DuplicateOrgRepair.java @@ -431,8 +431,6 @@ public class DuplicateOrgRepair extends ToolBase { class RepairManager implements DuplicateOrgInterface { -private boolean dryRun = true; - @Override public Observable getOrgs() throws Exception { @@ -443,15 +441,16 @@ public class DuplicateOrgRepair extends ToolBase { subscriber.onStart(); try { int count = 0; - -Query query = new Query(); -query.setLimit( MAX_ENTITY_FETCH ); -query.setResultsLevel( Results.Level.ALL_PROPERTIES ); + EntityManager em = emf.getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID ); +String queryString = "select *"; +Query query = Query.fromQL( queryString ); +query.withLimit( MAX_ENTITY_FETCH ); + Results results = em.searchCollection( em.getApplicationRef(), "groups", query ); while (results.size() > 0) { -for (Entity orgEntity : results.getList()) { +for (Entity orgEntity : results.getEntities()) { Org org = new Org( orgEntity.getUuid(), http://git-wip-us.apache.org/repos/asf/usergrid/blob/a121f379/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java -- diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java index 57d87e6..56750e4 100644 --- a/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java +++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ExportAdmins.java @@ -68,11 +68,12 @@ public class ExportAdmins extends ExportingToolBase { public static final String ADMIN_USER_METADATA_PREFIX = "admin-user-metadata"; // map admin user UUID to list of organizations to which user belongs -private Map> userToOrgsMap = new HashMap>(5); +private Map> userToOrgsMap = new HashMap>(10); -private Map orgNameToUUID = new HashMap(5); +private Map orgNameToUUID = new HashMap(10); -private Set orgsWritten = new HashSet(5); +private Set orgsWritten = new HashSet(10); +private Set orgsNamesWritten = new HashSet(10); private Set duplicateOrgs = new HashSet(); @@ -476,7 +477,8 @@ public class ExportAdmins extends ExportingToolBase { usersFile.writeEndArray(); usersFile.close(); -logger.info( "Exported TOTAL {} admin users and {} organizations", userCount.get(), orgsWritten.size() ); +logger.info( "Exported TOTAL {} admin users and {} organizations, org names = {}", +new Object[] { userCount.get(), orgsWritten.size(), orgsNamesWritten.size() } ); } @@ -531,6 +533,7 @@ public class ExportAdmins extends ExportingToolBase { synchronized (orgsWritten) { logger.info("Exported org {}:{}", uuid, orgs.get(uuid)); orgsWritten.add( uuid ); +orgsNamesWritten.add( orgs.get(uuid) ); }
usergrid git commit: This closes #390
Repository: usergrid Updated Branches: refs/heads/master 7032c033f -> 3bb61da1a This closes #390 Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/3bb61da1 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/3bb61da1 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/3bb61da1 Branch: refs/heads/master Commit: 3bb61da1a222b5111cc8efafc2cbdc0defad31e3 Parents: 7032c03 Author: Mike Dunker Authored: Mon Jan 11 12:58:00 2016 -0800 Committer: Mike Dunker Committed: Mon Jan 11 12:58:00 2016 -0800 -- --
usergrid git commit: Fix non-threadsafe test.
Repository: usergrid Updated Branches: refs/heads/master 95fa52099 -> 7032c033f Fix non-threadsafe test. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/7032c033 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/7032c033 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/7032c033 Branch: refs/heads/master Commit: 7032c033fc6c0d4c3194ad9d7aea5c6772791fa3 Parents: 95fa520 Author: Mike Dunker Authored: Mon Jan 11 11:22:33 2016 -0800 Committer: Mike Dunker Committed: Mon Jan 11 11:22:33 2016 -0800 -- .../java/org/apache/usergrid/rest/management/RegistrationIT.java | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/usergrid/blob/7032c033/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java -- diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java index efa1536..4c0fbcc 100644 --- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java +++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java @@ -17,6 +17,7 @@ package org.apache.usergrid.rest.management; +import net.jcip.annotations.NotThreadSafe; import org.apache.commons.lang.StringUtils; import org.apache.usergrid.persistence.model.util.UUIDGenerator; import org.apache.usergrid.rest.test.resource.AbstractRestIT; @@ -42,6 +43,7 @@ import static org.apache.usergrid.management.AccountCreationProps.*; import static org.junit.Assert.*; +@NotThreadSafe // each test resets the test properties at the end of the test public class RegistrationIT extends AbstractRestIT { private static final Logger logger = LoggerFactory.getLogger(RegistrationIT.class);
[usergrid] Git Push Summary
Repository: usergrid Updated Branches: refs/heads/USERGRID-921 [deleted] 4dd8ef1fb
[usergrid] Git Push Summary
Repository: usergrid Updated Branches: refs/heads/USERGRID-1076 [deleted] 80ffb3548
[usergrid] Git Push Summary
Repository: usergrid Updated Branches: refs/heads/USERGRID-1091refs/heads/2.1-release [deleted] 913544719
[2/2] usergrid git commit: Merge commit 'refs/pull/460/head' of apache.github.com:apache/usergrid
Merge commit 'refs/pull/460/head' of apache.github.com:apache/usergrid Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/95fa5209 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/95fa5209 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/95fa5209 Branch: refs/heads/master Commit: 95fa52099b9f0e993c2f5daa59bb556384da4c31 Parents: ce31acd 27e2992 Author: Mike Dunker Authored: Mon Jan 11 00:32:11 2016 -0800 Committer: Mike Dunker Committed: Mon Jan 11 00:32:11 2016 -0800 -- .../cassandra/ManagementServiceImpl.java| 27 .../migration/AppInfoMigrationPluginTest.java | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) --
[1/2] usergrid git commit: USERGRID-933: fix broken tests
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 Authored: Mon Jan 11 00:12:28 2016 -0800 Committer: Mike Dunker 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 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, Leve