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/02/26 22:23:17 UTC
incubator-usergrid git commit: [USERGRID-422] Created rest test for
the issue. Added system, database,
and setup resources for the rest test framework (RTF).
Repository: incubator-usergrid
Updated Branches:
refs/heads/USERGRID-422 [created] efb6e72de
[USERGRID-422] Created rest test for the issue.
Added system,database,and setup resources for the rest test framework (RTF).
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/efb6e72d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/efb6e72d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/efb6e72d
Branch: refs/heads/USERGRID-422
Commit: efb6e72dec2e68aaa3c839c22a1d819c619e912f
Parents: 567db37
Author: grey <gr...@apigee.com>
Authored: Thu Feb 26 13:23:13 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Thu Feb 26 13:23:13 2015 -0800
----------------------------------------------------------------------
.../apache/usergrid/rest/SystemResourceIT.java | 41 ++++++++++++++++++++
.../rest/test/resource2point0/RestClient.java | 4 ++
.../endpoints/DatabaseResource.java | 39 +++++++++++++++++++
.../endpoints/SetupResource.java | 39 +++++++++++++++++++
.../endpoints/SystemResource.java | 36 +++++++++++++++++
5 files changed, 159 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/efb6e72d/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
new file mode 100644
index 0000000..7b13a19
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+package org.apache.usergrid.rest;
+
+
+import org.junit.Test;
+
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+
+import static org.junit.Assert.assertNotNull;
+
+
+/**
+ * Tests endpoints that use /system/*
+ */
+public class SystemResourceIT extends AbstractRestIT {
+
+ @Test
+ public void testSystemDatabaseAlreadyRun() {
+ Entity ent = clientSetup.getRestClient().system().database().setup().get();
+
+ assertNotNull(ent);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/efb6e72d/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
index ebd1e35..cf2d1f6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
@@ -16,6 +16,7 @@
*/
package org.apache.usergrid.rest.test.resource2point0;
+import org.apache.usergrid.rest.test.resource2point0.endpoints.SystemResource;
import org.apache.usergrid.rest.test.resource2point0.endpoints.TokenResource;
import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource;
import org.apache.usergrid.rest.test.resource2point0.endpoints.OrganizationResource;
@@ -72,6 +73,9 @@ public class RestClient implements UrlResource {
return context;
}
+ public SystemResource system() {
+ return new SystemResource(context, this);
+ }
/**
* Get the management resource
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/efb6e72d/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
new file mode 100644
index 0000000..7ed31ac
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+package org.apache.usergrid.rest.test.resource2point0.endpoints;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.persistence.cassandra.Setup;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+
+/**
+ * Contains methods pertaining to system/database/*
+ */
+public class DatabaseResource extends NamedResource {
+
+ public DatabaseResource( final ClientContext context, final UrlResource parent ) {
+ super( "database", context, parent );
+ }
+
+ public SetupResource setup(){
+ return new SetupResource (context, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/efb6e72d/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
new file mode 100644
index 0000000..34d1848
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+package org.apache.usergrid.rest.test.resource2point0.endpoints;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+
+/**
+ * Functions as the endpoint for all resources that hit /system/ * /setup
+ */
+public class SetupResource extends NamedResource {
+
+ public SetupResource( final ClientContext context, final UrlResource parent ) {
+ super("setup",context,parent);
+ }
+
+ public Entity get(){
+ return getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
+ .get( Entity.class );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/efb6e72d/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
new file mode 100644
index 0000000..e2bff1f
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+
+package org.apache.usergrid.rest.test.resource2point0.endpoints;
+
+
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+
+/**
+ * Handles making rest calls to system resources.
+ */
+public class SystemResource extends NamedResource {
+
+ public SystemResource(final ClientContext context, final UrlResource parent ) {
+ super( "system",context, parent );
+ }
+
+ public DatabaseResource database() {
+ return new DatabaseResource(context, this);
+ }
+}