You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/12/02 23:23:07 UTC
[1/2] incubator-usergrid git commit: add more validation
Repository: incubator-usergrid
Updated Branches:
refs/heads/index-alias e2c1a5390 -> 5c2235fcf
add more validation
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d28af0d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d28af0d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d28af0d8
Branch: refs/heads/index-alias
Commit: d28af0d8fa4fb97cdad51504f825d8cb3baec93a
Parents: e2c1a53
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 2 15:19:26 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 2 15:19:26 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/EsEntityIndexImpl.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d28af0d8/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 588a5a1..0b1cb0c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -140,11 +140,12 @@ public class EsEntityIndexImpl implements EntityIndex {
@Override
public void addIndex(final String indexSuffix, final Map<String,Object> config) {
- if(!config.containsKey("replicas") || !config.containsKey("shards")){
- throw new IllegalArgumentException("config must contains 'replicas' and 'shards'");
+ if(!config.containsKey("replicas") || !config.containsKey("shards") ||
+ !(config.get("replicas") instanceof Integer) || !(config.get("shards") instanceof Integer)){
+ throw new IllegalArgumentException("config must contains 'replicas' of type int and 'shards' of type int");
}
String normalizedSuffix = StringUtils.isNotEmpty(indexSuffix) ? indexSuffix : null;
- addIndex(normalizedSuffix, (int) config.get("shards"),(int)config.get("replicas"));
+ addIndex(normalizedSuffix,(int) config.get("shards"),(int)config.get("replicas"));
}
private void addIndex(final String indexSuffix,final int numberOfShards, final int numberOfReplicas) {
[2/2] incubator-usergrid git commit: ignore test for now
Posted by sf...@apache.org.
ignore test for now
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5c2235fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5c2235fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5c2235fc
Branch: refs/heads/index-alias
Commit: 5c2235fcfe4f2b8cdbebadd3d36f84c5f534bf52
Parents: d28af0d
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 2 15:21:38 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 2 15:21:38 2014 -0700
----------------------------------------------------------------------
.../apache/usergrid/rest/IndexResourceIT.java | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5c2235fc/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 bc33baa..9bf0813 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
@@ -21,6 +21,7 @@
package org.apache.usergrid.rest;
import com.fasterxml.jackson.databind.JsonNode;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
@@ -32,9 +33,10 @@ import java.util.Map;
import java.util.UUID;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
/**
- * Classy class class.
+ * test index creation
*/
public class IndexResourceIT extends AbstractRestIT {
@@ -48,6 +50,7 @@ public class IndexResourceIT extends AbstractRestIT {
}
+ @Ignore( "will finish when tests are working from rest" )
@Test
public void TestAddIndex() throws Exception{
String superToken = superAdminToken();
@@ -59,10 +62,16 @@ public class IndexResourceIT extends AbstractRestIT {
UUID appId = this.context.getAppUuid();
// change the password as admin. The old password isn't required
- JsonNode node = mapper.readTree( resource().path( "/index/"+appId ).queryParam( "access_token", superToken )
- .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
- .post( String.class, data ));
-
+ 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");