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/11/27 05:28:54 UTC
[6/7] incubator-usergrid git commit: add index test
add index 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/360a78e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/360a78e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/360a78e4
Branch: refs/heads/index-alias
Commit: 360a78e40b25475eb89d12a1b6ea5235f722e7e5
Parents: 72c165e
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Nov 26 21:28:15 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Nov 26 21:28:15 2014 -0700
----------------------------------------------------------------------
.../apache/usergrid/rest/IndexResourceIT.java | 71 ++++++++++++++++++++
1 file changed, 71 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/360a78e4/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
new file mode 100644
index 0000000..bc33baa
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * * Licensed to the Apache Software Foundation (ASF) under one or more
+ * * contributor license agreements. The ASF licenses this file to You
+ * * under the Apache License, Version 2.0 (the "License"); you may not
+ * * use this file except in compliance with the License.
+ * * You may obtain a copy of the License at
+ * *
+ * * http://www.apache.org/licenses/LICENSE-2.0
+ * *
+ * * Unless required by applicable law or agreed to in writing, software
+ * * distributed under the License is distributed on an "AS IS" BASIS,
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * * See the License for the specific language governing permissions and
+ * * limitations under the License. For additional information regarding
+ * * copyright in this work, please see the NOTICE file in the top level
+ * * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.junit.Rule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertNull;
+
+/**
+ * Classy class class.
+ */
+public class IndexResourceIT extends AbstractRestIT {
+
+
+ @Rule
+ public TestContextSetup context = new TestContextSetup( this );
+ //Used for all MUUserResourceITTests
+ private Logger LOG = LoggerFactory.getLogger(IndexResourceIT.class);
+
+ public IndexResourceIT(){
+
+ }
+
+ @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 );
+
+ 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 ));
+
+ assertNull( getError( node ) );
+
+ refreshIndex("test-organization", "test-app");
+
+ }
+}