Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F26E710E7D for ; Wed, 4 Mar 2015 22:38:56 +0000 (UTC) Received: (qmail 2747 invoked by uid 500); 4 Mar 2015 22:38:56 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 2636 invoked by uid 500); 4 Mar 2015 22:38:56 -0000 Mailing-List: contact commits-help@usergrid.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.incubator.apache.org Delivered-To: mailing list commits@usergrid.incubator.apache.org Received: (qmail 2468 invoked by uid 99); 4 Mar 2015 22:38:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Mar 2015 22:38:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8437CE0FC4; Wed, 4 Mar 2015 22:38:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sfeldman@apache.org To: commits@usergrid.apache.org Date: Wed, 04 Mar 2015 22:39:05 -0000 Message-Id: In-Reply-To: <9f67f0ff715f46e592508a1b4b84a98f@git.apache.org> References: <9f67f0ff715f46e592508a1b4b84a98f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/38] incubator-usergrid git commit: [USERGRID-422] Created rest test for the issue. Added system, database, and setup resources for the rest test framework (RTF). [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-432 Commit: efb6e72dec2e68aaa3c839c22a1d819c619e912f Parents: 567db37 Author: grey Authored: Thu Feb 26 13:23:13 2015 -0800 Committer: grey 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); + } +}