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 2015/06/09 18:51:25 UTC
[2/2] incubator-usergrid git commit: add path to add index
add path to add index
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/2d6f4131
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/2d6f4131
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/2d6f4131
Branch: refs/heads/USERGRID-652
Commit: 2d6f4131b52dd201da055effe9562b2a8e352095
Parents: 1b3b02e
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Jun 9 10:51:20 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Jun 9 10:51:20 2015 -0600
----------------------------------------------------------------------
.../apache/usergrid/rest/IndexResourceIT.java | 37 +++++++++++---------
1 file changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2d6f4131/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 afb9610..6378096 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
@@ -20,8 +20,10 @@
package org.apache.usergrid.rest;
-import com.fasterxml.jackson.databind.JsonNode;
-import org.junit.Ignore;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import jdk.nashorn.internal.ir.annotations.Ignore;
+import org.apache.usergrid.rest.test.resource2point0.model.*;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
@@ -32,17 +34,16 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
* test index creation
*/
-public class IndexResourceIT extends AbstractRestIT {
+public class IndexResourceIT extends org.apache.usergrid.rest.test.resource2point0.AbstractRestIT {
+
- @Rule
- public TestContextSetup context = new TestContextSetup( this );
//Used for all MUUserResourceITTests
private Logger LOG = LoggerFactory.getLogger(IndexResourceIT.class);
@@ -50,33 +51,35 @@ public class IndexResourceIT extends AbstractRestIT {
}
- @Ignore( "will finish when tests are working from rest" )
@Test
+ @Ignore
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();
+ String appId = this.clientSetup.getAppUuid();
// change the password as admin. The old password isn't required
- JsonNode node = null;
+ org.apache.usergrid.rest.test.resource2point0.model.ApiResponse 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));
+
+ WebResource resource = this.clientSetup.getRestClient().pathResource("/system/index/" + appId).getResource();
+
+ //added httpBasicauth filter to all setup calls because they all do verification this way.
+ HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( clientSetup.getSuperuserName(),clientSetup.getSuperuserPassword() );
+ resource.addFilter( httpBasicAuthFilter );
+
+ node = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
+ .get( org.apache.usergrid.rest.test.resource2point0.model.ApiResponse.class);
} catch (Exception e) {
LOG.error("failed", e);
fail(e.toString());
}
- assertNull( getError( node ) );
-
- refreshIndex("test-organization", "test-app");
+ assertNotNull( node );
}
}