You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/06/10 00:39:38 UTC
[1/2] incubator-usergrid git commit: [USERGRID-613] Added fix mixed
cases in two-dot-o.
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o a78401642 -> 7fd643cdf
[USERGRID-613] Added fix mixed cases in two-dot-o.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e9ad00c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e9ad00c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e9ad00c7
Branch: refs/heads/two-dot-o
Commit: e9ad00c7c7494ba08f1941b79ba28644f4eafdeb
Parents: a784016
Author: GERey <gr...@apigee.com>
Authored: Thu Jun 4 11:35:36 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Thu Jun 4 11:35:36 2015 -0700
----------------------------------------------------------------------
.../main/java/org/apache/usergrid/rest/IndexResource.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e9ad00c7/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
index 2ffc13f..f32824f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
@@ -178,7 +178,7 @@ public class IndexResource extends AbstractContextResource {
public void run() {
- logger.info( "Started rebuilding application {} in collection {}", appId, collectionName );
+ logger.info( "Started rebuilding application {} in collection {}", appId, collectionName.toLowerCase() );
try {
rebuildCollection( appId, collectionName, reverse );
@@ -188,11 +188,11 @@ public class IndexResource extends AbstractContextResource {
throw new RuntimeException("Error rebuilding collection");
}
- logger.info( "Completed rebuilding application {} in collection {}", appId, collectionName );
+ logger.info( "Completed rebuilding application {} in collection {}", appId, collectionName.toLowerCase() );
}
};
- rebuild.setName( String.format( "Index rebuild for app %s and collection %s", appId, collectionName ) );
+ rebuild.setName( String.format( "Index rebuild for app %s and collection %s", appId, collectionName.toLowerCase() ) );
rebuild.setDaemon( true );
rebuild.start();
@@ -294,9 +294,9 @@ public class IndexResource extends AbstractContextResource {
};
- logger.info( "Reindexing for app id: {} and collection {}", applicationId, collectionName );
+ logger.info( "Reindexing for app id: {} and collection {}", applicationId, collectionName.toLowerCase() );
- emf.rebuildCollectionIndex(applicationId, collectionName, reverse, po);
+ emf.rebuildCollectionIndex(applicationId, collectionName.toLowerCase(), reverse, po);
emf.refreshIndex();
}
[2/2] incubator-usergrid git commit: [USERGRID-613] juryrigged a way
to test for lowercase and mixed case values.
Posted by gr...@apache.org.
[USERGRID-613] juryrigged a way to test for lowercase and mixed case values.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/7fd643cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/7fd643cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/7fd643cd
Branch: refs/heads/two-dot-o
Commit: 7fd643cdfd2d92dddcf0417bfbca565b4089efc0
Parents: e9ad00c
Author: GERey <gr...@apigee.com>
Authored: Tue Jun 9 15:36:06 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Tue Jun 9 15:36:06 2015 -0700
----------------------------------------------------------------------
.../apache/usergrid/rest/IndexResourceIT.java | 92 ++++++++++++++------
.../rest/test/resource2point0/ClientSetup.java | 12 ++-
.../endpoints/SystemResource.java | 21 +++++
.../endpoints/mgmt/ApplicationResource.java | 6 +-
4 files changed, 100 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7fd643cd/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
index 77f443f..a310368 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
@@ -32,6 +32,13 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource2point0.model.Token;
+
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
@@ -49,33 +56,66 @@ public class IndexResourceIT extends AbstractRestIT {
public IndexResourceIT(){
}
-
- @Ignore( "will finish when tests are working from rest" )
+//TODO: convert over and recheck intention of test.
+// @Ignore( "will finish when tests are working from rest" )
+// @Test
+// public void TestAddIndex() throws Exception{
+// String superToken = superAdminToken();
+//
+// Map<String, Object> data = new HashMap<String, Object>();
+// data.put( "replicas", 0 );
+// data.put( "shards", 1 );
+// data.put( "writeConsistency", "one" );
+//
+// UUID appId = this.context.getAppUuid();
+//
+// // change the password as admin. The old password isn't required
+// JsonNode node = null;
+// try {
+// node = mapper.readTree(resource().path("/system/index/" + appId)
+// .queryParam("access_token", superToken)
+// .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON_TYPE)
+// .post(String.class, data));
+// } catch (Exception e) {
+// LOG.error("failed", e);
+// fail(e.toString());
+// }
+// assertNull( getError( node ) );
+//
+// refreshIndex("test-organization", "test-app");
+//
+// }
@Test
- public void TestAddIndex() throws Exception{
- String superToken = superAdminToken();
-
- Map<String, Object> data = new HashMap<String, Object>();
- data.put( "replicas", 0 );
- data.put( "shards", 1 );
- data.put( "writeConsistency", "one" );
-
- UUID appId = this.context.getAppUuid();
-
- // change the password as admin. The old password isn't required
- JsonNode node = null;
- try {
- node = mapper.readTree(resource().path("/system/index/" + appId)
- .queryParam("access_token", superToken)
- .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON_TYPE)
- .post(String.class, data));
- } catch (Exception e) {
- LOG.error("failed", e);
- fail(e.toString());
- }
- assertNull( getError( node ) );
-
- refreshIndex("test-organization", "test-app");
+ public void testCaseReindexEndpoint() {
+
+ //Create Collection
+ Map payload = new HashMap<>( );
+ payload.put( "name","wazer wifle!!" );
+ Entity payloadEntity = new Entity( payload );
+ Entity collectionResponse = this.clientSetup.getRestClient().org( clientSetup.getOrganizationName() )
+ .app( clientSetup.getAppName())
+ .collection( "belp").post(payloadEntity);
+
+ assertNotNull( collectionResponse );
+
+ //try reindex endpoint with ALl mixed case characters
+ Token superUserToken = clientSetup.getRestClient().management().token().post(new Token( clientSetup.getSuperuserName(),clientSetup.getSuperuserPassword() )); //.get(new Token(clientSetup.getSuperuserName(),clientSetup.getSuperuserPassword()));
+
+ QueryParameters queryParameters = new QueryParameters();
+ queryParameters.addParam( "access_token",superUserToken.getAccessToken());
+ org.apache.usergrid.rest.test.resource2point0.model.ApiResponse result = this.clientSetup.getRestClient().system()
+ .addToPath( "index" ).addToPath( "rebuild" )
+ .addToPath( clientSetup.getAppUuid() ).addToPath( "bElp" ).put();
+
+ assertNotNull(result);
+
+ queryParameters = new QueryParameters();
+ queryParameters.addParam( "access_token",superUserToken.getAccessToken());
+ result = this.clientSetup.getRestClient().system()
+ .addToPath( "index" ).addToPath( "rebuild" )
+ .addToPath( clientSetup.getAppUuid() ).addToPath( "belp" ).put();
+
+ assertNotNull( result );
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7fd643cd/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
index e033c2d..82e7c70 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
@@ -22,8 +22,11 @@ package org.apache.usergrid.rest.test.resource2point0;
import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.UUID;
import org.apache.usergrid.rest.test.resource2point0.model.Application;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
import org.apache.usergrid.rest.test.resource2point0.model.Token;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@@ -50,12 +53,13 @@ public class ClientSetup implements TestRule {
protected String password;
protected String orgName;
protected String appName;
+ protected String appUuid;
protected Token superuserToken;
protected String superuserName = "superuser";
protected String superuserPassword = "superpassword";
protected Organization organization;
- protected Application application;
+ protected Entity application;
public ClientSetup (String serverUrl) {
@@ -114,7 +118,9 @@ public class ClientSetup implements TestRule {
restClient.management().token().post(new Token(username,username));
- restClient.management().orgs().organization(organization.getName()).app().post(new Application(appName));
+ application = restClient.management().orgs().organization(organization.getName()).app().post(new Application(appName));
+ // application = restClient.management().orgs().organization(organization.getName()).app().get();
+ appUuid = (String)((LinkedHashMap)application.getDynamicProperties().get( "data" )).get( orgName+"/"+appName );
}
@@ -130,6 +136,8 @@ public class ClientSetup implements TestRule {
public String getAppName() {return appName;}
+ public String getAppUuid() {return appUuid;}
+
public Token getSuperuserToken() {
return superuserToken;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7fd643cd/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
index e2bff1f..ee70942 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
@@ -18,6 +18,10 @@
package org.apache.usergrid.rest.test.resource2point0.endpoints;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
@@ -30,7 +34,24 @@ public class SystemResource extends NamedResource {
super( "system",context, parent );
}
+ //Dirty hack for path resource in new branch of two-dot-o
+ public SystemResource(final String name,final ClientContext context, final UrlResource parent ) {
+ super( name,context, parent );
+ }
+
+
public DatabaseResource database() {
return new DatabaseResource(context, this);
}
+
+ public SystemResource addToPath( String pathPart ) {
+ return new SystemResource( pathPart, context, this );
+ }
+
+ public ApiResponse put(){
+ ApiResponse
+ response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+ .put(ApiResponse.class);
+ return response;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7fd643cd/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
index 6b7742f..e9947e3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
@@ -46,9 +46,9 @@ public class ApplicationResource extends NamedResource {
}
- public void post(Application application) {
- getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
- .accept(MediaType.APPLICATION_JSON).post(application);
+ public Application post(Application application) {
+ return getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+ .accept(MediaType.APPLICATION_JSON).post(Application.class,application);
}
public Entity post(Entity payload){