You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/02/21 15:02:19 UTC
[13/25] incubator-usergrid git commit: Removed some maven
dependencies that were giving maven warnings. Removed and updated pom to fix
mongo-emulator. Reworked OrganizationIT to use the newOrgandApp creation
structure. Only minor changes though Manually
Removed some maven dependencies that were giving maven warnings.
Removed and updated pom to fix mongo-emulator.
Reworked OrganizationIT to use the newOrgandApp creation structure. Only minor changes though
Manually cleared applicationsServiceIT fixed error where it wasn't clearing before hand.
Added additional method to clearShiroSubject so I can clear the subject manually at the beginning of a test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/518b6799
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/518b6799
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/518b6799
Branch: refs/heads/app-rebuild-fix
Commit: 518b67992122650ab87bffbb31551678addf8f32
Parents: d705f69
Author: grey <gr...@apigee.com>
Authored: Wed Feb 18 09:39:46 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Wed Feb 18 09:39:46 2015 -0800
----------------------------------------------------------------------
stack/mongo-emulator/pom.xml | 15 +------
stack/pom.xml | 47 ++++----------------
.../rest/management/OrganizationsIT.java | 2 +-
.../usergrid/management/OrganizationIT.java | 30 ++++++-------
.../services/ApplicationsServiceIT.java | 8 ++--
.../usergrid/cassandra/ClearShiroSubject.java | 18 ++++++++
6 files changed, 48 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/mongo-emulator/pom.xml
----------------------------------------------------------------------
diff --git a/stack/mongo-emulator/pom.xml b/stack/mongo-emulator/pom.xml
index 7c18367..0047d52 100644
--- a/stack/mongo-emulator/pom.xml
+++ b/stack/mongo-emulator/pom.xml
@@ -59,20 +59,7 @@
</includes>
</testResource>
</testResources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- </systemPropertyVariables>
- <forkMode>always</forkMode>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
- </configuration>
- </plugin>
- </plugins>
+
</build>
<dependencies>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 60cdef4..94fdaf6 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -938,12 +938,6 @@
<dependency>
<groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-xc</artifactId>
- <version>${jackson-version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-smile</artifactId>
<version>${jackson-version}</version>
</dependency>
@@ -1484,24 +1478,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.2</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <optimize>true</optimize>
- <showDeprecation>true</showDeprecation>
- <debug>true</debug>
- <!-- uncomment when building for more detailed profiling information <debuglevel>lines,vars,source</debuglevel> -->
- <encoding>UTF-8</encoding>
- <showWarnings>true</showWarnings>
- </configuration>
- </plugin>
-
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<executions>
@@ -1525,6 +1501,7 @@
<parallel>${usergrid.it.parallel}</parallel>
<forkCount>${usergrid.it.forkCount}</forkCount>
<reuseForks>${usergrid.it.reuseForks}</reuseForks>
+ <threadCount>${usergrid.it.forkCount}</threadCount>
<argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}
</argLine>
</configuration>
@@ -1532,23 +1509,16 @@
<!-- TODO, we may need an exclusion. Appears to be a classloader bug
http://stackoverflow.com/questions/27225140/intermittent-noclassdeffounderror-when-running-a-maven-surefire-build-in-jenkins
-->
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit47</artifactId>
- <version>${surefire.plugin.version}</version>
- </dependency>
- </dependencies>
+ <!--<dependencies>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.maven.surefire</groupId>-->
+ <!--<artifactId>surefire-junit47</artifactId>-->
+ <!--<version>${surefire.plugin.version}</version>-->
+ <!--</dependency>-->
+ <!--</dependencies>-->
</plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sonar-maven-plugin</artifactId>
- </plugin>
-
-
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
@@ -1681,6 +1651,7 @@
</plugins>
</reporting>
+
<!--<repositories>-->
<!--<repository>-->
<!--<id>local-dependencies</id>-->
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
index aa34ad7..8cb079e 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
@@ -62,7 +62,7 @@ public class OrganizationsIT extends AbstractRestIT {
//User property to see if owner properties exist when created.
Map<String, Object> userProperties = new HashMap<String, Object>();
userProperties.put( "company", "Apigee" );
-
+
//Create organization
Organization organization = createOrgPayload( "createOrgAndOwner", userProperties );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index e47dfc7..bd96434 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -52,7 +52,6 @@ public class OrganizationIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
-
@ClassRule
public static ServiceITSetup setup = new ServiceITSetupImpl();
@@ -62,53 +61,54 @@ public class OrganizationIT {
@Test
public void testCreateOrganization() throws Exception {
- UserInfo user =
- setup.getMgmtSvc().createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), "test", false, false );
- assertNotNull( user );
+// UserInfo user =
+// setup.getMgmtSvc().createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), "test", false, false );
+// assertNotNull( user );
final String orgName = uniqueOrg();
-
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( orgName, user, false );
+ OrganizationOwnerInfo organization = newOrgAppAdminRule.createOwnerAndOrganization( orgName, uniqueUsername(), uniqueEmail(),"Ed Anuff", "test" ); //setup.getMgmtSvc().getOrganizationsForAdminUser( organization.getOwner().getUuid() );
+ //createOrganization( orgName, user, false );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
-
- Map<UUID, String> userOrganizations = setup.getMgmtSvc().getOrganizationsForAdminUser( user.getUuid() );
+ Map<UUID, String> userOrganizations = setup.getMgmtSvc().getOrganizationsForAdminUser(
+ organization.getOwner().getUuid() );
assertEquals( "wrong number of organizations", 1, userOrganizations.size() );
- List<UserInfo> users = setup.getMgmtSvc().getAdminUsersForOrganization( organization.getUuid() );
+ List<UserInfo> users = setup.getMgmtSvc().getAdminUsersForOrganization(
+ organization.getOrganization().getUuid() );
assertEquals( "wrong number of users", 1, users.size() );
- UUID applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "ed-application" ).getId();
+ UUID applicationId = setup.getMgmtSvc().createApplication( organization.getOrganization().getUuid(), "ed-application" ).getId();
assertNotNull( applicationId );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
setup.getEmf().getEntityManager( applicationId ).refreshIndex();
- Map<UUID, String> applications = setup.getMgmtSvc().getApplicationsForOrganization( organization.getUuid() );
+ Map<UUID, String> applications = setup.getMgmtSvc().getApplicationsForOrganization( organization.getOrganization().getUuid() );
assertEquals( "wrong number of applications", 1, applications.size() );
OrganizationInfo organization2 = setup.getMgmtSvc().getOrganizationForApplication( applicationId );
assertNotNull( organization2 );
assertEquals( "wrong organization name", orgName, organization2.getName() );
- boolean verified = setup.getMgmtSvc().verifyAdminUserPassword( user.getUuid(), "test" );
+ boolean verified = setup.getMgmtSvc().verifyAdminUserPassword( organization.getOwner().getUuid(), "test" );
assertTrue( verified );
setup.getMgmtSvc().activateOrganization( organization2 );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
- UserInfo u = setup.getMgmtSvc().verifyAdminUserPasswordCredentials( user.getUuid().toString(), "test" );
+ UserInfo u = setup.getMgmtSvc().verifyAdminUserPasswordCredentials( organization.getOwner().getUuid().toString(), "test" );
assertNotNull( u );
- String token = setup.getMgmtSvc().getAccessTokenForAdminUser( user.getUuid(), 0 );
+ String token = setup.getMgmtSvc().getAccessTokenForAdminUser( organization.getOwner().getUuid(), 0 );
assertNotNull( token );
AuthPrincipalInfo principal =
( ( ManagementServiceImpl ) setup.getMgmtSvc() ).getPrincipalFromAccessToken( token, null, null );
assertNotNull( principal );
- assertEquals( user.getUuid(), principal.getUuid() );
+ assertEquals( organization.getOwner().getUuid(), principal.getUuid() );
UserInfo new_user = setup.getMgmtSvc()
.createAdminUser(uniqueUsername(), "Test User", uniqueEmail(),
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/services/src/test/java/org/apache/usergrid/services/ApplicationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ApplicationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ApplicationsServiceIT.java
index a8b54bb..7c652ce 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ApplicationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ApplicationsServiceIT.java
@@ -16,15 +16,15 @@
*/
package org.apache.usergrid.services;
-
import org.junit.Test;
-
-
-
public class ApplicationsServiceIT extends AbstractServiceIT {
+
@Test
public void testPermissions() throws Exception {
+
+ clearShiroSubject.clear();
+
app.createRole( "manager", null, 0 );
app.createRole( "member", null, 0 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/518b6799/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
index e24afe4..50d01c8 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/ClearShiroSubject.java
@@ -22,6 +22,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.mgt.*;
+import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.support.SubjectThreadState;
@@ -37,11 +39,27 @@ public class ClearShiroSubject extends ExternalResource {
Subject subject = SecurityUtils.getSubject();
if ( subject == null ) {
+
LOG.info( "Shiro Subject was null. No need to clear." );
return;
}
new SubjectThreadState( subject ).clear();
+
LOG.info( "Shiro Subject was NOT null. Subject has been cleared." );
}
+
+ public void clear(){
+ Subject subject = SecurityUtils.getSubject();
+
+ if ( subject == null ) {
+
+ LOG.info( "Shiro Subject was null. No need to clear manually." );
+ return;
+ }
+
+ new SubjectThreadState( subject ).clear();
+
+ LOG.info( "Shiro Subject was NOT null. Subject has been cleared manually." );
+ }
}