You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2017/05/08 20:52:10 UTC
[1/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Repository: jclouds-labs-google
Updated Branches:
refs/heads/master 2759926e5 -> a4acb11f7
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclInsertTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclInsertTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclInsertTest.java
deleted file mode 100644
index c449c42..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclInsertTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class DefaultObjectAclInsertTest extends BaseGoogleCloudStorageParseTest<ObjectAccessControls> {
-
- @Override
- public String resource() {
- return "/default_object_acl_insert_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ObjectAccessControls expected() {
- return ObjectAccessControls.builder().entity("allUsers").role(ObjectRole.OWNER).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclListTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclListTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclListTest.java
deleted file mode 100644
index afc66ae..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclListTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam.Team;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.jclouds.rest.annotations.SelectJson;
-
-public class DefaultObjectAclListTest extends BaseGoogleCloudStorageParseTest<List<ObjectAccessControls>> {
-
- private ObjectAccessControls item_1 = ObjectAccessControls.builder()
- .entity("project-owners-1082289308625").role(ObjectRole.OWNER)
- .projectTeam(ProjectTeam.create("1082289308625", Team.OWNERS))
- .build();
-
- @Override
- public String resource() {
- return "/default_object_acl_list.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("items")
- public List<ObjectAccessControls> expected() {
- return Arrays.asList(item_1);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/FullBucketGetTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/FullBucketGetTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/FullBucketGetTest.java
deleted file mode 100644
index 0f155e3..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/FullBucketGetTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.util.Arrays;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.Bucket.Cors;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam.Team;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class FullBucketGetTest extends BaseGoogleCloudStorageParseTest<Bucket> {
-
- private final BucketAccessControls acl1 = BucketAccessControls
- .builder()
- .id("jcloudstestbucket3500/project-owners-1082289308625")
- .bucket("jcloudstestbucket3500").entity("project-owners-1082289308625").role(Role.OWNER)
- .projectTeam(ProjectTeam.create("1082289308625", Team.OWNERS))
- .build();
-
- private final ObjectAccessControls defObjectAcl = ObjectAccessControls.builder()
- .entity("project-owners-1082289308625").role(ObjectRole.OWNER).build();
-
- private final Cors bucketCors = Cors
- .create(Arrays.asList("http://example.appspot.com"), Arrays.asList("GET", "HEAD"),
- Arrays.asList("x-meta-goog-custom"), 10);
-
- @Override
- public String resource() {
- return "/full_bucket_get.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public Bucket expected() {
- return Bucket.create(
- "jcloudstestbucket3500", // id
- "jcloudstestbucket3500", // name
- 1082289308625L, // projectNumber
- new SimpleDateFormatDateService().iso8601DateParse("2014-06-19T14:03:22.345Z"), // timeCreated
- 10L, // metageneration
- Arrays.asList(acl1), // acl
- Arrays.asList(defObjectAcl), // defaultObjectAcl
- Owner.create("project-owners-1082289308625", null), // owner
- Location.US, // location
- null, // website
- null, // logging
- null, // versioning
- Arrays.asList(bucketCors), // cors
- null, // lifeCycle
- StorageClass.STANDARD // storageClass
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketListTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketListTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketListTest.java
deleted file mode 100644
index 84d644a..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketListTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.util.Arrays;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloud.domain.ForwardingListPage;
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class NoAclBucketListTest extends BaseGoogleCloudStorageParseTest<ListPage<Bucket>> {
-
- private Bucket item1 = Bucket.create("bhashbucket", // id
- "bhashbucket", // name
- 1082289308625L, // projectNumber
- new SimpleDateFormatDateService().iso8601DateParse("2014-06-02T19:19:41.112z"), // timeCreated
- 99L, // metageneration
- null, // acl
- null, // defaultObjectAcl
- Owner.create("project-owners-1082289308625", null), // owner
- Location.US, // location
- null, // website
- null, // logging
- null, // versioning
- null, // cors
- null, // lifeCycle
- StorageClass.STANDARD // storageClass
- );
-
- @Override
- public String resource() {
- return "/no_acl_bucket_list.json";
- }
-
- @Override @Consumes(MediaType.APPLICATION_JSON)
- public ListPage<Bucket> expected() {
- return ForwardingListPage.create(Arrays.asList(item1), "bhashbucket");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketTest.java
deleted file mode 100644
index 5e93f4f..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/NoAclBucketTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class NoAclBucketTest extends BaseGoogleCloudStorageParseTest<Bucket> {
-
- @Override
- public String resource() {
- return "/no_acl_bucket.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public Bucket expected() {
- return Bucket.create(
- "bhashbucket", // id
- "bhashbucket", // name
- 1082289308625L, // projectNumber
- new SimpleDateFormatDateService().iso8601DateParse("2014-06-02T19:19:41.112z"), // timeCreated
- 87L, // metageneration
- null, // acl
- null, // defaultObjectAcl
- Owner.create("project-owners-1082289308625", null), // owner
- Location.US, // location
- null, // website
- null, // logging
- null, // versioning
- null, // cors
- null, // lifeCycle
- StorageClass.STANDARD // storageClass
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclGetTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclGetTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclGetTest.java
deleted file mode 100644
index 0cef68e..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclGetTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam.Team;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class ObjectAclGetTest extends BaseGoogleCloudStorageParseTest<ObjectAccessControls> {
-
- @Override
- public String resource() {
- return "/object_acl_get.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ObjectAccessControls expected() {
- return ObjectAccessControls
- .builder()
- .bucket("jcloudstestbucket")
- .object("foo.txt")
- .generation(1394121608485000L)
- .entity("project-owners-1082289308625")
- .role(ObjectRole.OWNER)
- .projectTeam(ProjectTeam.create("1082289308625", Team.OWNERS))
- .id("jcloudstestbucket/foo.txt/1394121608485000/project-owners-1082289308625").build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclInsertTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclInsertTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclInsertTest.java
deleted file mode 100644
index b4ccfa2..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclInsertTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class ObjectAclInsertTest extends BaseGoogleCloudStorageParseTest<ObjectAccessControls> {
-
- @Override
- public String resource() {
- return "/object_acl_insert_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ObjectAccessControls expected() {
- return ObjectAccessControls
- .builder()
- .bucket("jcloudstestbucket").object("foo.txt")
- .entity("user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d")
- .entityId("00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d").role(ObjectRole.OWNER)
- .build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclListTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclListTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclListTest.java
deleted file mode 100644
index 426da0d..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclListTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.jclouds.rest.annotations.SelectJson;
-
-public class ObjectAclListTest extends BaseGoogleCloudStorageParseTest<List<ObjectAccessControls>> {
-
- private ObjectAccessControls item1 = ObjectAccessControls
- .builder()
- .id("jcloudstestbucket/foo.txt/1394121608485000/user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d")
- .bucket("jcloudstestbucket").object("foo.txt").generation(Long.valueOf("1394121608485000"))
- .entity("user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d")
- .entityId("00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d").role(ObjectRole.OWNER)
- .build();
-
- @Override
- public String resource() {
- return "/object_acl_list.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("items")
- public List<ObjectAccessControls> expected() {
- return Arrays.asList(item1);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclUpdateTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclUpdateTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclUpdateTest.java
deleted file mode 100644
index 205622e..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ObjectAclUpdateTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class ObjectAclUpdateTest extends BaseGoogleCloudStorageParseTest<ObjectAccessControls> {
-
- @Override
- public String resource() {
- return "/object_acl_update_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ObjectAccessControls expected() {
- return ObjectAccessControls.builder()
- .bucket("jcloudstestbucket").object("foo.txt").entity("allUsers").role(ObjectRole.OWNER).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObject.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObject.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObject.java
deleted file mode 100644
index 811a928..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObject.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ParseGoogleCloudStorageObject")
-public class ParseGoogleCloudStorageObject extends BaseGoogleCloudStorageParseTest<GoogleCloudStorageObject> {
-
- @Override
- public String resource() {
- return "/object_get.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public GoogleCloudStorageObject expected() {
- return GoogleCloudStorageObject.create(
- "test/file_name/1000", //id
- URI.create("https://www.googleapis.com/storage/v1/b/test/o/file_name"), //selfLink
- "etag", // etag
- "file_name", // name
- "test", // bucket
- (long) 1000, //generation
- (long) 8, // metageneration
- "application/x-tar", // contentType
- parse("2014-09-27T00:01:44.819"), // updated
- null, // timeDeleted
- StorageClass.STANDARD, // storageClass
- (long) 1000, //size,
- "md5Hash", // md5Hash
- URI.create("https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media"), // mediaLink
- null, // metadata
- null, // contentEncoding
- null, // contentDisposition,
- null, // contentLanguage
- null, // cacheControl
- null, // acl
- Owner.create("entity", "entityId"), // owner,
- "crc32c", // crc32c,
- null); //componentCount
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObjectListTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObjectListTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObjectListTest.java
deleted file mode 100644
index 081da69..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseGoogleCloudStorageObjectListTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-
-
-@Test(groups = "unit", testName = "ParseGoogleCloudStorageObjectListTest")
-public class ParseGoogleCloudStorageObjectListTest extends BaseGoogleCloudStorageParseTest<ListPageWithPrefixes<GoogleCloudStorageObject>> {
-
- @Override
- public String resource() {
- return "/object_list.json";
- }
-
- GoogleCloudStorageObject object1 = GoogleCloudStorageObject.create(
- "test/file_name/1000", //id
- URI.create("https://www.googleapis.com/storage/v1/b/test/o/file_name"), //selfLink
- "etag", // etag
- "file_name", // name
- "test", // bucket
- (long) 1000, //generation
- (long) 8, // metageneration
- "application/x-tar", // contentType
- parse("2014-09-27T00:01:44.819"), // updated
- null, // timeDeleted
- StorageClass.STANDARD, // storageClass
- (long) 1000, //size,
- "md5Hash", // md5Hash
- URI.create("https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media"), // mediaLink
- null, // metadata
- null, // contentEncoding
- null, // contentDisposition,
- null, // contentLanguage
- null, // cacheControl
- null, // acl
- Owner.create("entity", "entityId"), // owner,
- "crc32c", // crc32c,
- null); //componentCount
-
- GoogleCloudStorageObject object2 = GoogleCloudStorageObject.create(
- "test/file_name2/1000", //id
- URI.create("https://www.googleapis.com/storage/v1/b/test/o/file_name2"), //selfLink
- "etag", // etag
- "file_name2", // name
- "test", // bucket
- (long) 1001, //generation
- (long) 9, // metageneration
- "image/png", // contentType
- parse("2014-09-27T00:01:44.819"), // updated
- null, // timeDeleted
- StorageClass.STANDARD, // storageClass
- (long) 10, //size,
- "md5Hash", // md5Hash
- URI.create("https://www.googleapis.com/download/storage/v1/b/test/o/file_name2?generation=1001&alt=media"), // mediaLink
- null, // metadata
- null, // contentEncoding
- null, // contentDisposition,
- null, // contentLanguage
- null, // cacheControl
- null, // acl
- Owner.create("entity", "entityId"), // owner,
- "crc32c", // crc32c,
- null); //componentCount
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ListPageWithPrefixes<GoogleCloudStorageObject> expected() {
- List<GoogleCloudStorageObject> items = ImmutableList.of(object1, object2);
- return new ListPageWithPrefixes<GoogleCloudStorageObject>(items, null, null);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseObjectRewriteResponse.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseObjectRewriteResponse.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseObjectRewriteResponse.java
deleted file mode 100644
index 2b4a2e3..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/ParseObjectRewriteResponse.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.domain.RewriteResponse;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ParseObjectRewriteResponse")
-public class ParseObjectRewriteResponse extends BaseGoogleCloudStorageParseTest<RewriteResponse> {
-
- @Override
- public String resource() {
- return "/object_rewrite.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public RewriteResponse expected() {
- return RewriteResponse.create(16, // totalBytesRewritten
- 16, // objectSize
- true, // done
- "rewriteToken", // rewriteToken
- GoogleCloudStorageObject.create(
- "test/file_name/1000", //id
- URI.create("https://www.googleapis.com/storage/v1/b/test/o/file_name"), //selfLink
- "etag", // etag
- "file_name", // name
- "test", // bucket
- (long) 1000, //generation
- (long) 8, // metageneration
- "application/x-tar", // contentType
- parse("2014-09-27T00:01:44.819"), // updated
- null, // timeDeleted
- StorageClass.STANDARD, // storageClass
- (long) 1000, //size,
- "md5Hash", // md5Hash
- URI.create("https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media"), // mediaLink
- null, // metadata
- null, // contentEncoding
- null, // contentDisposition,
- null, // contentLanguage
- null, // cacheControl
- null, // acl
- Owner.create("entity", "entityId"), // owner,
- "crc32c", // crc32c,
- null) //componentCount
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_get.json b/google-cloud-storage/src/test/resources/bucket_acl_get.json
deleted file mode 100644
index 27f3d3f..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_get.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket/allUsers",
- "selfLink": "https://content.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers",
- "bucket": "jcloudstestbucket",
- "entity": "allUsers",
- "role": "READER",
- "etag": "CAM="
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_insert_initial.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_insert_initial.json b/google-cloud-storage/src/test/resources/bucket_acl_insert_initial.json
deleted file mode 100644
index d0389bc..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_insert_initial.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "entity": "allAuthenticatedUsers",
- "role": "WRITER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_insert_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_insert_response.json b/google-cloud-storage/src/test/resources/bucket_acl_insert_response.json
deleted file mode 100644
index 144aa32..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_insert_response.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket/allAuthenticatedUsers",
- "selfLink": "https://content.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allAuthenticatedUsers",
- "bucket": "jcloudstestbucket",
- "entity": "allAuthenticatedUsers",
- "role": "WRITER",
- "etag": "CAQ="
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_list.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_list.json b/google-cloud-storage/src/test/resources/bucket_acl_list.json
deleted file mode 100644
index dd8ca03..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_list.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "kind": "storage#bucketAccessControls",
- "items": [
- {
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket/allUsers",
- "selfLink": "https://content.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers",
- "bucket": "jcloudstestbucket",
- "entity": "allUsers",
- "role": "READER",
- "etag": "CAc="
- },
- {
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket/project-owners-1082289308625",
- "selfLink": "https://content.googleapis.com/storage/v1/b/jcloudstestbucket/acl/project-owners-1082289308625",
- "bucket": "jcloudstestbucket",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "projectTeam": {
- "projectNumber": "1082289308625",
- "team": "owners"
- },
- "etag": "CAc="
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_update_initial.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_update_initial.json b/google-cloud-storage/src/test/resources/bucket_acl_update_initial.json
deleted file mode 100644
index 6bb3630..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_update_initial.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "entity": "allUsers",
- "role": "OWNER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_acl_update_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_acl_update_response.json b/google-cloud-storage/src/test/resources/bucket_acl_update_response.json
deleted file mode 100644
index 5859e13..0000000
--- a/google-cloud-storage/src/test/resources/bucket_acl_update_response.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket/allUsers",
- "selfLink": "https://content.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers",
- "bucket": "jcloudstestbucket",
- "entity": "allUsers",
- "role": "OWNER",
- "etag": "CAg="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_insert_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_insert_request_payload.json b/google-cloud-storage/src/test/resources/bucket_insert_request_payload.json
deleted file mode 100644
index b3a042c..0000000
--- a/google-cloud-storage/src/test/resources/bucket_insert_request_payload.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name":"bhashbucket"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_update_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_update_request_payload.json b/google-cloud-storage/src/test/resources/bucket_update_request_payload.json
deleted file mode 100644
index 07955dd..0000000
--- a/google-cloud-storage/src/test/resources/bucket_update_request_payload.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name":"bhashbucket",
- "acl": [
- {
- "kind":"storage#bucketAccessControl",
- "bucket":"bhashbucket",
- "id":"bhashbucket/allAuthenticatedUsers",
- "entity": "allAuthenticatedUsers",
- "role": "OWNER"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/bucket_update_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/bucket_update_response.json b/google-cloud-storage/src/test/resources/bucket_update_response.json
deleted file mode 100644
index ad5e44c..0000000
--- a/google-cloud-storage/src/test/resources/bucket_update_response.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "kind": "storage#bucket",
- "id": "bhashbucket",
- "selfLink": "https://www.googleapis.com/storage/v1/b/bhashbucket",
- "projectNumber": "1082289308625",
- "name": "bhashbucket",
- "timeCreated": "2014-06-02T19:19:41.112Z",
- "metageneration": "204",
- "owner": {
- "entity": "project-owners-1082289308625"
- },
- "location": "US",
- "storageClass": "STANDARD",
- "etag": "CMwB"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_get.json b/google-cloud-storage/src/test/resources/default_object_acl_get.json
deleted file mode 100644
index 8e42d23..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_get.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "projectTeam": {
- "projectNumber": "1082289308625",
- "team": "owners"
- },
- "etag": "CAk="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_insert_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_insert_request_payload.json b/google-cloud-storage/src/test/resources/default_object_acl_insert_request_payload.json
deleted file mode 100644
index 6bb3630..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_insert_request_payload.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "entity": "allUsers",
- "role": "OWNER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_insert_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_insert_response.json b/google-cloud-storage/src/test/resources/default_object_acl_insert_response.json
deleted file mode 100644
index 9e0af50..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_insert_response.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "entity": "allUsers",
- "role": "OWNER",
- "etag": "CAo="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_list.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_list.json b/google-cloud-storage/src/test/resources/default_object_acl_list.json
deleted file mode 100644
index d963de1..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_list.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "kind": "storage#objectAccessControls",
- "items": [
- {
- "kind": "storage#objectAccessControl",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "projectTeam": {
- "projectNumber": "1082289308625",
- "team": "owners"
- },
- "etag": "CAk="
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_update_initial.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_update_initial.json b/google-cloud-storage/src/test/resources/default_object_acl_update_initial.json
deleted file mode 100644
index 9e0af50..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_update_initial.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "entity": "allUsers",
- "role": "OWNER",
- "etag": "CAo="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/default_object_acl_update_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/default_object_acl_update_request_payload.json b/google-cloud-storage/src/test/resources/default_object_acl_update_request_payload.json
deleted file mode 100644
index d50e7a4..0000000
--- a/google-cloud-storage/src/test/resources/default_object_acl_update_request_payload.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "entity": "allUsers",
- "role": "OWNER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/full_bucket_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/full_bucket_get.json b/google-cloud-storage/src/test/resources/full_bucket_get.json
deleted file mode 100644
index 42e2cf4..0000000
--- a/google-cloud-storage/src/test/resources/full_bucket_get.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "kind": "storage#bucket",
- "id": "jcloudstestbucket3500",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket3500",
- "projectNumber": "1082289308625",
- "name": "jcloudstestbucket3500",
- "timeCreated": "2014-06-19T14:03:22.345Z",
- "metageneration": "10",
- "acl": [
- {
- "kind": "storage#bucketAccessControl",
- "id": "jcloudstestbucket3500/project-owners-1082289308625",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket3500/acl/project-owners-1082289308625",
- "bucket": "jcloudstestbucket3500",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "projectTeam": {
- "projectNumber": "1082289308625",
- "team": "owners"
- },
- "etag": "CAo="
- }
- ],
- "defaultObjectAcl": [
- {
- "kind": "storage#objectAccessControl",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "etag": "CAo="
- }
- ],
-
- "cors": [
- {
- "maxAgeSeconds": 10,
- "origin": [
- "http://example.appspot.com"
- ],
- "responseHeader": [
- "x-meta-goog-custom"
- ],
- "method": [
- "GET",
- "HEAD"
- ]
- }
- ],
- "owner": {
- "entity": "project-owners-1082289308625"
- },
- "location": "US",
- "storageClass": "STANDARD",
- "etag": "CAo="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/list_bucket_with_options.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/list_bucket_with_options.json b/google-cloud-storage/src/test/resources/list_bucket_with_options.json
deleted file mode 100644
index ad28c1b..0000000
--- a/google-cloud-storage/src/test/resources/list_bucket_with_options.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "kind": "storage#buckets",
- "nextPageToken": "jcloudstestbucket500",
- "items": [
- {
- "kind": "storage#bucket",
- "id": "jcloudstestbucket500",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket500",
- "projectNumber": "1082289308625",
- "name": "jcloudstestbucket500",
- "timeCreated": "2014-06-17T14:17:50.155Z",
- "metageneration": "1",
- "owner": {
- "entity": "project-owners-1082289308625"
- },
- "location": "US",
- "storageClass": "STANDARD",
- "etag": "CAE="
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/logback.xml b/google-cloud-storage/src/test/resources/logback.xml
deleted file mode 100644
index 864a5a5..0000000
--- a/google-cloud-storage/src/test/resources/logback.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- 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.
-
--->
-<configuration scan="false">
- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-wire.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="COMPUTEFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-compute.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <appender name="SSHFILE" class="ch.qos.logback.core.FileAppender">
- <file>target/test-data/jclouds-ssh.log</file>
-
- <encoder>
- <Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
- </encoder>
- </appender>
-
- <root>
- <level value="warn" />
- </root>
-
- <logger name="org.jclouds">
- <level value="TRACE" />
- <appender-ref ref="FILE" />
- </logger>
-
- <logger name="jclouds.wire">
- <level value="TRACE" />
- <appender-ref ref="WIREFILE" />
- </logger>
-
- <logger name="jclouds.headers">
- <level value="TRACE" />
- <appender-ref ref="WIREFILE" />
- </logger>
-
- <logger name="jclouds.compute">
- <level value="TRACE" />
- <appender-ref ref="COMPUTEFILE" />
- </logger>
-
- <logger name="jclouds.ssh">
- <level value="TRACE" />
- <appender-ref ref="SSHFILE" />
- </logger>
-
-</configuration>
-
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/no_acl_bucket.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/no_acl_bucket.json b/google-cloud-storage/src/test/resources/no_acl_bucket.json
deleted file mode 100644
index fe46b76..0000000
--- a/google-cloud-storage/src/test/resources/no_acl_bucket.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "kind": "storage#bucket",
- "id": "bhashbucket",
- "selfLink": "https://content.googleapis.com/storage/v1/b/bhashbucket",
- "projectNumber": "1082289308625",
- "name": "bhashbucket",
- "timeCreated": "2014-06-02T19:19:41.112Z",
- "metageneration": "87",
- "owner": {
- "entity": "project-owners-1082289308625"
- },
- "location": "US",
- "storageClass": "STANDARD",
- "etag": "CFc="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/no_acl_bucket_list.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/no_acl_bucket_list.json b/google-cloud-storage/src/test/resources/no_acl_bucket_list.json
deleted file mode 100644
index b936bee..0000000
--- a/google-cloud-storage/src/test/resources/no_acl_bucket_list.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "kind": "storage#buckets",
- "nextPageToken": "bhashbucket",
- "items": [
- {
- "kind": "storage#bucket",
- "id": "bhashbucket",
- "selfLink": "https://content.googleapis.com/storage/v1/b/bhashbucket",
- "projectNumber": "1082289308625",
- "name": "bhashbucket",
- "timeCreated": "2014-06-02T19:19:41.112Z",
- "metageneration": "99",
- "owner": {
- "entity": "project-owners-1082289308625"
- },
- "location": "US",
- "storageClass": "STANDARD",
- "etag": "CGM="
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_get.json b/google-cloud-storage/src/test/resources/object_acl_get.json
deleted file mode 100644
index 6b09d42..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_get.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "id": "jcloudstestbucket/foo.txt/1394121608485000/project-owners-1082289308625",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/project-owners-1082289308625",
- "bucket": "jcloudstestbucket",
- "object": "foo.txt",
- "generation": "1394121608485000",
- "entity": "project-owners-1082289308625",
- "role": "OWNER",
- "projectTeam": {
- "projectNumber": "1082289308625",
- "team": "owners"
- },
- "etag": "CIix/dmj/rwCEAE="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_insert_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_insert_request_payload.json b/google-cloud-storage/src/test/resources/object_acl_insert_request_payload.json
deleted file mode 100644
index 393c571..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_insert_request_payload.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "entity": "user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "role": "OWNER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_insert_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_insert_response.json b/google-cloud-storage/src/test/resources/object_acl_insert_response.json
deleted file mode 100644
index 4197a6c..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_insert_response.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "bucket": "jcloudstestbucket",
- "object": "foo.txt",
- "entity": "user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "role": "OWNER",
- "entityId": "00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "etag": "CIix/dmj/rwCEAE="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_list.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_list.json b/google-cloud-storage/src/test/resources/object_acl_list.json
deleted file mode 100644
index dd8883a..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_list.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "kind": "storage#objectAccessControls",
- "items": [
- {
- "kind": "storage#objectAccessControl",
- "id": "jcloudstestbucket/foo.txt/1394121608485000/user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "bucket": "jcloudstestbucket",
- "object": "foo.txt",
- "generation": "1394121608485000",
- "entity": "user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "role": "OWNER",
- "entityId": "00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d",
- "etag": "CIix/dmj/rwCEAE="
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_request_payload.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_request_payload.json b/google-cloud-storage/src/test/resources/object_acl_request_payload.json
deleted file mode 100644
index 6bb3630..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_request_payload.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "entity": "allUsers",
- "role": "OWNER"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_update_initial.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_update_initial.json b/google-cloud-storage/src/test/resources/object_acl_update_initial.json
deleted file mode 100644
index b888ed4..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_update_initial.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers",
- "bucket": "jcloudstestbucket",
- "object": "foo.txt",
- "entity": "allUsers",
- "role": "OWNER",
- "etag": "CIix/dmj/rwCEAQ="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_acl_update_response.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_acl_update_response.json b/google-cloud-storage/src/test/resources/object_acl_update_response.json
deleted file mode 100644
index b888ed4..0000000
--- a/google-cloud-storage/src/test/resources/object_acl_update_response.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "kind": "storage#objectAccessControl",
- "selfLink": "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers",
- "bucket": "jcloudstestbucket",
- "object": "foo.txt",
- "entity": "allUsers",
- "role": "OWNER",
- "etag": "CIix/dmj/rwCEAQ="
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_compose_request.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_compose_request.json b/google-cloud-storage/src/test/resources/object_compose_request.json
deleted file mode 100644
index 0ac4803..0000000
--- a/google-cloud-storage/src/test/resources/object_compose_request.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "sourceObjects": [
- {
- "name": "file_name",
- "generation": 1000,
- "objectPreconditions": {
- "ifGenerationMatch": 1000
- }
- },
- {
- "name": "file_name2",
- "generation": 1001,
- "objectPreconditions": {
- "ifGenerationMatch": 1001
- }
- }
- ],
- "destination": {
- "name": "file_name",
- "size": 1000,
- "crc32c": "crc32c"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_encoded_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_encoded_get.json b/google-cloud-storage/src/test/resources/object_encoded_get.json
deleted file mode 100644
index 7fdb843..0000000
--- a/google-cloud-storage/src/test/resources/object_encoded_get.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "kind": "storage#object",
- "id": "test/dir%2Ffile%20name/1000",
- "selfLink": "https://www.googleapis.com/storage/v1/b/test/o/dir%2Ffile%20name",
- "name": "dir%2Ffile%20name",
- "bucket": "test",
- "generation": "1000",
- "metageneration": "8",
- "contentType": "application/x-tar",
- "updated": "2014-09-27T00:01:44.819",
- "storageClass": "STANDARD",
- "size": "1000",
- "md5Hash": "md5Hash",
- "mediaLink": "https://www.googleapis.com/download/storage/v1/b/test/o/dir%2Ffile%20name?generation=1000&alt=media",
- "owner": {
- "entity": "entity",
- "entityId": "entityId"
- },
- "crc32c": "crc32c",
- "etag": "etag"
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_get.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_get.json b/google-cloud-storage/src/test/resources/object_get.json
deleted file mode 100644
index 1c4d5f8..0000000
--- a/google-cloud-storage/src/test/resources/object_get.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "kind": "storage#object",
- "id": "test/file_name/1000",
- "selfLink": "https://www.googleapis.com/storage/v1/b/test/o/file_name",
- "name": "file_name",
- "bucket": "test",
- "generation": "1000",
- "metageneration": "8",
- "contentType": "application/x-tar",
- "updated": "2014-09-27T00:01:44.819",
- "storageClass": "STANDARD",
- "size": "1000",
- "md5Hash": "md5Hash",
- "mediaLink": "https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media",
- "owner": {
- "entity": "entity",
- "entityId": "entityId"
- },
- "crc32c": "crc32c",
- "etag": "etag"
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_list.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_list.json b/google-cloud-storage/src/test/resources/object_list.json
deleted file mode 100644
index a0830c5..0000000
--- a/google-cloud-storage/src/test/resources/object_list.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "kind": "storage#objects",
- "items": [
- {
- "kind": "storage#object",
- "id": "test/file_name/1000",
- "selfLink": "https://www.googleapis.com/storage/v1/b/test/o/file_name",
- "name": "file_name",
- "bucket": "test",
- "generation": "1000",
- "metageneration": "8",
- "contentType": "application/x-tar",
- "updated": "2014-09-27T00:01:44.819",
- "storageClass": "STANDARD",
- "size": "1000",
- "md5Hash": "md5Hash",
- "mediaLink": "https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media",
- "owner": {
- "entity": "entity",
- "entityId": "entityId"
- },
- "crc32c": "crc32c",
- "etag": "etag"
- },
- {
- "kind": "storage#object",
- "id": "test/file_name2/1000",
- "selfLink": "https://www.googleapis.com/storage/v1/b/test/o/file_name2",
- "name": "file_name2",
- "bucket": "test",
- "generation": "1001",
- "metageneration": "9",
- "contentType": "image/png",
- "updated": "2014-09-27T00:01:44.819",
- "storageClass": "STANDARD",
- "size": "10",
- "md5Hash": "md5Hash",
- "mediaLink": "https://www.googleapis.com/download/storage/v1/b/test/o/file_name2?generation=1001&alt=media",
- "owner": {
- "entity": "entity",
- "entityId": "entityId"
- },
- "crc32c": "crc32c",
- "etag": "etag"
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/resources/object_rewrite.json
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/resources/object_rewrite.json b/google-cloud-storage/src/test/resources/object_rewrite.json
deleted file mode 100644
index 189b9b8..0000000
--- a/google-cloud-storage/src/test/resources/object_rewrite.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "kind": "storage#rewriteResponse",
- "totalBytesRewritten": "16",
- "objectSize": "16",
- "rewriteToken": "rewriteToken",
- "done": true,
- "resource": {
- "kind": "storage#object",
- "id": "test/file_name/1000",
- "selfLink": "https://www.googleapis.com/storage/v1/b/test/o/file_name",
- "name": "file_name",
- "bucket": "test",
- "generation": "1000",
- "metageneration": "8",
- "contentType": "application/x-tar",
- "updated": "2014-09-27T00:01:44.819",
- "storageClass": "STANDARD",
- "size": "1000",
- "md5Hash": "md5Hash",
- "mediaLink": "https://www.googleapis.com/download/storage/v1/b/test/o/file_name?generation=1000&alt=media",
- "owner": {
- "entity": "entity",
- "entityId": "entityId"
- },
- "crc32c": "crc32c",
- "etag": "etag"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 8425850..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-project</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs-google</artifactId>
- <packaging>pom</packaging>
- <name>Apache jclouds labs google</name>
-
- <scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/jclouds-labs-google.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/jclouds-labs-google.git</developerConnection>
- <url>https://git-wip-us.apache.org/repos/asf?p=jclouds-labs-google.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <properties>
- <jclouds.version>2.1.0-SNAPSHOT</jclouds.version>
- </properties>
-
- <repositories>
- <repository>
- <id>apache-snapshots</id>
- <url>https://repository.apache.org/content/repositories/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <modules>
- <module>google-cloud-storage</module>
- </modules>
-
- <profiles>
- <profile>
- <id>doc</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>javadoc</id>
- <phase>package</phase>
- <goals>
- <goal>aggregate-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
[6/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
deleted file mode 100644
index 15b5f4f..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobStoreListContainerOptionsToListObjectOptions.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.googlecloudstorage.options.ListObjectOptions;
-
-import com.google.common.base.Function;
-
-public class BlobStoreListContainerOptionsToListObjectOptions implements
- Function<ListContainerOptions, ListObjectOptions> {
- public ListObjectOptions apply(ListContainerOptions from) {
- if (from.getDir() != null && (from.getPrefix() != null || from.getDelimiter() != null)) {
- throw new IllegalArgumentException("Cannot pass both directory and prefix/delimiter");
- }
- checkNotNull(from, "set options to instance NONE instead of passing null");
- ListObjectOptions httpOptions = new ListObjectOptions();
-
- if (!from.isRecursive() && from.getDelimiter() == null) {
- httpOptions = httpOptions.delimiter("/");
- }
- if (from.getDelimiter() != null) {
- httpOptions = httpOptions.delimiter(from.getDelimiter());
- }
- if (from.getDir() != null) {
- String path = from.getDir();
- if (!path.endsWith("/"))
- path += "/";
- httpOptions = httpOptions.prefix(path);
- }
- if (from.getPrefix() != null) {
- httpOptions.prefix(from.getPrefix());
- }
- if (from.getMarker() != null) {
- httpOptions = httpOptions.pageToken(from.getMarker());
- }
- if (from.getMaxResults() != null) {
- httpOptions = httpOptions.maxResults(from.getMaxResults());
- }
- return httpOptions;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BucketToStorageMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BucketToStorageMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BucketToStorageMetadata.java
deleted file mode 100644
index f96462a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BucketToStorageMetadata.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.functions;
-
-import javax.inject.Inject;
-
-import org.jclouds.blobstore.domain.MutableStorageMetadata;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
-import org.jclouds.domain.Location;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-public class BucketToStorageMetadata implements Function<Bucket, StorageMetadata> {
- private Supplier<Location> defaultLocation;
-
- @Inject BucketToStorageMetadata(Supplier<Location> defaultLocation) {
- this.defaultLocation = defaultLocation;
- }
-
- public StorageMetadata apply(Bucket from) {
- MutableStorageMetadata to = new MutableStorageMetadataImpl();
- to.setName(from.name());
- to.setLocation(defaultLocation.get());
- to.setType(StorageType.CONTAINER);
- return to;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectListToStorageMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectListToStorageMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectListToStorageMetadata.java
deleted file mode 100644
index 4f7f1d0..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectListToStorageMetadata.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.functions;
-
-import java.util.SortedSet;
-
-import javax.inject.Inject;
-
-import org.jclouds.blobstore.domain.MutableStorageMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-public class ObjectListToStorageMetadata
- implements Function<ListPageWithPrefixes<GoogleCloudStorageObject>, PageSet<? extends StorageMetadata>> {
- private final ObjectToBlobMetadata object2blobMd;
-
- @Inject public ObjectListToStorageMetadata(ObjectToBlobMetadata object2blobMd) {
- this.object2blobMd = object2blobMd;
- }
-
- public PageSet<? extends StorageMetadata> apply(ListPageWithPrefixes<GoogleCloudStorageObject> from) {
- if (from == null) {
- from = ListPageWithPrefixes.create(null, null, null);
- }
-
- SortedSet<StorageMetadata> results = Sets.<StorageMetadata> newTreeSet(Iterables.transform(from, object2blobMd));
- for (String prefix : from.prefixes()) {
- MutableStorageMetadata metadata = new MutableStorageMetadataImpl();
- metadata.setType(StorageType.RELATIVE_PATH);
- metadata.setName(prefix);
- results.add(metadata);
- }
- return new PageSetImpl<StorageMetadata>(results, from.nextPageToken());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectToBlobMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectToBlobMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectToBlobMetadata.java
deleted file mode 100644
index 4a6cf7d..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/ObjectToBlobMetadata.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.functions;
-
-
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Function;
-import com.google.common.hash.HashCode;
-import com.google.common.io.BaseEncoding;
-
-public class ObjectToBlobMetadata implements Function<GoogleCloudStorageObject, MutableBlobMetadata> {
-
- public MutableBlobMetadata apply(GoogleCloudStorageObject from) {
- if (from == null) {
- return null;
- }
- MutableBlobMetadata to = new MutableBlobMetadataImpl();
- to.getContentMetadata().setContentMD5(toHashCode(from.md5Hash()));
- to.getContentMetadata().setContentType(from.contentType());
- to.getContentMetadata().setContentDisposition(from.contentDisposition());
- to.getContentMetadata().setContentEncoding(from.contentEncoding());
- to.getContentMetadata().setContentLanguage(from.contentLanguage());
- to.getContentMetadata().setContentLength(from.size());
- to.setLastModified(from.updated());
- to.setContainer(from.bucket());
- to.setUserMetadata(from.metadata());
- to.setETag(from.etag());
- to.setName(from.name());
- to.setUri(from.selfLink());
- to.setId(from.id());
- to.setPublicUri(from.mediaLink());
- to.setType(StorageType.BLOB);
- to.setSize(from.size());
- return to;
- }
-
- private static HashCode toHashCode(@Nullable String hashCode) {
- return hashCode == null ? null : HashCode.fromBytes(BaseEncoding.base64().decode(hashCode));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
deleted file mode 100644
index 862f38f..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.config;
-
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.googlecloud.config.CurrentProject;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
-import org.jclouds.googlecloudstorage.handlers.GoogleCloudStorageErrorHandler;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.Provider;
-import org.jclouds.oauth.v2.config.OAuthScopes;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.inject.Provides;
-
-@ConfiguresHttpApi
-public class GoogleCloudStorageHttpApiModule extends HttpApiModule<GoogleCloudStorageApi> {
-
- @Override public void configure(){
- super.configure();
- bind(OAuthScopes.class).toInstance(GoogleCloudStorageOAuthScopes.create());
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(GoogleCloudStorageErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(GoogleCloudStorageErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(GoogleCloudStorageErrorHandler.class);
- }
-
- @Provides
- @Singleton @CurrentProject
- public Supplier<String> supplyProject(@Provider final Supplier<Credentials> creds) {
- return Suppliers.compose(new Function<Credentials, String>() {
- @Override public String apply(Credentials in) {
- return CurrentProject.ClientEmail.toProjectNumber(in.identity);
- }
- }, creds);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java
deleted file mode 100644
index 358c9a0..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.config;
-
-import java.util.List;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.oauth.v2.config.OAuthScopes;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableList;
-
-@AutoValue public abstract class GoogleCloudStorageOAuthScopes implements OAuthScopes {
- abstract OAuthScopes readOrWriteScopes();
-
- /** Full control is read/write + acls */
- abstract List<String> fullControlScopes();
-
- public static GoogleCloudStorageOAuthScopes create() {
- return new AutoValue_GoogleCloudStorageOAuthScopes( //
- OAuthScopes.ReadOrWriteScopes.create( //
- "https://www.googleapis.com/auth/devstorage.read_only", //
- "https://www.googleapis.com/auth/devstorage.read_write"), //
- ImmutableList.of("https://www.googleapis.com/auth/devstorage.full_control") //
- );
- }
-
- /** If the path contains or ends with {@code /acl} or {@code /defaultObjectAcl}, it needs full-control. */
- @Override public List<String> forRequest(HttpRequest input) {
- String path = input.getEndpoint().getPath();
- if (path.endsWith("/acl") || path.endsWith("/defaultObjectAcl") //
- || path.contains("/acl/") || path.contains("/defaultObjectAcl/")) {
- return fullControlScopes();
- } else if (input.getMethod().equalsIgnoreCase("PUT") || input.getMethod().equalsIgnoreCase("PATCH")) {
- return fullControlScopes();
- }
- return readOrWriteScopes().forRequest(input);
- }
-
- GoogleCloudStorageOAuthScopes() {
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
deleted file mode 100644
index 77933a7..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.config;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Singleton;
-
-import org.jclouds.googlecloud.config.ListPageAdapterFactory;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.json.config.GsonModule;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import com.google.gson.TypeAdapterFactory;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-public class GoogleCloudStorageParserModule extends AbstractModule {
-
- @Override protected void configure() {
- bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
- }
-
- @Provides @Singleton public Map<Type, Object> typeAdapters() {
- return new ImmutableMap.Builder<Type, Object>()
- .put(BucketTemplate.class, new BucketTemplateTypeAdapter())
- .build();
- }
-
- // TODO: change jclouds core to use collaborative set bindings
- @Provides @Singleton Set<TypeAdapterFactory> typeAdapterFactories() {
- return ImmutableSet.<TypeAdapterFactory>of(new ListPageAdapterFactory());
- }
-
- private static class BucketTemplateTypeAdapter implements JsonSerializer<BucketTemplate> {
-
- @Override
- public JsonElement serialize(BucketTemplate src, Type typeOfSrc, JsonSerializationContext context) {
- BucketTemplateInternal template = new BucketTemplateInternal(src);
- JsonObject bucketTemplate = (JsonObject) context.serialize(template, BucketTemplateInternal.class);
-
- // deal with bucketAccessControls
- if (!(src.acl() == null) && (src.acl().isEmpty())) {
- bucketTemplate.add("acl", null);
- }
- // deal with DefaultObjectAccessControls
- if (!(src.defaultObjectAccessControls() == null) && (src.defaultObjectAccessControls().isEmpty())) {
- bucketTemplate.add("defaultObjectAccessControls", null);
- }
-
- // deal with Cors
- if (!(src.cors() == null) && (src.cors().isEmpty())) {
- bucketTemplate.add("cors", null);
- }
-
- return bucketTemplate;
- }
-
- private static class BucketTemplateInternal extends BucketTemplate {
- private BucketTemplateInternal(BucketTemplate template) {
- name(template.name()).projectNumber(template.projectNumber()).acl(template.acl())
- .defaultObjectAccessControls(template.defaultObjectAccessControls()).owner(template.owner())
- .location(template.location()).website(template.website()).logging(template.logging())
- .versioning(template.versioning()).cors(template.cors()).lifeCycle(template.lifeCycle())
- .storageClass(template.storageClass());
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Bucket.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Bucket.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Bucket.java
deleted file mode 100644
index d0f4b33..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Bucket.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
-
-import java.util.Date;
-import java.util.List;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * The Bucket represents a bucket in Google Cloud Storage. There is a single global namespace shared by all buckets.
- *
- * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/buckets"/>
- */
-@AutoValue
-public abstract class Bucket {
- @AutoValue
- public abstract static class Cors {
- public abstract List<String> origin();
-
- public abstract List<String> method();
-
- public abstract List<String> responseHeader();
-
- public abstract Integer maxAgeSeconds();
-
- @SerializedNames({ "origin", "method", "responseHeader", "maxAgeSeconds" })
- public static Cors create(List<String> origin, List<String> method, List<String> responseHeader,
- Integer maxAgeSeconds) {
- return new AutoValue_Bucket_Cors(copyOf(origin), copyOf(method), copyOf(responseHeader), maxAgeSeconds);
- }
- }
-
- @AutoValue
- public abstract static class Logging {
- public abstract String logBucket();
-
- @Nullable public abstract String logObjectPrefix();
-
- @SerializedNames({ "logBucket", "logObjectPrefix" })
- public static Logging create(String logBucket, String logObjectPrefix) {
- return new AutoValue_Bucket_Logging(logBucket, logObjectPrefix);
- }
- }
-
- @AutoValue
- public abstract static class LifeCycle {
-
- @AutoValue
- public abstract static class Rule {
-
- @AutoValue
- public abstract static class Action {
- public abstract String type();
-
- @SerializedNames("type")
- public static Action create(String type) {
- return new AutoValue_Bucket_LifeCycle_Rule_Action(type);
- }
- }
-
- @AutoValue
- public abstract static class Condition {
- @Nullable public abstract Integer age();
-
- @Nullable public abstract Date createdBefore();
-
- @Nullable public abstract Boolean isLive();
-
- @Nullable public abstract Integer numNewerVersions();
-
- @SerializedNames({ "age", "createdBefore", "isLive", "numNewerVersions" })
- public static Condition create(Integer age, Date createdBefore, Boolean isLive, Integer numNewerVersions) {
- return new AutoValue_Bucket_LifeCycle_Rule_Condition(age, createdBefore, isLive, numNewerVersions);
- }
- }
-
- public abstract Action action();
-
- public abstract Condition condition();
-
- @SerializedNames({ "action", "condition" })
- public static Rule create(Action action, Condition condition) {
- return new AutoValue_Bucket_LifeCycle_Rule(action, condition);
- }
- }
-
- public abstract List<Rule> rules();
-
- @SerializedNames("rules")
- public static LifeCycle create(List<Rule> rules) {
- return new AutoValue_Bucket_LifeCycle(copyOf(rules));
- }
- }
-
- @AutoValue
- public abstract static class Website {
- @Nullable public abstract String mainPageSuffix();
-
- @Nullable public abstract String notFoundPage();
-
- @SerializedNames({ "mainPageSuffix", "notFoundPage" })
- public static Website create(String mainPageSuffix, String notFoundPage) {
- return new AutoValue_Bucket_Website(mainPageSuffix, notFoundPage);
- }
- }
-
- @AutoValue
- public abstract static class Versioning {
- public abstract Boolean enabled();
-
- @SerializedNames("enabled")
- public static Versioning create(Boolean enabled) {
- return new AutoValue_Bucket_Versioning(enabled);
- }
- }
-
- public abstract String id();
-
- public abstract String name();
-
- @Nullable public abstract Long projectNumber();
-
- public abstract Date timeCreated();
-
- public abstract Long metageneration();
-
- public abstract List<BucketAccessControls> acl();
-
- public abstract List<ObjectAccessControls> defaultObjectAcl();
-
- @Nullable public abstract Owner owner();
-
- @Nullable public abstract Location location();
-
- @Nullable public abstract Website website();
-
- @Nullable public abstract Logging logging();
-
- @Nullable public abstract Versioning versioning();
-
- public abstract List<Cors> cors();
-
- @Nullable public abstract LifeCycle lifeCycle();
-
- @Nullable public abstract StorageClass storageClass();
-
- @SerializedNames(
- { "id", "name", "projectNumber", "timeCreated", "metageneration", "acl", "defaultObjectAcl", "owner",
- "location", "website", "logging", "versioning", "cors", "lifeCycle", "storageClass" })
- public static Bucket create(String id, String name, Long projectNumber, Date timeCreated, Long metageneration,
- List<BucketAccessControls> acl, List<ObjectAccessControls> defaultObjectAcl, Owner owner,
- Location location, Website website, Logging logging, Versioning versioning, List<Cors> cors,
- LifeCycle lifeCycle, StorageClass storageClass) {
- return new AutoValue_Bucket(id, name, projectNumber, timeCreated, metageneration, copyOf(acl),
- copyOf(defaultObjectAcl), owner, location, website, logging, versioning, copyOf(cors), lifeCycle,
- storageClass);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/BucketAccessControls.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/BucketAccessControls.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/BucketAccessControls.java
deleted file mode 100644
index 732057a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/BucketAccessControls.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * Represents a BucketAccessControls Resource
- *
- * @see <a href= "https://developers.google.com/storage/docs/json_api/v1/bucketAccessControls" />
- */
-@AutoValue
-public abstract class BucketAccessControls {
-
- public enum Role {
- READER, WRITER, OWNER
- }
-
- // TODO: ensure this is actually needed on input.
- public abstract String kind();
-
- public abstract String id();
-
- public abstract String bucket();
-
- public abstract String entity();
-
- @Nullable public abstract String entityId();
-
- public abstract Role role();
-
- @Nullable public abstract String email();
-
- @Nullable public abstract String domain();
-
- @Nullable public abstract ProjectTeam projectTeam();
-
- @SerializedNames({ "kind", "id", "bucket", "entity", "entityId", "role", "email", "domain", "projectTeam" })
- static BucketAccessControls create(String kind, String id, String bucket, String entity, String entityId, Role role,
- String email, String domain, ProjectTeam projectTeam) {
- return new AutoValue_BucketAccessControls(kind,
- id == null ? (bucket + "/" + entity) : id, bucket, entity, entityId, role, email, domain, projectTeam);
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static final class Builder {
-
- private String id;
- private String bucket;
- private String entity;
- private String entityId;
- private Role role;
- private String email;
- private String domain;
- private ProjectTeam projectTeam;
-
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- public Builder bucket(String bucket) {
- this.bucket = bucket;
- return this;
- }
-
- public Builder entity(String entity) {
- this.entity = entity;
- return this;
- }
-
- public Builder entityId(String entityId) {
- this.entityId = entityId;
- return this;
- }
-
- public Builder role(Role role) {
- this.role = role;
- return this;
- }
-
- public Builder email(String email) {
- this.email = email;
- return this;
- }
-
- public Builder domain(String domain) {
- this.domain = domain;
- return this;
- }
-
- public Builder projectTeam(ProjectTeam projectTeam) {
- this.projectTeam = projectTeam;
- return this;
- }
-
- public BucketAccessControls build() {
- return BucketAccessControls
- .create("storage#bucketAccessControl", id, bucket, entity, entityId, role, email, domain, projectTeam);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/DomainResourceReferences.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/DomainResourceReferences.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/DomainResourceReferences.java
deleted file mode 100644
index cc3b9dc..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/DomainResourceReferences.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import com.google.common.base.CaseFormat;
-
-public final class DomainResourceReferences {
-
- private DomainResourceReferences() {
- }
-
- public enum ObjectRole {
- READER, OWNER
- }
-
- public enum Location {
- ASIA, EU, US, ASIA_EAST1, US_CENTRAL1, US_CENTRAL2, US_EAST1, US_EAST2, US_EAST3, US_WEST1;
-
- public String value() {
- return name().replace('_', '-');
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static Location fromValue(String location) {
- return valueOf(location.replace('-', '_'));
- }
- }
-
- public enum StorageClass {
- COLDLINE,
- DURABLE_REDUCED_AVAILABILITY,
- MULTI_REGIONAL,
- NEARLINE,
- STANDARD;
- }
-
- public enum Projection {
- NO_ACL, FULL;
-
- public String value() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static Projection fromValue(String projection) {
- return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, projection));
- }
- }
-
- public enum PredefinedAcl {
- AUTHENTICATED_READ, PRIVATE, PROJEECT_PRIVATE, PUBLIC_READ, PUBLIC_READ_WRITE;
-
- public String value() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static PredefinedAcl fromValue(String predefinedAcl) {
- return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, predefinedAcl));
- }
- }
-
- public enum DestinationPredefinedAcl {
- AUTHENTICATED_READ, BUCKET_OWNER_FULLCONTROL, BUCKET_OWNER_READ, PRIVATE, PROJECT_PRIVATE, PUBLIC_READ;
-
- public String value() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static DestinationPredefinedAcl fromValue(String destinationPredefinedAcl) {
- return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, destinationPredefinedAcl));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/GoogleCloudStorageObject.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/GoogleCloudStorageObject.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/GoogleCloudStorageObject.java
deleted file mode 100644
index ce48e4f..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/GoogleCloudStorageObject.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * This class represent an object in a Google Cloud Storage Bucket.
- *
- * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/Objects"/>
- */
-@AutoValue
-// TODO: nullable sweep
-public abstract class GoogleCloudStorageObject {
-
- public abstract String id();
- public abstract URI selfLink();
- public abstract String etag();
- public abstract String name();
- public abstract String bucket();
- public abstract long generation();
- public abstract long metageneration();
- @Nullable public abstract String contentType();
- public abstract Date updated();
- @Nullable public abstract Date timeDeleted();
- public abstract StorageClass storageClass();
- public abstract long size();
- @Nullable public abstract String md5Hash();
- public abstract URI mediaLink();
- public abstract Map<String, String> metadata();
- @Nullable public abstract String contentEncoding();
- @Nullable public abstract String contentDisposition();
- @Nullable public abstract String contentLanguage();
- @Nullable public abstract String cacheControl();
- public abstract List<ObjectAccessControls> acl();
- @Nullable public abstract Owner owner();
- @Nullable public abstract String crc32c();
- @Nullable public abstract Integer componentCount();
-
- @SerializedNames(
- { "id", "selfLink", "etag", "name", "bucket", "generation", "metageneration", "contentType", "updated",
- "timeDeleted", "storageClass", "size", "md5Hash", "mediaLink", "metadata", "contentEncoding",
- "contentDisposition", "contentLanguage", "cacheControl", "acl", "owner", "crc32c", "componentCount" })
- public static GoogleCloudStorageObject create(String id, URI selfLink, String etag, String name, String bucket, long generation,
- long metageneration, String contentType, Date updated, Date timeDeleted, StorageClass storageClass, long size,
- String md5Hash, URI mediaLink, Map<String, String> metadata, String contentEncoding, String contentDisposition,
- String contentLanguage, String cacheControl, List<ObjectAccessControls> acl, Owner owner, String crc32c,
- Integer componentCount) {
- return new AutoValue_GoogleCloudStorageObject(id, selfLink, etag, name, bucket, generation, metageneration, contentType, updated,
- timeDeleted, storageClass, size, md5Hash, mediaLink, copyOf(metadata), contentEncoding, contentDisposition,
- contentLanguage, cacheControl, copyOf(acl), owner, crc32c, componentCount);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPageWithPrefixes.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPageWithPrefixes.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPageWithPrefixes.java
deleted file mode 100644
index dddb3ec..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPageWithPrefixes.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
-
-import java.beans.ConstructorProperties;
-import java.util.List;
-
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.collect.ForwardingList;
-
-/** An immutable list that includes a token, if there is another page available. */
-public final class ListPageWithPrefixes<T> extends ForwardingList<T> implements ListPage<T> {
-
- private final List<T> items;
- private final String nextPageToken;
- private final List<String> prefixes;
-
- public static <T> ListPageWithPrefixes<T> create(List<T> items, String nextPageToken, List<String> prefixes) {
- return new ListPageWithPrefixes<T>(items, nextPageToken, prefixes);
- }
-
- @ConstructorProperties({ "items", "nextPageToken", "prefixes" })
- public ListPageWithPrefixes(List<T> items, String nextPageToken, List<String> prefixes) {
- this.items = copyOf(items);
- this.nextPageToken = nextPageToken;
- this.prefixes = copyOf(prefixes);
- }
-
- @Override @Nullable public String nextPageToken() {
- return nextPageToken;
- }
-
- public List<String> prefixes() {
- return prefixes;
- }
-
- @Override protected List<T> delegate() {
- return items;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ObjectAccessControls.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ObjectAccessControls.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ObjectAccessControls.java
deleted file mode 100644
index 6d34f4c..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ObjectAccessControls.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * Represents a Object Access Control Resource.
- *
- * @see <a href= "https://developers.google.com/storage/docs/json_api/v1/objectAccessControls"/>
- */
-@AutoValue
-public abstract class ObjectAccessControls {
- private final String kind = "storage#objectAccessControl";
-
- @Nullable public abstract String id();
-
- @Nullable public abstract String bucket();
-
- @Nullable public abstract String object();
-
- @Nullable public abstract Long generation();
-
- public abstract String entity();
-
- @Nullable public abstract String entityId();
-
- public abstract ObjectRole role();
-
- @Nullable public abstract String email();
-
- @Nullable public abstract String domain();
-
- @Nullable public abstract ProjectTeam projectTeam();
-
- @SerializedNames(
- { "id", "bucket", "object", "generation", "entity", "entityId", "role", "email", "domain", "projectTeam" })
- public static ObjectAccessControls create(String id, String bucket, String object, Long generation, String entity,
- String entityId, ObjectRole role, String email, String domain, ProjectTeam projectTeam) {
- return new AutoValue_ObjectAccessControls(id, bucket, object, generation, entity, entityId, role, email, domain,
- projectTeam);
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static final class Builder {
- private String id;
- private String object;
- private Long generation;
- private String bucket;
- private String entity;
- private String entityId;
- private ObjectRole role;
- private String email;
- private String domain;
- private ProjectTeam projectTeam;
-
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- public Builder bucket(String bucket) {
- this.bucket = bucket;
- return this;
- }
-
- public Builder object(String object) {
- this.object = object;
- return this;
- }
-
- public Builder generation(Long generation) {
- this.generation = generation;
- return this;
- }
-
- public Builder entity(String entity) {
- this.entity = entity;
- return this;
- }
-
- public Builder entityId(String entityId) {
- this.entityId = entityId;
- return this;
- }
-
- public Builder role(ObjectRole role) {
- this.role = role;
- return this;
- }
-
- public Builder email(String email) {
- this.email = email;
- return this;
- }
-
- public Builder domain(String domain) {
- this.domain = domain;
- return this;
- }
-
- public Builder projectTeam(ProjectTeam projectTeam) {
- this.projectTeam = projectTeam;
- return this;
- }
-
- public ObjectAccessControls build() {
- return ObjectAccessControls
- .create(id, bucket, object, generation, entity, entityId, role, email, domain, projectTeam);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Owner.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Owner.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Owner.java
deleted file mode 100644
index 57137e6..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/Owner.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-@AutoValue
-public abstract class Owner {
- public abstract String entity();
-
- @Nullable public abstract String entityId();
-
- @SerializedNames({"entity", "entityId"})
- public static Owner create(String entity, String entityId) {
- return new AutoValue_Owner(entity, entityId);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ProjectTeam.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ProjectTeam.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ProjectTeam.java
deleted file mode 100644
index 538e4c8..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ProjectTeam.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current
- * bucket's logs.
- */
-@AutoValue
-public abstract class ProjectTeam {
-
- public enum Team {
- OWNERS, EDITORS, VIEWERS;
-
- public String value() {
- return name().toLowerCase();
- }
-
- @Override
- public String toString() {
- return value();
- }
-
- public static Team fromValue(String team) {
- return valueOf(team.toUpperCase());
- }
- }
-
- public abstract String projectNumber();
-
- public abstract Team team();
-
- @SerializedNames({ "projectNumber", "team" })
- public static ProjectTeam create(String projectNumber, Team team) {
- return new AutoValue_ProjectTeam(projectNumber, team);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ResumableUpload.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ResumableUpload.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ResumableUpload.java
deleted file mode 100644
index 556347a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ResumableUpload.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.auto.value.AutoValue;
-
-/**
- * Represents results of resumable upload response.
- */
-@AutoValue
-public abstract class ResumableUpload {
-
- public abstract int statusCode();
-
- @Nullable public abstract String uploadId();
-
- @Nullable public abstract String contentLength();
-
- @Nullable public abstract Long rangeUpperValue();
-
- @Nullable public abstract Long rangeLowerValue();
-
- public static ResumableUpload create(int statusCode, String uploadId, String contentLength, Long rangeLowerValue,
- Long rangeUpperValue) {
- return new AutoValue_ResumableUpload(statusCode, uploadId, contentLength, rangeLowerValue, rangeUpperValue);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/RewriteResponse.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/RewriteResponse.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/RewriteResponse.java
deleted file mode 100644
index 8f37193..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/RewriteResponse.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-
-@AutoValue
-public abstract class RewriteResponse {
- // TODO(broudy): should these be UnsignedLong?
- public abstract long totalBytesRewritten();
- public abstract long objectSize();
- public abstract boolean done();
- @Nullable public abstract String rewriteToken();
- public abstract GoogleCloudStorageObject resource();
-
- @SerializedNames({"totalBytesRewritten", "objectSize", "done", "rewriteToken", "resource"})
- public static RewriteResponse create(long totalBytesRewritten, long objectSize,
- boolean done, String rewriteToken, GoogleCloudStorageObject resource) {
- return new AutoValue_RewriteResponse(totalBytesRewritten, objectSize, done, rewriteToken, resource);
- }
-
- RewriteResponse() {
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketAccessControlsTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketAccessControlsTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketAccessControlsTemplate.java
deleted file mode 100644
index 04221aa..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketAccessControlsTemplate.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain.templates;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-
-import com.google.auto.value.AutoValue;
-
-@AutoValue
-public abstract class BucketAccessControlsTemplate {
-
- public abstract String entity();
-
- public abstract Role role();
-
- public static BucketAccessControlsTemplate create(String entity, Role role) {
- return new AutoValue_BucketAccessControlsTemplate(entity, role);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketTemplate.java
deleted file mode 100644
index 7434757..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/BucketTemplate.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain.templates;
-
-import java.util.List;
-
-import org.jclouds.googlecloudstorage.domain.Bucket.Cors;
-import org.jclouds.googlecloudstorage.domain.Bucket.LifeCycle;
-import org.jclouds.googlecloudstorage.domain.Bucket.Logging;
-import org.jclouds.googlecloudstorage.domain.Bucket.Versioning;
-import org.jclouds.googlecloudstorage.domain.Bucket.Website;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.Owner;
-
-import com.google.common.collect.Lists;
-
-public class BucketTemplate {
-
- private String name;
- private Long projectNumber;
- private List<BucketAccessControls> acl = Lists.newArrayList();
- private List<ObjectAccessControls> defaultObjectAccessControls = Lists.newArrayList();
- private Owner owner;
- private Location location;
- private Website website;
- private Logging logging;
- private Versioning versioning;
- private List<Cors> cors = Lists.newArrayList();
- private LifeCycle lifeCycle;
- private StorageClass storageClass;
-
- public BucketTemplate name(String name) {
- this.name = name;
- return this;
- }
-
- public BucketTemplate projectNumber(Long projectNumber) {
- this.projectNumber = projectNumber;
- return this;
- }
-
- public BucketTemplate owner(Owner owner) {
- this.owner = owner;
- return this;
- }
-
- public BucketTemplate location(Location location) {
- this.location = location;
- return this;
- }
-
- public BucketTemplate website(Website website) {
- this.website = website;
- return this;
- }
-
- public BucketTemplate logging(Logging logging) {
- this.logging = logging;
- return this;
- }
-
- public BucketTemplate versioning(Versioning versioning) {
- this.versioning = versioning;
- return this;
- }
-
- public BucketTemplate lifeCycle(LifeCycle lifeCycle) {
- this.lifeCycle = lifeCycle;
- return this;
- }
-
- public BucketTemplate storageClass(StorageClass storageClass) {
- this.storageClass = storageClass;
- return this;
- }
-
- public BucketTemplate addAcl(BucketAccessControls bucketAccessControls) {
- this.acl.add(bucketAccessControls);
- return this;
- }
-
- public BucketTemplate acl(List<BucketAccessControls> acl) {
- this.acl.addAll(acl);
- return this;
- }
-
- public BucketTemplate addDefaultObjectAccessControls(ObjectAccessControls oac) {
- this.defaultObjectAccessControls.add(oac);
- return this;
- }
-
- public BucketTemplate defaultObjectAccessControls(List<ObjectAccessControls> defaultObjectAcl) {
- this.defaultObjectAccessControls.addAll(defaultObjectAcl);
- return this;
- }
-
- public BucketTemplate addCORS(Cors cors) {
- this.cors.add(cors);
- return this;
- }
-
- public BucketTemplate cors(List<Cors> cors) {
- this.cors.addAll(cors);
- return this;
- }
-
- public Long projectNumber() {
- return projectNumber;
- }
-
- public String name() {
- return name;
- }
-
- public List<BucketAccessControls> acl() {
- return acl;
- }
-
- public List<ObjectAccessControls> defaultObjectAccessControls() {
- return defaultObjectAccessControls;
- }
-
- public Owner owner() {
- return owner;
- }
-
- public Location location() {
- return location;
- }
-
- public Website website() {
- return website;
- }
-
- public Logging logging() {
- return logging;
- }
-
- public Versioning versioning() {
- return versioning;
- }
-
- public List<Cors> cors() {
- return cors;
- }
-
- public LifeCycle lifeCycle() {
- return lifeCycle;
- }
-
- public StorageClass storageClass() {
- return storageClass;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ComposeObjectTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ComposeObjectTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ComposeObjectTemplate.java
deleted file mode 100644
index 3f333d8..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ComposeObjectTemplate.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain.templates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.json.SerializedNames;
-
-import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableList;
-
-@AutoValue
-public abstract class ComposeObjectTemplate {
-
- @AutoValue
- public abstract static class SourceObject {
-
- @AutoValue
- public abstract static class ObjectPreconditions {
- public abstract long ifGenerationMatch();
-
- @SerializedNames({"ifGenerationMatch"})
- public static ObjectPreconditions create(long ifGenerationMatch){
- return new AutoValue_ComposeObjectTemplate_SourceObject_ObjectPreconditions(ifGenerationMatch);
- }
-
- ObjectPreconditions(){
- }
- }
-
- public abstract String name();
- @Nullable public abstract Long generation();
- @Nullable public abstract ObjectPreconditions objectPreconditions();
-
- public static SourceObject nameOnly(String name){
- return create(name, null, null);
- }
-
- public static SourceObject createWithPrecondition(String name, Long generation, Long objectPreconditions){
- return create(name, generation, ObjectPreconditions.create(objectPreconditions));
- }
-
- @SerializedNames({ "name", "generation", "objectPreconditions"})
- public static SourceObject create(String name, @Nullable Long generation,
- @Nullable ObjectPreconditions objectPreconditions) {
- return new AutoValue_ComposeObjectTemplate_SourceObject(name, generation, objectPreconditions);
- }
-
- SourceObject(){
- }
- }
-
- public abstract List<SourceObject> sourceObjects();
- public abstract ObjectTemplate destination();
-
- @SerializedNames({"sourceObjects", "destination"})
- public static ComposeObjectTemplate create(List<SourceObject> sourceObjects, ObjectTemplate destination) {
- return new AutoValue_ComposeObjectTemplate(sourceObjects, destination);
- }
-
- public static Builder builder(){
- return new Builder();
- }
-
- ComposeObjectTemplate() {
- }
-
- public static class Builder {
- private ImmutableList<SourceObject> sourceObjects;
- private ObjectTemplate destination;
-
- Builder() {
- }
-
- public Builder fromGoogleCloudStorageObject(Collection<GoogleCloudStorageObject> objects) {
- ImmutableList.Builder<SourceObject> sourceObjects = new ImmutableList.Builder<ComposeObjectTemplate.SourceObject>();
- for (GoogleCloudStorageObject obj : objects) {
- sourceObjects.add(SourceObject.createWithPrecondition(obj.name(), obj.generation(), obj.generation()));
- }
- this.sourceObjects = sourceObjects.build();
- return this;
- }
-
- public Builder fromNames(List<String> SourceObjectNames) {
- ArrayList<SourceObject> sourceObjects = new ArrayList<SourceObject>();
- for (String name : SourceObjectNames) {
- sourceObjects.add(SourceObject.nameOnly(name));
- }
- this.sourceObjects = ImmutableList.copyOf(sourceObjects);
- return this;
- }
-
- public Builder destination(ObjectTemplate destination) {
- checkNotNull(destination, "destination");
- this.destination = destination;
- return this;
- }
-
- public ComposeObjectTemplate build() {
- return ComposeObjectTemplate.create(sourceObjects, destination);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectAccessControlsTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectAccessControlsTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectAccessControlsTemplate.java
deleted file mode 100644
index a8e1afb..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectAccessControlsTemplate.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain.templates;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-
-import com.google.auto.value.AutoValue;
-
-@AutoValue
-public abstract class ObjectAccessControlsTemplate {
-
- public abstract String entity();
-
- public abstract ObjectRole role();
-
- public static ObjectAccessControlsTemplate create(String entity, ObjectRole role) {
- return new AutoValue_ObjectAccessControlsTemplate(entity, role);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectTemplate.java
deleted file mode 100644
index 1cd5aaf..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/templates/ObjectTemplate.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.domain.templates;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.net.MediaType;
-
-public class ObjectTemplate {
-
- private String name;
- private Long size;
- private String cacheControl;
- private String contentDisposition;
- private String contentEncoding;
- private String contentLanguage;
- private String contentType;
- private String crc32c;
- private String md5Hash;
- private Map<String, String> metadata;
- private List<ObjectAccessControls> acl;
-
- public ObjectTemplate name(String name) {
- this.name = name;
- return this;
- }
-
- public ObjectTemplate size(Long size) {
- this.size = size;
- return this;
- }
-
- public ObjectTemplate cacheControl(String cacheControl) {
- this.cacheControl = cacheControl;
- return this;
- }
-
- public ObjectTemplate contentDisposition(String contentDisposition) {
- this.contentDisposition = contentDisposition;
- return this;
- }
-
- public ObjectTemplate contentEncoding(String contentEncoding) {
- this.contentEncoding = contentEncoding;
- return this;
- }
-
- public ObjectTemplate contentLanguage(String contentLanguage) {
- this.contentLanguage = contentLanguage;
- return this;
- }
-
- public ObjectTemplate contentType(MediaType contentType) {
- this.contentType = contentType.toString();
- return this;
- }
-
- public ObjectTemplate contentType(String contentType) {
- this.contentType = contentType;
- return this;
- }
-
- public ObjectTemplate customMetadata(Map<String, String> metadata) {
- if (this.metadata == null) {
- this.metadata = Maps.newLinkedHashMap();
- }
- this.metadata.putAll(metadata);
- return this;
- }
-
- public ObjectTemplate customMetadata(String key, String value) {
- if (this.metadata == null) {
- this.metadata = Maps.newLinkedHashMap();
- }
- this.metadata.put(key, value);
- return this;
- }
-
- public ObjectTemplate crc32c(String crc32c) {
- this.crc32c = crc32c;
- return this;
- }
-
- public ObjectTemplate md5Hash(String md5Hash) {
- this.md5Hash = md5Hash;
- return this;
- }
-
- public ObjectTemplate addAcl(ObjectAccessControls acl) {
- if (this.acl == null) {
- this.acl = Lists.newArrayList();
- }
- this.acl.add(acl);
- return this;
- }
-
- public ObjectTemplate acl(List<ObjectAccessControls> acl) {
- if (this.acl == null) {
- this.acl = Lists.newArrayList();
- }
- this.acl.addAll(acl);
- return this;
- }
-
- public String cacheControl() {
- return cacheControl;
- }
-
- public String contentDisposition() {
- return contentDisposition;
- }
-
- public String contentEncoding() {
- return contentEncoding;
- }
-
- public String contentLanguage() {
- return contentLanguage;
- }
-
- public String contentType() {
- return contentType;
- }
-
- public Map<String, String> metadata() {
- return metadata;
- }
-
- public String name() {
- return name;
- }
-
- public Long size() {
- return size;
- }
-
- public List<ObjectAccessControls> acl() {
- return acl;
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper(this)
- .add("name", name)
- .add("size", size)
- .add("cacheControl", cacheControl)
- .add("contentDisposition", contentDisposition)
- .add("contentEncoding", contentEncoding)
- .add("contentLanguage", contentLanguage)
- .add("contentType", contentType)
- .add("crc32c", crc32c)
- .add("md5Hash", md5Hash)
- .add("metadata", metadata)
- .add("acl", acl)
- .toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApi.java
deleted file mode 100644
index 8bad4de..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApi.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.util.List;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.BucketAccessControlsTemplate;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides access to BucketAccessControl entities via their REST API.
- *
- * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/bucketAccessControls "/>
- */
-
-@SkipEncoding({ '/', '=' })
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface BucketAccessControlsApi {
-
- /**
- * Returns the ACL entry for the specified entity on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket which ACL is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers.
- *
- * @return a BucketAccessControls resource
- */
-
- @Named("BucketAccessControls:get")
- @GET
- @Path("/b/{bucket}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- BucketAccessControls getBucketAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity);
-
- /**
- * Creates a new ACL entry on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket of which ACL to be created
- *
- * @param template
- * In the request body,supply a {@link BucketAccessControlsTemplate} resource with role and entity
- *
- * @return If successful, this method returns a BucketAccessControls resource in the response body
- */
-
- @Named("BucketAccessControls:insert")
- @POST
- @Path("/b/{bucket}/acl")
- BucketAccessControls createBucketAccessControls(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) BucketAccessControlsTemplate template);
-
- /**
- * Permanently deletes the ACL entry for the specified entity on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket of that ACL is related
- * @return If successful, this method returns an empty response body.
- */
-
- @Named("BucketAccessControls:delete")
- @DELETE
- @Path("/b/{bucket}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- HttpResponse deleteBucketAccessControls(@PathParam("bucket") String bucketName, @PathParam("entity") String entity);
-
- /**
- * Retrieves all ACL entries on a specified bucket
- *
- * @param bucketName
- * Name of the bucket which ACL is related
- *
- * @return ListBucketAccessControls resource
- */
-
- @Named("BucketAccessControls:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/acl")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- @SelectJson("items")
- List<BucketAccessControls> listBucketAccessControls(@PathParam("bucket") String bucketName);
-
- /**
- * Updates an ACL entry on the specified bucket
- *
- * @param bucketName
- * Name of the bucket which ACL to be created
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers. In the request body, supply a
- * {@link BucketAccessControlsTemplate} resource with role
- *
- * @return If successful, this method returns a {@link BucketAccessControlsTemplate} resource in the response body
- */
- @Named("BucketAccessControls:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- BucketAccessControls updateBucketAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) BucketAccessControlsTemplate template);
-
- /**
- * Updates an ACL entry on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket which ACL to be created
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- *
- * @param template
- * In the request body, supply a {@link BucketAccessControlsTemplate} resource with role
- *
- * @return If successful, this method returns a BucketAccessControls resource in the response body
- */
- @Named("BucketAccessControls:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- BucketAccessControls patchBucketAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) BucketAccessControlsTemplate template);
-}
[7/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
JCLOUDS-944: Promote Google Cloud Storage to core
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/a4acb11f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/a4acb11f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/a4acb11f
Branch: refs/heads/master
Commit: a4acb11f72d17a0618072c22c1db699f5d4f7550
Parents: 2759926
Author: Andrew Gaul <ga...@apache.org>
Authored: Mon May 8 11:10:54 2017 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Mon May 8 11:13:07 2017 -0700
----------------------------------------------------------------------
CONTRIBUTING.md | 9 -
README.md | 214 +-------
google-cloud-storage/README.md | 51 --
google-cloud-storage/pom.xml | 172 ------
.../GoogleCloudStorageApi.java | 77 ---
.../GoogleCloudStorageApiMetadata.java | 96 ----
.../GoogleCloudStorageFallbacks.java | 34 --
.../GoogleCloudStorageProviderMetadata.java | 72 ---
.../binders/MultipartUploadBinder.java | 69 ---
.../binders/UploadBinder.java | 38 --
.../GoogleCloudStorageBlobRequestSigner.java | 153 ------
.../blobstore/GoogleCloudStorageBlobStore.java | 468 ----------------
...oogleCloudStorageBlobStoreContextModule.java | 44 --
.../functions/BlobMetadataToObjectTemplate.java | 56 --
...ListContainerOptionsToListObjectOptions.java | 58 --
.../functions/BucketToStorageMetadata.java | 45 --
.../functions/ObjectListToStorageMetadata.java | 58 --
.../functions/ObjectToBlobMetadata.java | 59 --
.../config/GoogleCloudStorageHttpApiModule.java | 63 ---
.../config/GoogleCloudStorageOAuthScopes.java | 56 --
.../config/GoogleCloudStorageParserModule.java | 90 ----
.../googlecloudstorage/domain/Bucket.java | 181 -------
.../domain/BucketAccessControls.java | 122 -----
.../domain/DomainResourceReferences.java | 105 ----
.../domain/GoogleCloudStorageObject.java | 79 ---
.../domain/ListPageWithPrefixes.java | 58 --
.../domain/ObjectAccessControls.java | 133 -----
.../googlecloudstorage/domain/Owner.java | 34 --
.../googlecloudstorage/domain/ProjectTeam.java | 55 --
.../domain/ResumableUpload.java | 43 --
.../domain/RewriteResponse.java | 41 --
.../templates/BucketAccessControlsTemplate.java | 33 --
.../domain/templates/BucketTemplate.java | 172 ------
.../domain/templates/ComposeObjectTemplate.java | 123 -----
.../templates/ObjectAccessControlsTemplate.java | 33 --
.../domain/templates/ObjectTemplate.java | 178 -------
.../features/BucketAccessControlsApi.java | 172 ------
.../googlecloudstorage/features/BucketApi.java | 281 ----------
.../DefaultObjectAccessControlsApi.java | 180 -------
.../features/ObjectAccessControlsApi.java | 317 -----------
.../googlecloudstorage/features/ObjectApi.java | 532 -------------------
.../features/ResumableUploadApi.java | 185 -------
.../GoogleCloudStorageErrorHandler.java | 75 ---
.../GoogleCloudStorageRedirectRetryHandler.java | 48 --
.../options/ComposeObjectOptions.java | 63 ---
.../options/CopyObjectOptions.java | 153 ------
.../options/DeleteBucketOptions.java | 51 --
.../options/DeleteObjectOptions.java | 88 ---
.../options/GetBucketOptions.java | 61 ---
.../options/GetObjectOptions.java | 88 ---
.../options/InsertBucketOptions.java | 53 --
.../options/InsertObjectOptions.java | 115 ----
.../options/ListObjectOptions.java | 82 ---
.../googlecloudstorage/options/ListOptions.java | 53 --
.../options/RewriteObjectOptions.java | 155 ------
.../options/UpdateBucketOptions.java | 71 ---
.../options/UpdateObjectOptions.java | 100 ----
.../parser/ParseToPayloadEnclosing.java | 33 --
.../parser/ParseToResumableUpload.java | 72 ---
.../reference/GoogleCloudStorageConstants.java | 37 --
.../GoogleCloudStorageProviderMetadataTest.java | 34 --
...ogleCloudStorageBlobIntegrationLiveTest.java | 324 -----------
.../GoogleCloudStorageBlobLiveTest.java | 115 ----
.../GoogleCloudStorageBlobSignerLiveTest.java | 36 --
...loudStorageContainerIntegrationLiveTest.java | 106 ----
.../GoogleCloudStorageContainerLiveTest.java | 36 --
.../BucketAccessControlsApiExpectTest.java | 188 -------
.../BucketAccessControlsApiLiveTest.java | 107 ----
.../features/BucketApiExpectTest.java | 258 ---------
.../features/BucketApiLiveTest.java | 301 -----------
...efaultObjectAccessControlsApiExpectTest.java | 219 --------
.../DefaultObjectAccessControlsApiLiveTest.java | 110 ----
.../ObjectAccessControlsApiExpectTest.java | 276 ----------
.../features/ObjectApiLiveTest.java | 478 -----------------
.../features/ObjectApiMockTest.java | 303 -----------
.../features/ResumableUploadApiLiveTest.java | 177 ------
.../GoogleCloudStorageErrorHandlerTest.java | 107 ----
.../BaseGoogleCloudStorageApiExpectTest.java | 30 --
.../BaseGoogleCloudStorageApiLiveTest.java | 54 --
.../BaseGoogleCloudStorageApiMockTest.java | 138 -----
.../BaseGoogleCloudStorageExpectTest.java | 178 -------
.../BaseGoogleCloudStorageParseTest.java | 38 --
.../parse/BucketAclGetTest.java | 39 --
.../parse/BucketAclInsertTest.java | 42 --
.../parse/BucketAclListTest.java | 55 --
.../parse/BucketAclUpdateTest.java | 39 --
.../parse/BucketUpdateTest.java | 57 --
.../parse/DefaultObjectAclGetTest.java | 42 --
.../parse/DefaultObjectAclInsertTest.java | 38 --
.../parse/DefaultObjectAclListTest.java | 50 --
.../parse/FullBucketGetTest.java | 80 ---
.../parse/NoAclBucketListTest.java | 61 ---
.../parse/NoAclBucketTest.java | 57 --
.../parse/ObjectAclGetTest.java | 49 --
.../parse/ObjectAclInsertTest.java | 44 --
.../parse/ObjectAclListTest.java | 51 --
.../parse/ObjectAclUpdateTest.java | 40 --
.../parse/ParseGoogleCloudStorageObject.java | 66 ---
.../ParseGoogleCloudStorageObjectListTest.java | 99 ----
.../parse/ParseObjectRewriteResponse.java | 72 ---
.../src/test/resources/bucket_acl_get.json | 9 -
.../resources/bucket_acl_insert_initial.json | 4 -
.../resources/bucket_acl_insert_response.json | 9 -
.../src/test/resources/bucket_acl_list.json | 27 -
.../resources/bucket_acl_update_initial.json | 4 -
.../resources/bucket_acl_update_response.json | 9 -
.../bucket_insert_request_payload.json | 3 -
.../bucket_update_request_payload.json | 12 -
.../test/resources/bucket_update_response.json | 15 -
.../test/resources/default_object_acl_get.json | 10 -
...fault_object_acl_insert_request_payload.json | 4 -
.../default_object_acl_insert_response.json | 6 -
.../test/resources/default_object_acl_list.json | 15 -
.../default_object_acl_update_initial.json | 6 -
...fault_object_acl_update_request_payload.json | 5 -
.../src/test/resources/full_bucket_get.json | 54 --
.../resources/list_bucket_with_options.json | 21 -
.../src/test/resources/logback.xml | 83 ---
.../src/test/resources/no_acl_bucket.json | 15 -
.../src/test/resources/no_acl_bucket_list.json | 21 -
.../src/test/resources/object_acl_get.json | 15 -
.../object_acl_insert_request_payload.json | 4 -
.../resources/object_acl_insert_response.json | 10 -
.../src/test/resources/object_acl_list.json | 17 -
.../resources/object_acl_request_payload.json | 4 -
.../resources/object_acl_update_initial.json | 9 -
.../resources/object_acl_update_response.json | 9 -
.../test/resources/object_compose_request.json | 23 -
.../src/test/resources/object_encoded_get.json | 21 -
.../src/test/resources/object_get.json | 21 -
.../src/test/resources/object_list.json | 47 --
.../src/test/resources/object_rewrite.json | 28 -
pom.xml | 81 ---
133 files changed, 2 insertions(+), 11650 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 4da3fc3..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,9 +0,0 @@
-If you are looking for the google-compute-engine provider, go to the main jclouds reposityy
-
-Please review the [How to Contribute](https://cwiki.apache.org/confluence/display/JCLOUDS/Contribute) page for information on how to submit your patch and how the review process works.
-
-Also make sure all the changes are aligned with the [Coding Standards](https://cwiki.apache.org/confluence/display/JCLOUDS/Writing+jclouds+Code) of the project.
-
-Thanks!
-
-The Apache jclouds team
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 79c2e80..cebad0a 100644
--- a/README.md
+++ b/README.md
@@ -1,216 +1,6 @@
jclouds Labs Google
======================
-Repository for developing experimental [Google Cloud Platform](https://cloud.google.com/) providers and [APIs](https://cloud.google.com/storage/docs/json_api/v1/)
+Legacy repository for developing experimental [Google Cloud Platform](https://cloud.google.com/) providers and [APIs](https://cloud.google.com/storage/docs/json_api/v1/)
-The Google Compute Engine provider has already been graduated to the main jclouds repo.
-
-License
--------
-Copyright (C) 2009-2014 The Apache Software Foundation
-
-Licensed under the Apache License, Version 2.0
-
-```
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2014 The Apache Software Foundation
-
- Licensed 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.
-```
+The Google Cloud Storage and Google Compute Engine providers have graduated to the main jclouds repo.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/README.md
----------------------------------------------------------------------
diff --git a/google-cloud-storage/README.md b/google-cloud-storage/README.md
deleted file mode 100644
index 59adad9..0000000
--- a/google-cloud-storage/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-jclouds Google Cloud Storage Provider
-======
-Make sure both Google Cloud Storage and Google Cloud Storage JSON API are enabled for the project
-(check from Developers Console -> Api&auth -> APIs)
-
-FAQ:
---------
-
-* Q. What is the identity for Google Cloud Storage?
-
-A. the identity is the developer email which can be obtained from the admin GUI. Its usually something in the form: [PROJECT_ID](https://cloud.google.com/compute/docs/overview#projectids)@developer.gserviceaccount.com
-
-* Q. What is the credential for Google Cloud Storage
-
-A. the credential is a private key, in pem format. It can be extracted from the p12 keystore that is obtained when creating a "Service Account" (in the GUI: Google apis console > Api Access > Create another client ID > "Service Account"
-
-* Q. How to convert a p12 keystore into a pem format jclouds Google Cloud Storage can handle:
-
-A.
-
-1. Convert the p12 file into pem format (it will ask for the keystore password, which is usually "notasecret"):
- openssl pkcs12 -in <my_keystore>.p12 -out <my_keystore>.pem -nodes
-
-2. Extract only the pk and remove passphrase
- openssl rsa -in <my_keystore>.pem -out <my_key>.pem
-
-The last file (<my_key>.pem) should contain the pk that needs to be passed to `ContextBuilder.credential()` for the provider `google-cloud-storage`.
-
-
-Running the live tests:
---------
-
-1. Place the following in your ~/.m2/settings.xml in a profile enabled when live:
-```
- <test.google-cloud-storage.identity>PROJECT_ID@developer.gserviceaccount.com</test.google-cloud-storage.identity>
- <test.google-cloud-storage.credential>-----BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQRRbRqVDtJLN1MO/xJoKqZuphDeBh5jIKueW3aNIiWs1XFcct+h
--- this text is literally from your <my_key>.pem
-aH7xmpHSTbbXmQkuuv+z8EKijigprd/FoJpTX1f5/R+4wQ==
------END RSA PRIVATE KEY-----</test.google-cloud-storage.credential>
- </properties>
-```
-Or, if using an existing OAuth Bearer Token for authentication.
-```
- <test.google-cloud-storage.identity>PROJECT_ID@developer.gserviceaccount.com</test.google-cloud-storage.identity>
- <test.google-cloud-storage.credential>EXISTING_BEARER_TOKEN</test.google-cloud-storage.credential>
- <test.jclouds.oauth.credential-type>bearerTokenCredentials</test.jclouds.oauth.credential-type>
- </properties>
-```
-
-2. mvn clean install -Plive
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/pom.xml
----------------------------------------------------------------------
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
deleted file mode 100644
index 6332b9e..0000000
--- a/google-cloud-storage/pom.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>jclouds-labs-google</artifactId>
- <version>2.1.0-SNAPSHOT</version>
- </parent>
-
- <!-- TODO: when out of labs, switch to org.jclouds.provider -->
- <groupId>org.apache.jclouds.labs</groupId>
- <artifactId>google-cloud-storage</artifactId>
- <name>jclouds Google Cloud Storage provider</name>
- <description>jclouds components to access Google Cloud Storage</description>
- <packaging>bundle</packaging>
-
- <properties>
- <test.google-cloud-storage.identity>client_email which usually looks like project_id@developer.gserviceaccount.com</test.google-cloud-storage.identity>
- <test.google-cloud-storage.credential>Private key (PEM encoded PKCS12 file or literal) associated with the client_email</test.google-cloud-storage.credential>
- <!-- Add this property to use a different project, or avoid looking up the project for each test. -->
- <test.jclouds.googlecloud.project-name></test.jclouds.googlecloud.project-name>
- <test.jclouds.oauth.credential-type>p12PrivateKeyCredentials</test.jclouds.oauth.credential-type>
- <test.google-cloud-storage.api-version>v1</test.google-cloud-storage.api-version>
- <test.google-cloud-storage.build-version/>
- <jclouds.osgi.export>org.jclouds.googlecloudstorage*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>googlecloud</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.common</groupId>
- <artifactId>googlecloud</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.api</groupId>
- <artifactId>oauth</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.auto.service</groupId>
- <artifactId>auto-service</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.auto.value</groupId>
- <artifactId>auto-value</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-slf4j</artifactId>
- <version>${jclouds.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jclouds.driver</groupId>
- <artifactId>jclouds-okhttp</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>mockwebserver</artifactId>
- <scope>test</scope>
- <exclusions>
- <!-- Already provided by jclouds-sshj -->
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>live</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>default-test</id>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </execution>
- <execution>
- <id>integration</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <threadCount>1</threadCount>
- <systemPropertyVariables>
- <test.google-cloud-storage.identity>${test.google-cloud-storage.identity}</test.google-cloud-storage.identity>
- <test.google-cloud-storage.credential>${test.google-cloud-storage.credential}</test.google-cloud-storage.credential>
- <test.jclouds.googlecloud.project-name>${test.jclouds.googlecloud.project-name}</test.jclouds.googlecloud.project-name>
- <test.jclouds.oauth.credential-type>${test.jclouds.oauth.credential-type}</test.jclouds.oauth.credential-type>
- <test.google-cloud-storage.api-version>${test.google-cloud-storage.api-version}</test.google-cloud-storage.api-version>
- <test.google-cloud-storage.build-version>${test.google-cloud-storage.build-version}</test.google-cloud-storage.build-version>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
deleted file mode 100644
index eec5294..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage;
-
-import java.io.Closeable;
-
-import javax.ws.rs.Path;
-
-import org.jclouds.googlecloudstorage.features.BucketAccessControlsApi;
-import org.jclouds.googlecloudstorage.features.BucketApi;
-import org.jclouds.googlecloudstorage.features.DefaultObjectAccessControlsApi;
-import org.jclouds.googlecloudstorage.features.ObjectAccessControlsApi;
-import org.jclouds.googlecloudstorage.features.ObjectApi;
-import org.jclouds.googlecloudstorage.features.ResumableUploadApi;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * Provide access to GoogleCloudStorage
- *
- * @see <a href="https://developers.google.com/storage/docs/json_api/v1/">api doc /a>
- */
-public interface GoogleCloudStorageApi extends Closeable {
-
- /**
- * Provides access to Default Object Access Control features on bucket
- */
- @Delegate
- @Path("/storage/v1")
- DefaultObjectAccessControlsApi getDefaultObjectAccessControlsApi();
-
- /**
- * Provides access to Bucket Access Control features
- */
- @Delegate
- @Path("/storage/v1")
- BucketAccessControlsApi getBucketAccessControlsApi();
-
- /**
- * Provides access to Bucket features
- */
- @Delegate
- @Path("/storage/v1")
- BucketApi getBucketApi();
-
- /**
- * Provides access to Object Access Control features
- */
- @Delegate
- @Path("/storage/v1")
- ObjectAccessControlsApi getObjectAccessControlsApi();
-
- /**
- * Provides access to Google Cloud Storage Object features
- */
- @Delegate
- ObjectApi getObjectApi();
-
- /**
- * Provides access to Google Cloud Storage ResumableUpload features
- */
- @Delegate
- ResumableUploadApi getResumableUploadApi();
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
deleted file mode 100644
index 884edd2..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage;
-
-import static org.jclouds.Constants.PROPERTY_IDEMPOTENT_METHODS;
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants.OPERATION_COMPLETE_INTERVAL;
-import static org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants.OPERATION_COMPLETE_TIMEOUT;
-import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE;
-import static org.jclouds.oauth.v2.config.OAuthProperties.JWS_ALG;
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.googlecloud.config.CurrentProject;
-import org.jclouds.googlecloudstorage.blobstore.config.GoogleCloudStorageBlobStoreContextModule;
-import org.jclouds.googlecloudstorage.config.GoogleCloudStorageHttpApiModule;
-import org.jclouds.googlecloudstorage.config.GoogleCloudStorageParserModule;
-import org.jclouds.oauth.v2.config.OAuthModule;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-public class GoogleCloudStorageApiMetadata extends BaseHttpApiMetadata<GoogleCloudStorageApi> {
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromApiMetadata(this);
- }
-
- public GoogleCloudStorageApiMetadata() {
- this(new Builder());
- }
-
- protected GoogleCloudStorageApiMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- Properties properties = BaseHttpApiMetadata.defaultProperties();
- properties.put("oauth.endpoint", "https://accounts.google.com/o/oauth2/token");
- properties.put(AUDIENCE, "https://accounts.google.com/o/oauth2/token");
- properties.put(JWS_ALG, "RS256");
- properties.put(PROPERTY_SESSION_INTERVAL, 3600);
- properties.put(OPERATION_COMPLETE_INTERVAL, 2000);
- properties.put(OPERATION_COMPLETE_TIMEOUT, 600000);
- properties.setProperty(PROPERTY_IDEMPOTENT_METHODS, "DELETE,GET,HEAD,OPTIONS,POST,PUT");
- return properties;
- }
-
- public static class Builder extends BaseHttpApiMetadata.Builder<GoogleCloudStorageApi, Builder> {
- protected Builder() {
- id("google-cloud-storage")
- .name("Google Cloud Storage Api")
- .identityName(CurrentProject.ClientEmail.DESCRIPTION)
- .credentialName("PEM encoded P12 private key associated with client_email")
- .documentation(URI.create("https://developers.google.com/storage/docs/json_api"))
- .version("v1")
- .defaultEndpoint("https://www.googleapis.com")
- .defaultProperties(GoogleCloudStorageApiMetadata.defaultProperties())
- .view(typeToken(BlobStoreContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>> builder()
- .add(GoogleCloudStorageParserModule.class)
- .add(OAuthModule.class)
- .add(GoogleCloudStorageHttpApiModule.class)
- .add(GoogleCloudStorageBlobStoreContextModule.class).build());
- }
-
- @Override
- public GoogleCloudStorageApiMetadata build() {
- return new GoogleCloudStorageApiMetadata(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageFallbacks.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageFallbacks.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageFallbacks.java
deleted file mode 100644
index d19175a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageFallbacks.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Throwables.propagate;
-
-import org.jclouds.Fallback;
-
-public final class GoogleCloudStorageFallbacks {
-
- public static final class NullOnBucketAlreadyExists implements Fallback<Object> {
- public Object createOrPropagate(Throwable t) throws Exception {
- if (checkNotNull(t, "throwable") instanceof IllegalStateException) {
- return null;
- }
- throw propagate(t);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadata.java
deleted file mode 100644
index 1431a5c..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadata.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.providers.internal.BaseProviderMetadata;
-
-import com.google.auto.service.AutoService;
-
-/** Note: This does not set iso3166Codes as Google intentionally does not document them. */
-@AutoService(ProviderMetadata.class)
-public final class GoogleCloudStorageProviderMetadata extends BaseProviderMetadata {
-
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return builder().fromProviderMetadata(this);
- }
-
- public GoogleCloudStorageProviderMetadata() {
- super(builder());
- }
-
- public GoogleCloudStorageProviderMetadata(Builder builder) {
- super(builder);
- }
-
- public static Properties defaultProperties() {
- return new Properties(); // currently all are set in the api metadata class.
- }
-
- public static final class Builder extends BaseProviderMetadata.Builder {
-
- private Builder() {
- id("google-cloud-storage") //
- .name("Google Cloud Storage") //
- .apiMetadata(new GoogleCloudStorageApiMetadata()) //
- .homepage(URI.create("https://cloud.google.com/storage")) //
- .console(URI.create("https://console.developers.google.com/project")) //
- .defaultProperties(GoogleCloudStorageProviderMetadata.defaultProperties());
- }
-
- @Override public GoogleCloudStorageProviderMetadata build() {
- return new GoogleCloudStorageProviderMetadata(this);
- }
-
- @Override public Builder fromProviderMetadata(ProviderMetadata in) {
- super.fromProviderMetadata(in);
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/MultipartUploadBinder.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/MultipartUploadBinder.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/MultipartUploadBinder.java
deleted file mode 100644
index ca6422b..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/MultipartUploadBinder.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.util.Map;
-
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.jclouds.io.payloads.MultipartForm;
-import org.jclouds.io.payloads.Part;
-import org.jclouds.io.payloads.StringPayload;
-import org.jclouds.json.Json;
-import org.jclouds.rest.MapBinder;
-
-import com.google.inject.Inject;
-
-public final class MultipartUploadBinder implements MapBinder {
- private static final String BOUNDARY_HEADER = "multipart_boundary";
-
- private final Json json;
-
- @Inject MultipartUploadBinder(Json json){
- this.json = json;
- }
-
- @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- ObjectTemplate template = (ObjectTemplate) postParams.get("template");
- Payload payload = (Payload) postParams.get("payload");
-
- String contentType = checkNotNull(template.contentType(), "contentType");
- Long length = checkNotNull(template.size(), "contentLength");
-
- StringPayload jsonPayload = Payloads.newStringPayload(json.toJson(template));
-
- payload.getContentMetadata().setContentLength(length);
-
- Part jsonPart = Part.create("Metadata", jsonPayload, new Part.PartOptions().contentType(APPLICATION_JSON));
- Part mediaPart = Part.create(template.name(), payload, new Part.PartOptions().contentType(contentType));
-
- request.setPayload(new MultipartForm(BOUNDARY_HEADER, jsonPart, mediaPart));
- // HeaderPart
- request.toBuilder().replaceHeader(CONTENT_TYPE, "Multipart/related; boundary= " + BOUNDARY_HEADER).build();
- return request;
- }
-
- @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- return request;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/UploadBinder.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/UploadBinder.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/UploadBinder.java
deleted file mode 100644
index 9b6fa4b..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/binders/UploadBinder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.binders;
-
-import java.util.Map;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.io.Payload;
-import org.jclouds.rest.MapBinder;
-
-public class UploadBinder implements MapBinder {
-
- @Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- Payload payload = (Payload) postParams.get("payload");
-
- request.getPayload().getContentMetadata().setContentType(payload.getContentMetadata().getContentType());
- request.setPayload(payload);
- return bindToRequest(request, payload);
- }
-
- @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- return request;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobRequestSigner.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobRequestSigner.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobRequestSigner.java
deleted file mode 100644
index 390ada1..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobRequestSigner.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.Signature;
-import java.security.SignatureException;
-
-import javax.annotation.Resource;
-import javax.inject.Provider;
-
-import org.jclouds.Constants;
-import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpUtils;
-import org.jclouds.http.Uris;
-import org.jclouds.http.options.GetOptions;
-import org.jclouds.logging.Logger;
-import org.jclouds.oauth.v2.config.Authorization;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Strings;
-import com.google.common.base.Supplier;
-import com.google.common.io.BaseEncoding;
-import com.google.common.net.HttpHeaders;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-public final class GoogleCloudStorageBlobRequestSigner implements BlobRequestSigner {
- private static final int DEFAULT_EXPIRY_SECONDS = 15 * 60;
- private static final URI STORAGE_URL = URI.create("http://storage.googleapis.com/");
-
- private final Supplier<Credentials> creds;
- private final Supplier<PrivateKey> privateKey;
- private final Provider<Long> timestamp;
- private final HttpUtils utils;
-
- private final BlobToHttpGetOptions toGetOptions = new BlobToHttpGetOptions();
-
- @Resource
- @Named(Constants.LOGGER_SIGNATURE)
- protected Logger signatureLog = Logger.NULL;
-
- @Inject
- protected GoogleCloudStorageBlobRequestSigner(@org.jclouds.location.Provider Supplier<Credentials> creds,
- @Authorization Supplier<PrivateKey> privateKey, @TimeStamp Provider<Long> timestamp, HttpUtils utils) {
- this.creds = creds;
- this.privateKey = privateKey;
- this.timestamp = timestamp;
- this.utils = utils;
- }
-
- @Override
- public HttpRequest signGetBlob(String container, String name) {
- return signGetBlob(container, name, DEFAULT_EXPIRY_SECONDS);
- }
-
- @Override
- public HttpRequest signGetBlob(String container, String name, long timeInSeconds) {
- return sign("GET", container, name, GetOptions.NONE, timestamp.get() + timeInSeconds, null);
- }
-
- @Override
- public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
- return sign("GET", container, name, toGetOptions.apply(options), timestamp.get() + DEFAULT_EXPIRY_SECONDS, null);
- }
-
- @Override
- public HttpRequest signPutBlob(String container, Blob blob) {
- return signPutBlob(container, blob, DEFAULT_EXPIRY_SECONDS);
- }
-
- @Override
- public HttpRequest signPutBlob(String container, Blob blob, long timeInSeconds) {
- return sign("PUT", container, blob.getMetadata().getName(), GetOptions.NONE, timestamp.get() + timeInSeconds, null);
- }
-
- @Deprecated
- @Override
- public HttpRequest signRemoveBlob(String container, String name) {
- throw new UnsupportedOperationException();
- }
-
- private HttpRequest sign(String method, String container, String name, GetOptions options, long expires, String contentType) {
- checkNotNull(container, "container");
- checkNotNull(name, "name");
-
- HttpRequest.Builder request = HttpRequest.builder()
- .method(method)
- .endpoint(Uris.uriBuilder(STORAGE_URL).appendPath(container).appendPath(name).build());
- if (contentType != null) {
- request.replaceHeader(HttpHeaders.CONTENT_TYPE, contentType);
- }
-
- String stringToSign = createStringToSign(request.build(), expires);
- byte[] rawSignature;
- try {
- Signature signer = Signature.getInstance("SHA256withRSA");
- signer.initSign(privateKey.get());
- signer.update(stringToSign.getBytes(Charsets.UTF_8));
- rawSignature = signer.sign();
- } catch (InvalidKeyException ike) {
- throw new RuntimeException(ike);
- } catch (NoSuchAlgorithmException nsae) {
- throw new RuntimeException(nsae);
- } catch (SignatureException se) {
- throw new RuntimeException(se);
- }
- String signature = BaseEncoding.base64().encode(rawSignature);
-
- return (HttpRequest) request
- .addQueryParam("Expires", String.valueOf(expires))
- .addQueryParam("GoogleAccessId", creds.get().identity)
- .addQueryParam("Signature", signature)
- .headers(options.buildRequestHeaders())
- .build();
- }
-
- private String createStringToSign(HttpRequest request, long expires) {
- utils.logRequest(signatureLog, request, ">>");
- StringBuilder buffer = new StringBuilder();
- buffer.append(request.getMethod()).append("\n");
- buffer.append(Strings.nullToEmpty(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_MD5))).append("\n");
- buffer.append(Strings.nullToEmpty(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_TYPE))).append("\n");
- buffer.append(String.valueOf(expires)).append("\n");
- // TODO: extension headers
- buffer.append(request.getEndpoint().getPath());
- return buffer.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
deleted file mode 100644
index c86dcc8..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GoogleCloudStorageBlobStore.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.io.BaseEncoding.base64;
-import static org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole.READER;
-
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.inject.Inject;
-
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobAccess;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.ContainerAccess;
-import org.jclouds.blobstore.domain.MultipartPart;
-import org.jclouds.blobstore.domain.MultipartUpload;
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.domain.internal.BlobImpl;
-import org.jclouds.blobstore.domain.internal.PageSetImpl;
-import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
-import org.jclouds.blobstore.internal.BaseBlobStore;
-import org.jclouds.blobstore.options.CopyOptions;
-import org.jclouds.blobstore.options.CreateContainerOptions;
-import org.jclouds.blobstore.options.GetOptions;
-import org.jclouds.blobstore.options.ListContainerOptions;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
-import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.googlecloud.config.CurrentProject;
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
-import org.jclouds.googlecloudstorage.blobstore.functions.BlobMetadataToObjectTemplate;
-import org.jclouds.googlecloudstorage.blobstore.functions.BlobStoreListContainerOptionsToListObjectOptions;
-import org.jclouds.googlecloudstorage.blobstore.functions.BucketToStorageMetadata;
-import org.jclouds.googlecloudstorage.blobstore.functions.ObjectListToStorageMetadata;
-import org.jclouds.googlecloudstorage.blobstore.functions.ObjectToBlobMetadata;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.options.InsertObjectOptions;
-import org.jclouds.googlecloudstorage.options.ListObjectOptions;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.io.ContentMetadata;
-import org.jclouds.io.Payload;
-import org.jclouds.io.PayloadSlicer;
-import org.jclouds.util.Strings2;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.hash.HashCode;
-import com.google.inject.Provider;
-
-public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
-
- private final GoogleCloudStorageApi api;
- private final BucketToStorageMetadata bucketToStorageMetadata;
- private final ObjectToBlobMetadata objectToBlobMetadata;
- private final ObjectListToStorageMetadata objectListToStorageMetadata;
- private final Provider<FetchBlobMetadata> fetchBlobMetadataProvider;
- private final BlobMetadataToObjectTemplate blobMetadataToObjectTemplate;
- private final BlobStoreListContainerOptionsToListObjectOptions listContainerOptionsToListObjectOptions;
- private final Supplier<String> projectId;
- private final BlobToHttpGetOptions blob2ObjectGetOptions;
-
- @Inject GoogleCloudStorageBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
- @Memoized Supplier<Set<? extends Location>> locations, PayloadSlicer slicer, GoogleCloudStorageApi api,
- BucketToStorageMetadata bucketToStorageMetadata, ObjectToBlobMetadata objectToBlobMetadata,
- ObjectListToStorageMetadata objectListToStorageMetadata,
- Provider<FetchBlobMetadata> fetchBlobMetadataProvider,
- BlobMetadataToObjectTemplate blobMetadataToObjectTemplate,
- BlobStoreListContainerOptionsToListObjectOptions listContainerOptionsToListObjectOptions,
- @CurrentProject Supplier<String> projectId,
- BlobToHttpGetOptions blob2ObjectGetOptions) {
- super(context, blobUtils, defaultLocation, locations, slicer);
- this.api = api;
- this.bucketToStorageMetadata = bucketToStorageMetadata;
- this.objectToBlobMetadata = objectToBlobMetadata;
- this.objectListToStorageMetadata = objectListToStorageMetadata;
- this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, "fetchBlobMetadataProvider");
- this.blobMetadataToObjectTemplate = blobMetadataToObjectTemplate;
- this.listContainerOptionsToListObjectOptions = listContainerOptionsToListObjectOptions;
- this.projectId = projectId;
- this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
- }
-
- @Override
- public PageSet<? extends StorageMetadata> list() {
- return new Function<ListPage<Bucket>, PageSet<? extends StorageMetadata>>() {
- public PageSet<? extends StorageMetadata> apply(ListPage<Bucket> from) {
- return new PageSetImpl<StorageMetadata>(Iterables.transform(from, bucketToStorageMetadata),
- from.nextPageToken());
- }
- }.apply(api.getBucketApi().listBucket(projectId.get()));
- }
-
- @Override
- public boolean containerExists(String container) {
- return api.getBucketApi().bucketExist(container);
- }
-
- @Override
- public boolean createContainerInLocation(Location location, String container) {
- BucketTemplate template = new BucketTemplate().name(container);
- if (location != null) {
- DomainResourceReferences.Location gcsLocation = DomainResourceReferences.Location.fromValue(location.getId());
- template = template.location(gcsLocation);
- }
- return api.getBucketApi().createBucket(projectId.get(), template) != null;
- }
-
- @Override
- public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) {
- BucketTemplate template = new BucketTemplate().name(container);
- if (location != null) {
- DomainResourceReferences.Location gcsLocation = DomainResourceReferences.Location.fromValue(location.getId());
- template = template.location(gcsLocation);
- }
- Bucket bucket = api.getBucketApi().createBucket(projectId.get(), template);
- if (options.isPublicRead()) {
- try {
- ObjectAccessControlsTemplate doAclTemplate = ObjectAccessControlsTemplate.create("allUsers", READER);
- api.getDefaultObjectAccessControlsApi().createDefaultObjectAccessControls(container, doAclTemplate);
- } catch (HttpResponseException e) {
- // If DefaultObjectAccessControls operation fail, Reverse create operation the operation.
- api.getBucketApi().deleteBucket(container);
- return false;
- }
- }
-
- return bucket != null;
- }
-
- @Override
- public ContainerAccess getContainerAccess(String container) {
- ObjectAccessControls controls = api.getDefaultObjectAccessControlsApi().getDefaultObjectAccessControls(container, "allUsers");
- if (controls == null || controls.role() == DomainResourceReferences.ObjectRole.OWNER) {
- return ContainerAccess.PRIVATE;
- } else {
- return ContainerAccess.PUBLIC_READ;
- }
- }
-
- @Override
- public void setContainerAccess(String container, ContainerAccess access) {
- ObjectAccessControlsTemplate doAclTemplate;
- if (access == ContainerAccess.PUBLIC_READ) {
- doAclTemplate = ObjectAccessControlsTemplate.create("allUsers", READER);
- api.getDefaultObjectAccessControlsApi().createDefaultObjectAccessControls(container, doAclTemplate);
- } else {
- api.getDefaultObjectAccessControlsApi().deleteDefaultObjectAccessControls(container, "allUsers");
- }
- }
-
- /** Returns list of of all the objects */
- @Override
- public PageSet<? extends StorageMetadata> list(String container) {
- return list(container, ListContainerOptions.NONE);
- }
-
- @Override
- public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) {
- ListObjectOptions listOptions = listContainerOptionsToListObjectOptions.apply(options);
- ListPageWithPrefixes<GoogleCloudStorageObject> gcsList = api.getObjectApi().listObjects(container, listOptions);
- PageSet<? extends StorageMetadata> list = objectListToStorageMetadata.apply(gcsList);
- return options.isDetailed() ? fetchBlobMetadataProvider.get().setContainerName(container).apply(list) : list;
- }
-
- /**
- * Checks whether an accessible object is available. Google cloud storage does not support directly support
- * BucketExist or ObjectExist operations
- */
- @Override
- public boolean blobExists(String container, String name) {
- return api.getObjectApi().objectExists(container, Strings2.urlEncode(name));
- }
-
- /**
- * This supports multipart/related upload which has exactly 2 parts, media-part and metadata-part
- */
- @Override
- public String putBlob(String container, Blob blob) {
- return putBlob(container, blob, PutOptions.NONE);
- }
-
- @Override
- public String putBlob(String container, Blob blob, PutOptions options) {
- if (options.isMultipart() || !blob.getPayload().isRepeatable()) {
- // JCLOUDS-912 prevents using single-part uploads with InputStream payloads.
- // Work around this with multi-part upload which buffers parts in-memory.
- return putMultipartBlob(container, blob, options);
- } else {
- checkNotNull(blob.getPayload().getContentMetadata().getContentLength());
-
- ObjectTemplate template = blobMetadataToObjectTemplate.apply(blob.getMetadata());
-
- HashCode md5 = blob.getMetadata().getContentMetadata().getContentMD5AsHashCode();
- if (md5 != null) {
- template.md5Hash(base64().encode(md5.asBytes()));
- }
-
- if (options.getBlobAccess() == BlobAccess.PUBLIC_READ) {
- ObjectAccessControls controls = ObjectAccessControls.builder()
- .entity("allUsers")
- .bucket(container)
- .role(READER)
- .build();
- template.addAcl(controls);
- }
-
- return api.getObjectApi().multipartUpload(container, template, blob.getPayload()).etag();
- }
- }
-
- @Override
- public BlobMetadata blobMetadata(String container, String name) {
- return objectToBlobMetadata.apply(api.getObjectApi().getObject(container, Strings2.urlEncode(name)));
- }
-
- @Override
- public Blob getBlob(String container, String name, GetOptions options) {
- GoogleCloudStorageObject gcsObject = api.getObjectApi().getObject(container, Strings2.urlEncode(name));
- if (gcsObject == null) {
- return null;
- }
- org.jclouds.http.options.GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
- MutableBlobMetadata metadata = objectToBlobMetadata.apply(gcsObject);
- Blob blob = new BlobImpl(metadata);
- // TODO: Does getObject not get the payload?!
- Payload payload = api.getObjectApi().download(container, Strings2.urlEncode(name), httpOptions).getPayload();
- payload.setContentMetadata(metadata.getContentMetadata()); // Doing this first retains it on setPayload.
- blob.setPayload(payload);
- return blob;
- }
-
- @Override
- public void removeBlob(String container, String name) {
- api.getObjectApi().deleteObject(container, Strings2.urlEncode(name));
- }
-
- @Override
- public BlobAccess getBlobAccess(String container, String name) {
- ObjectAccessControls controls = api.getObjectAccessControlsApi().getObjectAccessControls(container,
- Strings2.urlEncode(name), "allUsers");
- if (controls != null && controls.role() == DomainResourceReferences.ObjectRole.READER) {
- return BlobAccess.PUBLIC_READ;
- } else {
- return BlobAccess.PRIVATE;
- }
- }
-
- @Override
- public void setBlobAccess(String container, String name, BlobAccess access) {
- if (access == BlobAccess.PUBLIC_READ) {
- ObjectAccessControls controls = ObjectAccessControls.builder()
- .entity("allUsers")
- .bucket(container)
- .role(READER)
- .build();
- api.getObjectApi().patchObject(container, Strings2.urlEncode(name), new ObjectTemplate().addAcl(controls));
- } else {
- api.getObjectAccessControlsApi().deleteObjectAccessControls(container, Strings2.urlEncode(name), "allUsers");
- }
- }
-
- @Override
- protected boolean deleteAndVerifyContainerGone(String container) {
- ListPageWithPrefixes<GoogleCloudStorageObject> list = api.getObjectApi().listObjects(container);
-
- if (list == null || (!list.iterator().hasNext() && list.prefixes().isEmpty())) {
- if (!api.getBucketApi().deleteBucket(container)) {
- return true;
- } else {
- return !api.getBucketApi().bucketExist(container);
- }
- }
-
- return false;
- }
-
- @Override
- public String copyBlob(String fromContainer, String fromName, String toContainer, String toName,
- CopyOptions options) {
- if (options.ifMatch() != null) {
- throw new UnsupportedOperationException("GCS does not support ifMatch");
- }
- if (options.ifNoneMatch() != null) {
- throw new UnsupportedOperationException("GCS does not support ifNoneMatch");
- }
- if (options.ifModifiedSince() != null) {
- throw new UnsupportedOperationException("GCS does not support ifModifiedSince");
- }
- if (options.ifUnmodifiedSince() != null) {
- throw new UnsupportedOperationException("GCS does not support ifUnmodifiedSince");
- }
-
- if (options.contentMetadata() == null && options.userMetadata() == null) {
- return api.getObjectApi().copyObject(toContainer, Strings2.urlEncode(toName), fromContainer,
- Strings2.urlEncode(fromName)).etag();
- }
-
- ObjectTemplate template = new ObjectTemplate();
-
- if (options.contentMetadata() != null) {
- ContentMetadata contentMetadata = options.contentMetadata();
-
- String contentDisposition = contentMetadata.getContentDisposition();
- if (contentDisposition != null) {
- template.contentDisposition(contentDisposition);
- }
-
- // TODO: causes failures with subsequent GET operations:
- // HTTP/1.1 failed with response: HTTP/1.1 503 Service Unavailable; content: [Service Unavailable]
-/*
- String contentEncoding = contentMetadata.getContentEncoding();
- if (contentEncoding != null) {
- template.contentEncoding(contentEncoding);
- }
-*/
-
- String contentLanguage = contentMetadata.getContentLanguage();
- if (contentLanguage != null) {
- template.contentLanguage(contentLanguage);
- }
-
- String contentType = contentMetadata.getContentType();
- if (contentType != null) {
- template.contentType(contentType);
- }
- }
-
- if (options.userMetadata() != null) {
- template.customMetadata(options.userMetadata());
- }
-
- return api.getObjectApi().copyObject(toContainer, Strings2.urlEncode(toName), fromContainer,
- Strings2.urlEncode(fromName), template).etag();
- }
-
- @Override
- public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options) {
- String uploadId = UUID.randomUUID().toString();
- return MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata, options);
- }
-
- @Override
- public void abortMultipartUpload(MultipartUpload mpu) {
- ImmutableList.Builder<String> builder = ImmutableList.builder();
- List<MultipartPart> parts = listMultipartUpload(mpu);
- for (MultipartPart part : parts) {
- builder.add(getMPUPartName(mpu, part.partNumber()));
- }
- removeBlobs(mpu.containerName(), builder.build());
- }
-
- @Override
- public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts) {
- ImmutableList.Builder<GoogleCloudStorageObject> objects = ImmutableList.builder();
- for (MultipartPart part : parts) {
- objects.add(api.getObjectApi().getObject(mpu.containerName(),
- Strings2.urlEncode(getMPUPartName(mpu, part.partNumber()))));
- }
-
- ObjectTemplate destination = blobMetadataToObjectTemplate.apply(mpu.blobMetadata());
- if (mpu.putOptions().getBlobAccess() == BlobAccess.PUBLIC_READ) {
- ObjectAccessControls controls = ObjectAccessControls.builder()
- .entity("allUsers")
- .bucket(mpu.containerName())
- .role(READER)
- .build();
- destination.addAcl(controls);
- }
-
- ComposeObjectTemplate template = ComposeObjectTemplate.builder()
- .fromGoogleCloudStorageObject(objects.build())
- .destination(destination).build();
- String eTag = api.getObjectApi().composeObjects(mpu.containerName(), Strings2.urlEncode(mpu.blobName()), template)
- .etag();
-
- // remove parts, composite object keeps a reference to them
- ImmutableList.Builder<String> builder = ImmutableList.builder();
- for (MultipartPart part : parts) {
- builder.add(getMPUPartName(mpu, part.partNumber()));
- }
- removeBlobs(mpu.containerName(), builder.build());
-
- return eTag;
- }
-
- @Override
- public MultipartPart uploadMultipartPart(MultipartUpload mpu, int partNumber, Payload payload) {
- String partName = getMPUPartName(mpu, partNumber);
- long partSize = payload.getContentMetadata().getContentLength();
- InsertObjectOptions insertOptions = new InsertObjectOptions().name(partName);
- GoogleCloudStorageObject object = api.getObjectApi().simpleUpload(mpu.containerName(),
- mpu.blobMetadata().getContentMetadata().getContentType(), partSize, payload, insertOptions);
- return MultipartPart.create(partNumber, partSize, object.etag(), object.updated());
- }
-
- @Override
- public List<MultipartPart> listMultipartUpload(MultipartUpload mpu) {
- ImmutableList.Builder<MultipartPart> parts = ImmutableList.builder();
- PageSet<? extends StorageMetadata> pageSet = list(mpu.containerName(),
- new ListContainerOptions().prefix(mpu.id() + "_"));
- // TODO: pagination
- for (StorageMetadata sm : pageSet) {
- int lastUnderscore = sm.getName().lastIndexOf('_');
- int partNumber = Integer.parseInt(sm.getName().substring(lastUnderscore + 1));
- parts.add(MultipartPart.create(partNumber, sm.getSize(), sm.getETag(), sm.getLastModified()));
- }
- return parts.build();
- }
-
- @Override
- public List<MultipartUpload> listMultipartUploads(String container) {
- throw new UnsupportedOperationException("not supported");
- }
-
- @Override
- public long getMinimumMultipartPartSize() {
- return 5L * 1024L * 1024L;
- }
-
- @Override
- public long getMaximumMultipartPartSize() {
- return 5L * 1024L * 1024L * 1024L;
- }
-
- @Override
- public int getMaximumNumberOfParts() {
- // can raise limit via composite objects of composites
- return 32;
- }
-
- private static String getMPUPartName(MultipartUpload mpu, int partNumber) {
- return String.format("%s_%08d", mpu.id(), partNumber);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/config/GoogleCloudStorageBlobStoreContextModule.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/config/GoogleCloudStorageBlobStoreContextModule.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/config/GoogleCloudStorageBlobStoreContextModule.java
deleted file mode 100644
index 1392d3f..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/config/GoogleCloudStorageBlobStoreContextModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.config;
-
-import org.jclouds.blobstore.BlobRequestSigner;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.attr.ConsistencyModel;
-import org.jclouds.date.TimeStamp;
-import org.jclouds.googlecloudstorage.blobstore.GoogleCloudStorageBlobRequestSigner;
-import org.jclouds.googlecloudstorage.blobstore.GoogleCloudStorageBlobStore;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-public class GoogleCloudStorageBlobStoreContextModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
- bind(BlobStore.class).to(GoogleCloudStorageBlobStore.class).in(Scopes.SINGLETON);
- bind(BlobRequestSigner.class).to(GoogleCloudStorageBlobRequestSigner.class);
- }
-
- @Provides
- @TimeStamp
- protected final Long unixEpochTimestamp() {
- return System.currentTimeMillis() / 1000;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobMetadataToObjectTemplate.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobMetadataToObjectTemplate.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobMetadataToObjectTemplate.java
deleted file mode 100644
index e40ce49..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/functions/BlobMetadataToObjectTemplate.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.functions;
-
-import static com.google.common.io.BaseEncoding.base64;
-
-import java.util.Map;
-
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.io.ContentMetadata;
-
-import com.google.common.base.Function;
-import com.google.common.hash.HashCode;
-
-public class BlobMetadataToObjectTemplate implements Function<BlobMetadata, ObjectTemplate> {
-
- public ObjectTemplate apply(BlobMetadata from) {
- if (from == null)
- return null;
-
- String name = from.getName();
- Map<String, String> userMeta = from.getUserMetadata();
-
- ContentMetadata metadata = from.getContentMetadata();
- String contentDisposition = metadata.getContentDisposition();
- String contentEncoding = metadata.getContentEncoding();
- String contentLanguage = metadata.getContentLanguage();
- String contentType = metadata.getContentType();
- Long contentLength = metadata.getContentLength();
-
- HashCode md5 = metadata.getContentMD5AsHashCode();
-
- ObjectTemplate template = new ObjectTemplate().contentType(contentType).size(contentLength)
- .contentEncoding(contentEncoding).contentLanguage(contentLanguage)
- .contentDisposition(contentDisposition).name(name).customMetadata(userMeta);
- if (md5 != null) {
- template.md5Hash(base64().encode(md5.asBytes()));
- }
- return template;
- }
-}
[4/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetObjectOptions.java
deleted file mode 100644
index 5fd9b0f..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetObjectOptions.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.GetOptions;
-
-/**
- * Allows to optionally specify generation, ifGenerationMatch, ifGenerationNotMatch, ifMetagenerationMatch,
- * ifMetagenerationNotMatch and projection, in addition to the values in {@link GetOptions}.
- */
-public class GetObjectOptions extends GetOptions {
-
- public GetObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + "");
- return this;
- }
-
- public GetObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public GetObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public GetObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public GetObjectOptions generation(Long generation) {
- this.queryParameters.put("generation", checkNotNull(generation, "generation").toString());
- return this;
- }
-
- public GetObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public GetObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new GetObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public GetObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new GetObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public GetObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new GetObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public GetObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new GetObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public GetObjectOptions generation(Long generation) {
- return new GetObjectOptions().generation(generation);
- }
-
- public GetObjectOptions projection(Projection projection) {
- return new GetObjectOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertBucketOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertBucketOptions.java
deleted file mode 100644
index da3ce30..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertBucketOptions.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify predefinedAcl and projection which used in Bucket
- *
- * @see <a href="https://developers.google.com/storage/docs/json_api/v1/buckets/insert"/>
- */
-public class InsertBucketOptions extends BaseHttpRequestOptions {
-
- public InsertBucketOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public InsertBucketOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public InsertBucketOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new InsertBucketOptions().predefinedAcl(predefinedAcl);
- }
-
- public InsertBucketOptions projection(Projection projection) {
- return new InsertBucketOptions().projection(projection);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertObjectOptions.java
deleted file mode 100644
index e9af93c..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/InsertObjectOptions.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class InsertObjectOptions extends BaseHttpRequestOptions {
-
- public InsertObjectOptions contentEncoding(String contentEncoding) {
- this.queryParameters.put("contentEncoding", checkNotNull(contentEncoding, "contentEncoding") + "");
- return this;
- }
-
- public InsertObjectOptions name(String name) {
- this.queryParameters.put("name", checkNotNull(name, "name") + "");
- return this;
- }
-
- public InsertObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + "");
- return this;
- }
-
- public InsertObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public InsertObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public InsertObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public InsertObjectOptions generation(Long generation) {
- this.queryParameters.put("generation", checkNotNull(generation, "generation").toString());
- return this;
- }
-
- public InsertObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public InsertObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public InsertObjectOptions contentEncoding(String contentEncoding) {
- return new InsertObjectOptions().contentEncoding(contentEncoding);
- }
-
- public InsertObjectOptions name(String name) {
- return new InsertObjectOptions().name(name);
- }
-
- public InsertObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new InsertObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public InsertObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new InsertObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public InsertObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new InsertObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public InsertObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new InsertObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public InsertObjectOptions generation(Long generation) {
- return new InsertObjectOptions().generation(generation);
- }
-
- public InsertObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new InsertObjectOptions().predefinedAcl(predefinedAcl);
- }
-
- public UpdateObjectOptions projection(Projection projection) {
- return new UpdateObjectOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListObjectOptions.java
deleted file mode 100644
index 8f5710a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListObjectOptions.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-public class ListObjectOptions extends BaseHttpRequestOptions {
-
- public ListObjectOptions delimiter(String delimiter) {
- this.queryParameters.put("delimiter", checkNotNull(delimiter, "delimiter"));
- return this;
- }
-
- public ListObjectOptions prefix(String prefix) {
- this.queryParameters.put("prefix", checkNotNull(prefix, "delimeter"));
- return this;
- }
-
- public ListObjectOptions versions(Boolean versions) {
- this.queryParameters.put("versions", checkNotNull(versions, "versions") + "");
- return this;
- }
-
- public ListObjectOptions pageToken(String pageToken) {
- this.queryParameters.put("pageToken", checkNotNull(pageToken, "pageToken"));
- return this;
- }
-
- public ListObjectOptions maxResults(Integer maxResults) {
- this.queryParameters.put("maxResults", checkNotNull(maxResults, "maxResults") + "");
- return this;
- }
-
- public ListObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public ListObjectOptions delimiter(String delimiter) {
- return new ListObjectOptions().delimiter(delimiter);
- }
-
- public ListObjectOptions prefix(String prefix) {
- return new ListObjectOptions().prefix(prefix);
- }
-
- public ListObjectOptions versions(Boolean versions) {
- return new ListObjectOptions().versions(versions);
- }
-
- public ListObjectOptions pageToken(String pageToken) {
- return new ListObjectOptions().pageToken(pageToken);
- }
-
- public ListObjectOptions maxResults(Integer maxResults) {
- return new ListObjectOptions().maxResults(maxResults);
- }
-
- public ListObjectOptions projection(Projection projection) {
- return new ListObjectOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListOptions.java
deleted file mode 100644
index 87aadb9..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ListOptions.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-
-public class ListOptions extends org.jclouds.googlecloud.options.ListOptions {
-
- public ListOptions pageToken(String pageToken) {
- this.queryParameters.put("pageToken", checkNotNull(pageToken, "pageToken"));
- return this;
- }
-
- @Override public ListOptions maxResults(Integer maxResults) {
- return (ListOptions) super.maxResults(maxResults);
- }
-
- public ListOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public ListOptions pageToken(String pageToken) {
- return new ListOptions().pageToken(pageToken);
- }
-
- public ListOptions maxResults(Integer maxResults) {
- return new ListOptions().maxResults(maxResults);
- }
-
- public ListOptions projection(Projection projection) {
- return new ListOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/RewriteObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/RewriteObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/RewriteObjectOptions.java
deleted file mode 100644
index 0e93546..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/RewriteObjectOptions.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class RewriteObjectOptions extends BaseHttpRequestOptions {
-
- // TODO(broudy): Refactor these redundant options out of every options class.
-
- public RewriteObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + "");
- return this;
- }
-
- public RewriteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public RewriteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public RewriteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
- public RewriteObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) {
- this.queryParameters.put("ifSourceGenerationMatch", checkNotNull(ifSourceGenerationMatch, "ifSourceGenerationMatch") + "");
- return this;
- }
-
- public RewriteObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) {
- this.queryParameters.put("ifSourceGenerationNotMatch", checkNotNull(ifSourceGenerationNotMatch, "ifSourceGenerationNotMatch") + "");
- return this;
- }
-
- public RewriteObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) {
- this.queryParameters.put("ifSourceMetagenerationMatch", checkNotNull(ifSourceMetagenerationMatch, "ifSourceMetagenerationMatch")
- + "");
- return this;
- }
-
- public RewriteObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) {
- this.queryParameters.put("ifSourceMetagenerationNotMatch",
- checkNotNull(ifSourceMetagenerationNotMatch, "ifSourceMetagenerationNotMatch") + "");
- return this;
- }
-
- public RewriteObjectOptions sourceGeneration(Long sourceGeneration) {
- this.queryParameters.put("sourceGeneration", checkNotNull(sourceGeneration, "sourceGeneration") + "");
- return this;
- }
-
- public RewriteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public RewriteObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public RewriteObjectOptions rewriteToken(String rewriteToken) {
- this.queryParameters.put("rewriteToken", checkNotNull(rewriteToken, "rewriteToken").toString());
- return this;
- }
-
- public RewriteObjectOptions maxBytesRewrittenPerCall(Long maxBytesRewrittenPerCall) {
- this.queryParameters.put("maxBytesRewrittenPerCall",
- checkNotNull(maxBytesRewrittenPerCall, "maxBytesRewrittenPerCall").toString());
- return this;
- }
-
- public static class Builder {
-
- public RewriteObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new RewriteObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public RewriteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new RewriteObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public RewriteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new RewriteObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public RewriteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new RewriteObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public RewriteObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) {
- return new RewriteObjectOptions().ifSourceGenerationMatch(ifSourceGenerationMatch);
- }
-
- public RewriteObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) {
- return new RewriteObjectOptions().ifSourceGenerationNotMatch(ifSourceGenerationNotMatch);
- }
-
- public RewriteObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) {
- return new RewriteObjectOptions().ifSourceMetagenerationMatch(ifSourceMetagenerationMatch);
- }
-
- public RewriteObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) {
- return new RewriteObjectOptions().ifSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch);
- }
-
- public RewriteObjectOptions sourceGeneration(Long sourceGeneration) {
- return new RewriteObjectOptions().sourceGeneration(sourceGeneration);
- }
-
- public RewriteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new RewriteObjectOptions().predefinedAcl(predefinedAcl);
- }
-
- public RewriteObjectOptions projection(Projection projection) {
- return new RewriteObjectOptions().projection(projection);
- }
-
- public RewriteObjectOptions rewriteToken(String rewriteToken) {
- return new RewriteObjectOptions().rewriteToken(rewriteToken);
- }
-
- public RewriteObjectOptions maxBytesRewrittenPerCall(Long maxBytesRewrittenPerCall) {
- return new RewriteObjectOptions().maxBytesRewrittenPerCall(maxBytesRewrittenPerCall);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateBucketOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateBucketOptions.java
deleted file mode 100644
index f5d0804..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateBucketOptions.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class UpdateBucketOptions extends BaseHttpRequestOptions {
-
- public UpdateBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public UpdateBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public UpdateBucketOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public UpdateBucketOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public static class Builder {
-
- public UpdateBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new UpdateBucketOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public UpdateBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new UpdateBucketOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public UpdateBucketOptions projection(Projection projection) {
- return new UpdateBucketOptions().projection(projection);
- }
-
- public UpdateBucketOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new UpdateBucketOptions().predefinedAcl(predefinedAcl);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateObjectOptions.java
deleted file mode 100644
index 1fca761..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/UpdateObjectOptions.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class UpdateObjectOptions extends BaseHttpRequestOptions {
-
- public UpdateObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch")
- + "");
- return this;
- }
-
- public UpdateObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch",
- checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public UpdateObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public UpdateObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public UpdateObjectOptions generation(Long generation) {
- this.queryParameters.put("generation", checkNotNull(generation, "generation").toString());
- return this;
- }
-
- public UpdateObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
-
- public UpdateObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public UpdateObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new UpdateObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public UpdateObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new UpdateObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public UpdateObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new UpdateObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public UpdateObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new UpdateObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public UpdateObjectOptions generation(Long generation) {
- return new UpdateObjectOptions().generation(generation);
- }
-
- public UpdateObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new UpdateObjectOptions().predefinedAcl(predefinedAcl);
- }
-
- public UpdateBucketOptions projection(Projection projection) {
- return new UpdateBucketOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToPayloadEnclosing.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToPayloadEnclosing.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToPayloadEnclosing.java
deleted file mode 100644
index 8eceede..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToPayloadEnclosing.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parser;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.internal.PayloadEnclosingImpl;
-
-import com.google.common.base.Function;
-
-public class ParseToPayloadEnclosing implements Function<HttpResponse, PayloadEnclosingImpl> {
-
- @Override
- public PayloadEnclosingImpl apply(HttpResponse response) {
- PayloadEnclosingImpl impl = new PayloadEnclosingImpl();
- impl.setPayload(response.getPayload());
-
- return impl;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToResumableUpload.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToResumableUpload.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToResumableUpload.java
deleted file mode 100644
index bfeca99..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/parser/ParseToResumableUpload.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parser;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.regex.Pattern;
-
-import org.jclouds.googlecloudstorage.domain.ResumableUpload;
-import org.jclouds.http.HttpResponse;
-
-import com.google.common.base.Function;
-import com.google.common.base.Splitter;
-
-public class ParseToResumableUpload implements Function<HttpResponse, ResumableUpload> {
-
- @Override
- public ResumableUpload apply(HttpResponse response) {
-
- String contentLength = response.getFirstHeaderOrNull("Content-Length");
- String sessionUri = response.getFirstHeaderOrNull("Location");
- String uploadId = null;
- if (sessionUri != null) {
- uploadId = getUploadId(sessionUri);
- }
- String range = response.getFirstHeaderOrNull("Range");
- Long upperLimit = null;
- Long lowerLimit = null;
- if (range != null) {
- upperLimit = getUpperLimitFromRange(range);
- lowerLimit = getLowerLimitFromRange(range);
- if (lowerLimit != null && upperLimit != null) {
- checkArgument(lowerLimit < upperLimit, "lower range must less than upper range, was: %s - %s", lowerLimit,
- upperLimit);
- }
- }
-
- return ResumableUpload.create(response.getStatusCode(), uploadId, contentLength, upperLimit, lowerLimit);
- }
-
- // Return the Id of the Upload
- private String getUploadId(String sessionUri) {
- // TODO: better way to parse query parameters?
- return Splitter.on(Pattern.compile("\\&")).trimResults().omitEmptyStrings().withKeyValueSeparator("=")
- .split(sessionUri).get("upload_id");
- }
-
- private long getUpperLimitFromRange(String range) {
- String upperLimit = range.split("-")[1];
- return Long.parseLong(upperLimit);
- }
-
- private long getLowerLimitFromRange(String range) {
- String removeByte = range.split("=")[1];
- String lowerLimit = removeByte.split("-")[0];
- return Long.parseLong(lowerLimit);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
deleted file mode 100644
index 299a249..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.reference;
-
-import com.google.common.annotations.Beta;
-
-public final class GoogleCloudStorageConstants {
-
- private GoogleCloudStorageConstants() {
- }
-
- /**
- * The total time, in msecs, to wait for an operation to complete.
- */
- @Beta
- public static final String OPERATION_COMPLETE_TIMEOUT = "jclouds.google-cloud-storage.operation-complete-timeout";
-
- /**
- * The interval, in msecs, between calls to check whether an operation has completed.
- */
- @Beta
- public static final String OPERATION_COMPLETE_INTERVAL = "jclouds.google-cloud-storage.operation-complete-interval";
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadataTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadataTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadataTest.java
deleted file mode 100644
index 2ddc1c2..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageProviderMetadataTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage;
-
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.testng.annotations.Test;
-
-/**
- * Tests that GoogleComputeProviderMetadata is properly registered in ServiceLoader
- * <p/>
- * <pre>
- * META-INF/services/org.jclouds.providers.ProviderMetadata
- * </pre>
- */
-@Test(groups = "unit", testName = "GoogleCloudStorageProviderMetadataTest")
-public class GoogleCloudStorageProviderMetadataTest extends BaseProviderMetadataTest {
- public GoogleCloudStorageProviderMetadataTest() {
- super(new GoogleCloudStorageProviderMetadata(), new GoogleCloudStorageApiMetadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
deleted file mode 100644
index d68441c..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobIntegrationLiveTest.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.integration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.ws.rs.core.MediaType;
-
-import org.assertj.core.api.Fail;
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.BlobBuilder.PayloadBlobBuilder;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
-import org.jclouds.blobstore.options.PutOptions;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.jclouds.io.Payloads;
-import org.jclouds.io.payloads.ByteSourcePayload;
-import org.jclouds.utils.TestUtils;
-import org.testng.SkipException;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.hash.HashCode;
-import com.google.common.hash.HashFunction;
-import com.google.common.hash.Hashing;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Files;
-
-@Test(groups = { "live", "blobstorelive" })
-public class GoogleCloudStorageBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
-
- private long PART_SIZE = 5L * 1024L * 1024L;
-
- @Override
- protected long getMinimumMultipartBlobSize() {
- return PART_SIZE + 1;
- }
-
- public GoogleCloudStorageBlobIntegrationLiveTest() throws IOException {
- provider = "google-cloud-storage";
- }
-
- @Override protected Properties setupProperties() {
- TestProperties.setGoogleCredentialsFromJson(provider);
- Properties properties = super.setupProperties();
- properties.put("jclouds.mpu.parts.size", 2 * 1024 * 1024);
- return TestProperties.apply(provider, properties);
- }
-
- @Override
- @Test(enabled = false)
- public void testGetTwoRanges() throws SkipException {
- // not supported in GoogleCloudStorage
- }
-
- @Override
- @Test(enabled = false)
- public void testGetRange() throws SkipException {
- // not supported in GoogleCloudStorage
- }
-
- @Override
- @Test(enabled = false)
- public void testCreateBlobWithExpiry() throws SkipException {
- // not supported in object level.
- }
-
- @Override
- @Test(groups = { "integration", "live" }, dataProvider = "gcsPutTest")
- public void testPutObject(String name, String type, Object content, Object realObject) throws InterruptedException,
- IOException {
- PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder(name).payload(Payloads.newPayload(content))
- .contentType(type);
- addContentMetadata(blobBuilder);
- Blob blob = blobBuilder.build();
- blob.getPayload().setContentMetadata(blob.getMetadata().getContentMetadata());
- String container = getContainerName();
-
- try {
- assertNotNull(view.getBlobStore().putBlob(container, blob));
- blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
- validateMetadata(blob.getMetadata(), container, name);
- checkContentMetadata(blob);
-
- String returnedString = getContentAsStringOrNullAndClose(blob);
- assertEquals(returnedString, realObject);
- PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
- assertThat(set).isNotEmpty();
- } finally {
- returnContainer(container);
- }
- }
-
- @Override
- protected void addContentMetadata(PayloadBlobBuilder blobBuilder) {
- blobBuilder.contentType("text/csv");
- blobBuilder.contentDisposition("attachment; filename=photo.jpg");
- // TODO: causes failures with subsequent GET operations:
- // HTTP/1.1 failed with response: HTTP/1.1 503 Service Unavailable; content: [Service Unavailable]
- //blobBuilder.contentEncoding("gzip");
- blobBuilder.contentLanguage("en");
- }
-
- @Override
- protected void checkContentMetadata(Blob blob) {
- checkContentType(blob, "text/csv");
- checkContentDisposition(blob, "attachment; filename=photo.jpg");
- //checkContentEncoding(blob, "gzip");
- checkContentLanguage(blob, "en");
- }
-
- @DataProvider(name = "gcsPutTest")
- public Object[][] createData1() throws IOException {
- File file = new File("pom.xml");
- String realObject = Files.toString(file, Charsets.UTF_8);
-
- return new Object[][] { { "file.xml", "text/xml", file, realObject },
- { "string.xml", "text/xml", realObject, realObject },
- { "stringwith/slash.xml", "text/xml", realObject, realObject },
- { "bytes.xml", "application/octet-stream", realObject.getBytes(), realObject } };
- }
-
- // Content-Length should not be null
- @Override
- public void testPutObjectStream() throws InterruptedException, IOException, java.util.concurrent.ExecutionException {
-
- ByteSource byteSource = ByteSource.wrap("foo".getBytes());
- ByteSourcePayload payload = new ByteSourcePayload(byteSource);
- PayloadBlobBuilder blobBuilder = view.getBlobStore().blobBuilder("streaming").payload(payload)
- .contentLength(byteSource.read().length);
- addContentMetadata(blobBuilder);
-
- Blob blob = blobBuilder.build();
- String container = getContainerName();
-
- try {
- assertNotNull(view.getBlobStore().putBlob(container, blob));
-
- blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
- String returnedString = getContentAsStringOrNullAndClose(blob);
- assertEquals(returnedString, "foo");
- validateMetadata(blob.getMetadata(), container, blob.getMetadata().getName());
- checkContentMetadata(blob);
- PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
- assertThat(set).isNotEmpty();
- } finally {
- returnContainer(container);
- }
- };
-
- @Override
- public void testMetadata() throws InterruptedException, IOException {
- String name = "hello";
-
- HashFunction hf = Hashing.md5();
- HashCode md5 = hf.newHasher().putString(TEST_STRING, Charsets.UTF_8).hash();
- Blob blob = view.getBlobStore().blobBuilder(name).userMetadata(ImmutableMap.of("adrian", "powderpuff"))
- .payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).contentMD5(md5).build();
- String container = getContainerName();
- try {
- assertNull(view.getBlobStore().blobMetadata(container, "powderpuff"));
-
- addBlobToContainer(container, blob);
- Blob newObject = validateContent(container, name);
-
- BlobMetadata metadata = newObject.getMetadata();
-
- validateMetadata(metadata);
- validateMetadata(metadata, container, name);
- validateMetadata(view.getBlobStore().blobMetadata(container, name));
-
- blob.getMetadata().getUserMetadata().put("adrian", "wonderpuff");
- blob.getMetadata().getUserMetadata().put("adrian", "powderpuff");
-
- addBlobToContainer(container, blob);
- validateMetadata(view.getBlobStore().blobMetadata(container, name));
-
- } finally {
- returnContainer(container);
- }
- }
-
- @Override
- protected void checkMD5(BlobMetadata metadata) throws IOException {
- HashCode md5 = Hashing.md5().hashString(TEST_STRING, Charsets.UTF_8);
- assertEquals(metadata.getContentMetadata().getContentMD5AsHashCode(), md5);
- }
-
- @Test(groups = { "integration", "live" })
- public void testMultipartChunkedFileStream() throws IOException, InterruptedException {
- String containerName = getContainerName();
- try {
- BlobStore blobStore = view.getBlobStore();
- long countBefore = blobStore.countBlobs(containerName);
-
- addMultipartBlobToContainer(containerName, "const.txt");
-
- long countAfter = blobStore.countBlobs(containerName);
- assertThat(countAfter).isEqualTo(countBefore + 1);
- } finally {
- returnContainer(containerName);
- }
- }
-
- protected void addMultipartBlobToContainer(String containerName, String key) throws IOException {
- ByteSource sourceToUpload = TestUtils.randomByteSource().slice(0, PART_SIZE + 1);
-
- BlobStore blobStore = view.getBlobStore();
- blobStore.createContainerInLocation(null, containerName);
- Blob blob = blobStore.blobBuilder(key).payload(sourceToUpload).contentLength(sourceToUpload.size())
- .contentType(MediaType.TEXT_PLAIN).build();
- blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
- }
-
- @DataProvider(name = "delete")
- public Object[][] createData() {
- if (System.getProperty("os.name").toLowerCase().contains("windows")) {
- return new Object[][] { { "normal" }, { "sp ace" } };
- } else {
- return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "path/foo" }, { "colon:" },
- { "asteri*k" }, { "quote\"" }, { "{great<r}" }, { "lesst>en" }, { "p|pe" } };
- }
- }
-
- // Remove "unic₪de" from DataProvider
- @Override
- @Test(groups = { "integration", "live" }, dataProvider = "delete")
- public void deleteObject(String name) throws InterruptedException {
- super.deleteObject(name);
- }
-
- @Override
- public void testSetBlobAccess() throws Exception {
- try {
- super.testSetBlobAccess();
- Fail.failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
- } catch (UnsupportedOperationException uoe) {
- throw new SkipException("request signing not supported on GCS", uoe);
- }
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfMatch() throws Exception {
- super.testCopyIfMatch();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfMatchNegative() throws Exception {
- super.testCopyIfMatch();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfNoneMatch() throws Exception {
- super.testCopyIfNoneMatch();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfNoneMatchNegative() throws Exception {
- super.testCopyIfNoneMatch();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfModifiedSince() throws Exception {
- super.testCopyIfModifiedSince();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfModifiedSinceNegative() throws Exception {
- super.testCopyIfModifiedSince();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfUnmodifiedSince() throws Exception {
- super.testCopyIfUnmodifiedSince();
- }
-
- @Override
- @Test(expectedExceptions = UnsupportedOperationException.class)
- public void testCopyIfUnmodifiedSinceNegative() throws Exception {
- super.testCopyIfUnmodifiedSince();
- }
-
- @Override
- public void testListMultipartUploads() throws Exception {
- try {
- super.testListMultipartUploads();
- } catch (UnsupportedOperationException uoe) {
- throw new SkipException("GCS does not support listing multipart uploads", uoe);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobLiveTest.java
deleted file mode 100644
index 2584b02..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobLiveTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.integration;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.integration.internal.BaseBlobLiveTest;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.internal.PayloadEnclosingImpl;
-import org.jclouds.io.ByteStreams2;
-import org.jclouds.io.Payloads;
-import org.jclouds.io.payloads.ByteSourcePayload;
-import org.jclouds.utils.TestUtils;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.hash.HashCode;
-import com.google.common.hash.Hashing;
-import com.google.common.io.BaseEncoding;
-import com.google.common.io.ByteSource;
-
-@Test(groups = { "live" })
-public class GoogleCloudStorageBlobLiveTest extends BaseBlobLiveTest {
- private static final String sysHttpStreamUrl = System.getProperty("jclouds.blobstore.httpstream.url");
- private static final String sysHttpStreamMD5 = System.getProperty("jclouds.blobstore.httpstream.md5");
-
- public GoogleCloudStorageBlobLiveTest() {
- provider = "google-cloud-storage";
- }
-
- @Override protected Properties setupProperties() {
- TestProperties.setGoogleCredentialsFromJson(provider);
- return TestProperties.apply(provider, super.setupProperties());
- }
-
- @Override
- @Parameters({ "jclouds.blobstore.httpstream.url", "jclouds.blobstore.httpstream.md5" })
- public void testCopyUrl(String httpStreamUrl, String httpStreamMD5) throws Exception {
- httpStreamUrl = checkNotNull(httpStreamUrl != null ? httpStreamUrl : sysHttpStreamUrl, "httpStreamUrl");
- httpStreamMD5 = checkNotNull(httpStreamMD5 != null ? httpStreamMD5 : sysHttpStreamMD5, "httpStreamMd5");
-
- HttpResponse response = view.utils().http()
- .invoke(HttpRequest.builder().method("GET").endpoint(httpStreamUrl).build());
- long length = response.getPayload().getContentMetadata().getContentLength();
-
- checkNotNull(response.getPayload().getContentMetadata().getContentType());
- assertEquals(response.getPayload().getContentMetadata().getContentType(), "application/x-gzip");
-
- String name = "hello";
- HashCode md5 = HashCode.fromBytes(BaseEncoding.base16().lowerCase().decode(httpStreamMD5));
- byte[] payload = ByteStreams2.toByteArrayAndClose(response.getPayload().getInput());
-
- Blob blob = view.getBlobStore().blobBuilder(name).payload(payload).contentLength(length)
- .contentType(response.getPayload().getContentMetadata().getContentType())
- .contentMD5(md5).build();
- String container = getContainerName();
- try {
- assertNotNull(view.getBlobStore().putBlob(container, blob));
- checkMD5(container, name, md5.asBytes());
- } finally {
- returnContainer(container);
- }
- }
-
- @Test(groups = "live")
- public void testPutBlobWithMd5() throws IOException, InterruptedException {
- String containerName = getContainerName();
- String blobName = "md5test";
- try {
- long contentLength = 32 * 1024L;
- ByteSource byteSource = TestUtils.randomByteSource().slice(0, contentLength);
- ByteSourcePayload payload = Payloads.newByteSourcePayload(byteSource);
- PayloadEnclosingImpl payloadImpl = new PayloadEnclosingImpl(payload);
-
- BlobStore blobStore = view.getBlobStore();
-
- // This would trigger server side validation of md5
- HashCode hcMd5 = byteSource.hash(Hashing.md5());
-
- Blob blob = blobStore.blobBuilder(blobName).payload(payloadImpl.getPayload()).contentType("image/jpeg")
- .contentLength(contentLength).contentLanguage("en").contentDisposition("attachment")
- .contentMD5(hcMd5).userMetadata(ImmutableMap.of("Adrian", "powderpuff")).build();
-
- blobStore.putBlob(containerName, blob);
- checkMD5(containerName, blobName, hcMd5.asBytes());
-
- } finally {
- returnContainer(containerName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobSignerLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobSignerLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobSignerLiveTest.java
deleted file mode 100644
index 2f76490..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageBlobSignerLiveTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.integration;
-
-import org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest;
-import org.testng.SkipException;
-import org.testng.annotations.Test;
-
-@Test(groups = { "live" })
-public class GoogleCloudStorageBlobSignerLiveTest extends BaseBlobSignerLiveTest {
- public GoogleCloudStorageBlobSignerLiveTest() {
- provider = "google-cloud-storage";
- }
-
- public void testSignRemoveUrl() throws Exception {
- try {
- super.testSignRemoveUrl();
- } catch (UnsupportedOperationException uoe) {
- throw new SkipException("not yet implemented in GCS", uoe);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerIntegrationLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerIntegrationLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerIntegrationLiveTest.java
deleted file mode 100644
index ff7f665..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerIntegrationLiveTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.integration;
-
-import static com.google.common.collect.Iterables.get;
-import static org.jclouds.blobstore.options.ListContainerOptions.Builder.maxResults;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.ws.rs.core.MediaType;
-
-import org.assertj.core.api.Fail;
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.blobstore.domain.PageSet;
-import org.jclouds.blobstore.domain.StorageMetadata;
-import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.testng.SkipException;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.hash.Hashing;
-
-public class GoogleCloudStorageContainerIntegrationLiveTest extends BaseContainerIntegrationTest {
-
- public GoogleCloudStorageContainerIntegrationLiveTest() {
- provider = "google-cloud-storage";
- }
-
- @Override protected Properties setupProperties() {
- TestProperties.setGoogleCredentialsFromJson(provider);
- return TestProperties.apply(provider, super.setupProperties());
- }
-
- @Override
- @Test(groups = { "integration", "live" })
- public void testWithDetails() throws InterruptedException, IOException {
- String key = "hello";
- String containerName = getContainerName();
- try {
- addBlobToContainer(
- containerName,
- view.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("adrian", "powderpuff"))
- .payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN)
- .contentMD5(Hashing.md5().newHasher().putString(TEST_STRING, Charsets.UTF_8).hash()).build());
- validateContent(containerName, key);
-
- PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName,
- maxResults(1).withDetails());
-
- BlobMetadata metadata = BlobMetadata.class.cast(get(container, 0));
-
- assert metadata.getContentMetadata().getContentType().startsWith("text/plain") : metadata.getContentMetadata()
- .getContentType();
- assertEquals(metadata.getContentMetadata().getContentLength(), Long.valueOf(TEST_STRING.length()));
- assertEquals(metadata.getUserMetadata().get("adrian"), "powderpuff");
- checkMD5(metadata);
- } finally {
- returnContainer(containerName);
- }
- }
-
- @Override
- public void testDirectory() throws InterruptedException {
- // TODO: testDirectory fails when querying blob with name "directory/directory"; querying "directory%2Fdirectory"
- // succeeds, however. I believe this is an escaping issue that should be addressed.
- throw new SkipException("directories are not supported in GoogleCloudStorage");
- }
-
- @Override
- public void testListMarkerAfterLastKey() throws Exception {
- throw new SkipException("cannot specify arbitrary markers");
- }
-
- @Override
- public void testListMarkerPrefix() throws Exception {
- throw new SkipException("cannot specify arbitrary markers");
- }
-
- @Override
- public void testSetContainerAccess() throws Exception {
- try {
- super.testSetContainerAccess();
- Fail.failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
- } catch (UnsupportedOperationException uoe) {
- throw new SkipException("request signing not supported on GCS", uoe);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerLiveTest.java
deleted file mode 100644
index 559713b..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/blobstore/integration/GoogleCloudStorageContainerLiveTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.blobstore.integration;
-
-import java.util.Properties;
-
-import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.testng.annotations.Test;
-
-@Test(groups = { "live" })
-public class GoogleCloudStorageContainerLiveTest extends BaseContainerLiveTest {
-
- public GoogleCloudStorageContainerLiveTest() {
- provider = "google-cloud-storage";
- }
-
- @Override protected Properties setupProperties() {
- TestProperties.setGoogleCredentialsFromJson(provider);
- return TestProperties.apply(provider, super.setupProperties());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiExpectTest.java
deleted file mode 100644
index 79f96f6..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiExpectTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.templates.BucketAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiExpectTest;
-import org.jclouds.googlecloudstorage.parse.BucketAclGetTest;
-import org.jclouds.googlecloudstorage.parse.BucketAclInsertTest;
-import org.jclouds.googlecloudstorage.parse.BucketAclListTest;
-import org.jclouds.googlecloudstorage.parse.BucketAclUpdateTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "BucketAccessControlsApiExpectTest")
-public class BucketAccessControlsApiExpectTest extends BaseGoogleCloudStorageApiExpectTest {
-
- private static final String EXPECTED_TEST_BUCKET = "jcloudstestbucket";
-
- public static final HttpRequest GET_BUCKETACL_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse GET_BUCKETACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_acl_get.json")).build();
-
- private final HttpResponse CREATE_BUCKETACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_acl_insert_response.json")).build();
-
- private final HttpRequest LIST_BUCKETACL_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse LIST_BUCKETACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_acl_list.json")).build();
-
- // Test getBucketAccessControls
- public void testGetBucketAclResponseIs2xx() throws Exception {
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- GET_BUCKETACL_REQUEST, GET_BUCKETACL_RESPONSE).getBucketAccessControlsApi();
-
- assertEquals(api.getBucketAccessControls(EXPECTED_TEST_BUCKET, "allUsers"), new BucketAclGetTest().expected());
- }
-
- public void testGetBucketAclResponseIs4xx() throws Exception {
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- GET_BUCKETACL_REQUEST, getResponse).getBucketAccessControlsApi();
-
- assertNull("404", api.getBucketAccessControls(EXPECTED_TEST_BUCKET, "allUsers"));
-
- }
-
- // Test listBucketAccessControls
- public void testListBucketAclResponseIs2xx() throws Exception {
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- LIST_BUCKETACL_REQUEST, LIST_BUCKETACL_RESPONSE).getBucketAccessControlsApi();
-
- assertEquals(api.listBucketAccessControls(EXPECTED_TEST_BUCKET), new BucketAclListTest().expected());
-
- }
-
- public void testListBucketAclResponseIs4xx() throws Exception {
- HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- LIST_BUCKETACL_REQUEST, listResponse).getBucketAccessControlsApi();
-
- assertNull(api.listBucketAccessControls("jcloudstestbucket"));
- }
-
- // Test insertBucketAccessControls
- public void testInsertBucketAclResponseIs2xx() throws Exception {
- HttpRequest insertRequest = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_acl_insert_initial.json",
- MediaType.APPLICATION_JSON)).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- insertRequest, CREATE_BUCKETACL_RESPONSE).getBucketAccessControlsApi();
-
- BucketAccessControlsTemplate template = BucketAccessControlsTemplate.create("allAuthenticatedUsers", Role.WRITER);
-
- assertEquals(api.createBucketAccessControls(EXPECTED_TEST_BUCKET, template), new BucketAclInsertTest().expected());
- }
-
- // Test deleteBucketAccessControls
- public void testDeleteBucketAclResponseIs2xx() throws Exception {
- HttpRequest delete = HttpRequest.builder().method("DELETE")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allAuthenticatedUsers")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- HttpResponse deleteResponse = HttpResponse.builder().statusCode(204).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- delete, deleteResponse).getBucketAccessControlsApi();
-
- assertEquals(api.deleteBucketAccessControls(EXPECTED_TEST_BUCKET, "allAuthenticatedUsers"), deleteResponse);
- }
-
- public void testDeleteBucketAclResponseIs4xx() throws Exception {
- HttpRequest delete = HttpRequest.builder().method("DELETE")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allAuthenticatedUsers")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- delete, deleteResponse).getBucketAccessControlsApi();
-
- assertNull(api.deleteBucketAccessControls(EXPECTED_TEST_BUCKET, "allAuthenticatedUsers"));
- }
-
- // Test updateBucketAccessControls
- public void testUpdateBucketAclResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_acl_update_initial.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_acl_update_response.json")).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- update, updateResponse).getBucketAccessControlsApi();
-
- BucketAccessControlsTemplate template = BucketAccessControlsTemplate.create("allUsers", Role.OWNER);
-
- assertEquals(api.updateBucketAccessControls(EXPECTED_TEST_BUCKET, "allUsers", template),
- new BucketAclUpdateTest().expected());
- }
-
- // Test updateBucketAccessControls
- public void testPatchBucketAclResponseIs2xx() throws Exception {
- HttpRequest patchRequest = HttpRequest
- .builder()
- .method("PATCH")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/acl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_acl_update_initial.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse patchResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_acl_update_response.json")).build();
-
- BucketAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- patchRequest, patchResponse).getBucketAccessControlsApi();
-
- BucketAccessControlsTemplate template = BucketAccessControlsTemplate.create("allUsers", Role.OWNER);
-
- assertEquals(api.patchBucketAccessControls(EXPECTED_TEST_BUCKET, "allUsers", template),
- new BucketAclUpdateTest().expected());
- }
-}
[3/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiLiveTest.java
deleted file mode 100644
index c44c38b..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiLiveTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.templates.BucketAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiLiveTest;
-import org.testng.annotations.Test;
-
-public class BucketAccessControlsApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
-
- protected static final String BUCKET_NAME = "jcloudstestbucketacl" + UUID.randomUUID();
-
- private BucketAccessControlsApi api() {
- return api.getBucketAccessControlsApi();
- }
-
- private void createBucket(String BucketName) {
- BucketTemplate template = new BucketTemplate().name(BucketName);
- Bucket response = api.getBucketApi().createBucket(PROJECT_NUMBER, template);
- assertNotNull(response);
- }
-
- @Test(groups = "live")
- public void testCreateBucketAcl() {
- createBucket(BUCKET_NAME);
- BucketAccessControlsTemplate bucketAcl = BucketAccessControlsTemplate.create("allUsers", Role.READER);
- BucketAccessControls response = api().createBucketAccessControls(BUCKET_NAME, bucketAcl);
-
- assertNotNull(response);
- assertEquals(response.id(), BUCKET_NAME + "/allUsers");
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucketAcl")
- public void testUpdateBucketAcl() {
- BucketAccessControlsTemplate template = BucketAccessControlsTemplate.create("allUsers", Role.WRITER);
- BucketAccessControls response = api().updateBucketAccessControls(BUCKET_NAME, "allUsers", template);
-
- assertNotNull(response);
- assertEquals(response.id(), BUCKET_NAME + "/allUsers");
- assertEquals(response.role(), Role.WRITER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateBucketAcl")
- public void testGetBucketAcl() {
- BucketAccessControls response = api().getBucketAccessControls(BUCKET_NAME, "allUsers");
-
- assertNotNull(response);
- assertEquals(response.id(), BUCKET_NAME + "/allUsers");
- assertEquals(response.role(), Role.WRITER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateBucketAcl")
- public void testListBucketAcl() {
- List<BucketAccessControls> response = api().listBucketAccessControls(BUCKET_NAME);
-
- assertNotNull(response);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateBucketAcl")
- public void testPatchBucketAcl() {
- BucketAccessControlsTemplate template = BucketAccessControlsTemplate.create("allUsers", Role.READER);
- BucketAccessControls response = api().patchBucketAccessControls(BUCKET_NAME, "allUsers", template);
-
- assertNotNull(response);
- assertEquals(response.id(), BUCKET_NAME + "/allUsers");
- assertEquals(response.role(), Role.READER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testPatchBucketAcl")
- public void testDeleteBucketAcl() {
- api().deleteBucketAccessControls(BUCKET_NAME, "allUsers");
- deleteBucket(BUCKET_NAME);
- }
-
- @Test(groups = "live", dependsOnMethods = "testDeleteBucketAcl")
- public void testDeleteNotExistingBucketAccessControls() {
- api().deleteBucketAccessControls(BUCKET_NAME, "allUsers");
- }
-
- private void deleteBucket(String BucketName) {
- api.getBucketApi().deleteBucket(BucketName);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java
deleted file mode 100644
index 5c42617..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiExpectTest;
-import org.jclouds.googlecloudstorage.options.GetBucketOptions;
-import org.jclouds.googlecloudstorage.options.ListOptions;
-import org.jclouds.googlecloudstorage.options.UpdateBucketOptions;
-import org.jclouds.googlecloudstorage.parse.BucketUpdateTest;
-import org.jclouds.googlecloudstorage.parse.NoAclBucketListTest;
-import org.jclouds.googlecloudstorage.parse.NoAclBucketTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "BucketApiExpectTest")
-public class BucketApiExpectTest extends BaseGoogleCloudStorageApiExpectTest {
-
- private static final String EXPECTED_TEST_BUCKET = "bhashbucket";
- private static final String EXPECTED_TEST_PROJECT_NUMBER = "1082289308625";
-
- private static final HttpRequest GET_BUCKET_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/bhashbucket").addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private static final HttpRequest GET_BUCKET_REQUEST_WITHOPTIONS = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/bhashbucket")
- .addQueryParam("ifMetagenerationNotMatch", "100").addQueryParam("projection", "full")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse BUCKET_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/no_acl_bucket.json")).build();
-
- public static final HttpRequest LIST_BUCKET_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b").addQueryParam("project", EXPECTED_TEST_PROJECT_NUMBER)
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- public static final HttpRequest LIST_BUCKET_REQUEST_WITHOPTIONS = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b").addQueryParam("project", EXPECTED_TEST_PROJECT_NUMBER)
- .addQueryParam("maxResults", "2").addQueryParam("pageToken", "jcloudstestbucket500")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse LIST_BUCKET_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/no_acl_bucket_list.json")).build();
-
- // Test getBucket without options
- public void testGetBucketWithNoOptionsResponseIs2xx() throws Exception {
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- GET_BUCKET_REQUEST, BUCKET_RESPONSE).getBucketApi();
-
- assertEquals(api.getBucket(EXPECTED_TEST_BUCKET), new NoAclBucketTest().expected());
- }
-
- public void testGetBucketResponseIs4xx() throws Exception {
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- GET_BUCKET_REQUEST, getResponse).getBucketApi();
-
- assertNull("404", api.getBucket(EXPECTED_TEST_BUCKET));
- }
-
- // Test getBucket with options
- public void testGetBucketWithOptionsResponseIs2xx() throws Exception {
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- GET_BUCKET_REQUEST_WITHOPTIONS, BUCKET_RESPONSE).getBucketApi();
-
- GetBucketOptions options = new GetBucketOptions().ifMetagenerationNotMatch(Long.valueOf(100)).projection(
- Projection.FULL);
- assertEquals(api.getBucket(EXPECTED_TEST_BUCKET, options), new NoAclBucketTest().expected());
- }
-
- // Test listBucket without options
- public void testListBucketWithNoOptionsResponseIs2xx() throws Exception {
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- LIST_BUCKET_REQUEST, LIST_BUCKET_RESPONSE).getBucketApi();
-
- assertEquals(api.listBucket(EXPECTED_TEST_PROJECT_NUMBER), new NoAclBucketListTest().expected());
-
- }
-
- public void testListBucketWithOptionsResponseIs2xx() throws Exception {
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- LIST_BUCKET_REQUEST_WITHOPTIONS, LIST_BUCKET_RESPONSE).getBucketApi();
-
- ListOptions options = new ListOptions().maxResults(2).pageToken("jcloudstestbucket500");
-
- assertEquals(api.listBucket(EXPECTED_TEST_PROJECT_NUMBER, options), new NoAclBucketListTest().expected());
-
- }
-
- @Test(enabled = false)
- public void listBucketEmpty() throws Exception {
- HttpResponse listResponse = null; // TODO: get a copy of an empty bucket response
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READONLY_SCOPE), TOKEN_RESPONSE,
- LIST_BUCKET_REQUEST, listResponse).getBucketApi();
-
- assertTrue(api.listBucket(EXPECTED_TEST_PROJECT_NUMBER).isEmpty());
- }
-
- // Test createBucket without options
- public void testCreateBucketWithNoOptionsResponseIs2xx() throws Exception {
-
- HttpRequest createRequest = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/storage/v1/b")
- .addHeader("Accept", "application/json")
- .addQueryParam("project", EXPECTED_TEST_PROJECT_NUMBER)
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_insert_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_READWRITE_SCOPE), TOKEN_RESPONSE,
- createRequest, BUCKET_RESPONSE).getBucketApi();
-
- BucketTemplate template = new BucketTemplate().name("bhashbucket");
-
- assertEquals(api.createBucket(EXPECTED_TEST_PROJECT_NUMBER, template), new NoAclBucketTest().expected());
-
- }
-
- public void testUpdateBucketWithNoOptionsResponseIs2xx() throws Exception {
-
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(EXPECTED_TEST_BUCKET)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
-
- BucketTemplate template = new BucketTemplate().name(EXPECTED_TEST_BUCKET).addAcl(bucketacl);
-
- HttpRequest updateRequest = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/" + EXPECTED_TEST_BUCKET)
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_update_response.json")).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- updateRequest, updateResponse).getBucketApi();
-
- assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template), new BucketUpdateTest().expected());
- }
-
- public void testUpdateBucketWithOptionsResponseIs2xx() throws Exception {
-
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(EXPECTED_TEST_BUCKET)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
- UpdateBucketOptions options = new UpdateBucketOptions().projection(Projection.NO_ACL).ifMetagenerationNotMatch(
- Long.valueOf(100));
- BucketTemplate template = new BucketTemplate().name(EXPECTED_TEST_BUCKET).addAcl(bucketacl);
-
- HttpRequest updateRequest = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/" + EXPECTED_TEST_BUCKET)
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .addQueryParam("projection", Projection.NO_ACL.toString())
- .addQueryParam("ifMetagenerationNotMatch", "100")
- .payload(payloadFromResourceWithContentType("/bucket_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_update_response.json")).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- updateRequest, updateResponse).getBucketApi();
-
- assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template, options), new BucketUpdateTest().expected());
- }
-
- public void testPatchBucketWithNoOptionsResponseIs2xx() throws Exception {
-
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(EXPECTED_TEST_BUCKET)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
-
- BucketTemplate template = new BucketTemplate().name(EXPECTED_TEST_BUCKET).addAcl(bucketacl);
-
- HttpRequest patchRequest = HttpRequest
- .builder()
- .method("PATCH")
- .endpoint("https://www.googleapis.com/storage/v1/b/" + EXPECTED_TEST_BUCKET)
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/bucket_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse patchResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_update_response.json")).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, patchRequest,
- patchResponse).getBucketApi();
-
- assertEquals(api.patchBucket(EXPECTED_TEST_BUCKET, template), new BucketUpdateTest().expected());
- }
-
- public void testPatchBucketWithOptionsResponseIs2xx() throws Exception {
-
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(EXPECTED_TEST_BUCKET)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
- UpdateBucketOptions options = new UpdateBucketOptions().projection(Projection.NO_ACL).ifMetagenerationNotMatch(
- Long.valueOf(100));
- BucketTemplate template = new BucketTemplate().name(EXPECTED_TEST_BUCKET).addAcl(bucketacl);
-
- HttpRequest patchRequest = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/" + EXPECTED_TEST_BUCKET)
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .addQueryParam("projection", Projection.NO_ACL.toString())
- .addQueryParam("ifMetagenerationNotMatch", "100")
- .payload(payloadFromResourceWithContentType("/bucket_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse patchResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/bucket_update_response.json")).build();
-
- BucketApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE, patchRequest,
- patchResponse).getBucketApi();
-
- assertEquals(api.updateBucket(EXPECTED_TEST_BUCKET, template, options), new BucketUpdateTest().expected());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
deleted file mode 100644
index c59a82f..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertSame;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.Bucket.Cors;
-import org.jclouds.googlecloudstorage.domain.Bucket.Logging;
-import org.jclouds.googlecloudstorage.domain.Bucket.Versioning;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiLiveTest;
-import org.jclouds.googlecloudstorage.options.DeleteBucketOptions;
-import org.jclouds.googlecloudstorage.options.GetBucketOptions;
-import org.jclouds.googlecloudstorage.options.InsertBucketOptions;
-import org.jclouds.googlecloudstorage.options.UpdateBucketOptions;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Lists;
-
-public class BucketApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
-
- // TODO: what removes these buckets?
-
- private static final String BUCKET_NAME = "jcloudstestbucket" + (int) (Math.random() * 10000);
-
- private static final String BUCKET_NAME_STANDARD = "jcloudstestbucketstandard" + (int) (Math.random() * 10000);
-
- private static final String BUCKET_NAME_COLDLINE = "jcloudstestbucketcoldline" + (int) (Math.random() * 10000);
-
- private static final String BUCKET_NAME_MULTI_REGIONAL = "jcloudstestbucketmultiregional" + (int) (Math.random() * 10000);
-
- private static final String BUCKET_NAME_NEARLINE = "jcloudstestbucketnearline" + (int) (Math.random() * 10000);
-
- private static final String BUCKET_NAME_WITHOPTIONS = "jcloudstestbucketoptions" + (int) (Math.random() * 10000);
-
- private static final String LOG_BUCKET_NAME = "jcloudslogbucket" + (int) (Math.random() * 10000);
-
- private Long metageneration;
-
- private BucketApi api() {
- return api.getBucketApi();
- }
-
- // TODO: should this test use STANDARD storage class?
- @Test(groups = "live")
- public void testCreateBucket() {
-
- BucketTemplate logTemplate = new BucketTemplate().name(LOG_BUCKET_NAME);
- Bucket logResponse = api().createBucket(PROJECT_NUMBER, logTemplate);
- assertNotNull(logResponse);
-
- BucketAccessControls acl = BucketAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers").role(Role.OWNER)
- .build();
- ObjectAccessControls oac = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
- Cors cors = Cors.create(Arrays.asList("http://example.appspot.com"), Arrays.asList("GET", "HEAD"),
- Arrays.asList("x-meta-goog-custom"), 10);
- Versioning version = Versioning.create(true);
-
- Logging log = Logging.create(LOG_BUCKET_NAME, BUCKET_NAME);
-
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME).addAcl(acl).addDefaultObjectAccessControls(oac)
- .versioning(version).location(Location.US_CENTRAL2).logging(log)
- .storageClass(StorageClass.DURABLE_REDUCED_AVAILABILITY).addCORS(cors);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template);
-
- assertNotNull(response);
- assertNotNull(response.cors());
- assertTrue(response.cors().size() == 1);
- assertEquals(response.name(), BUCKET_NAME);
- assertEquals(response.location(), Location.US_CENTRAL2);
- assertThat(response.storageClass()).isEqualTo(StorageClass.DURABLE_REDUCED_AVAILABILITY);
- assertTrue(response.versioning().enabled());
- }
-
- @Test(groups = "live")
- public void testCreateBucketStandard() {
- BucketTemplate template = new BucketTemplate()
- .name(BUCKET_NAME_STANDARD)
- .location(Location.US)
- .storageClass(StorageClass.STANDARD);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME_STANDARD);
- assertEquals(response.location(), Location.US);
- assertThat(response.storageClass()).isEqualTo(StorageClass.STANDARD);
-
- api().deleteBucket(BUCKET_NAME_STANDARD);
- }
-
- @Test(groups = "live")
- public void testCreateBucketColdline() {
- BucketTemplate template = new BucketTemplate()
- .name(BUCKET_NAME_COLDLINE)
- .location(Location.US)
- .storageClass(StorageClass.COLDLINE);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME_COLDLINE);
- assertEquals(response.location(), Location.US);
- assertThat(response.storageClass()).isEqualTo(StorageClass.COLDLINE);
-
- api().deleteBucket(BUCKET_NAME_COLDLINE);
- }
-
- @Test(groups = "live")
- public void testCreateBucketMultiregional() {
- BucketTemplate template = new BucketTemplate()
- .name(BUCKET_NAME_MULTI_REGIONAL)
- .location(Location.US)
- .storageClass(StorageClass.MULTI_REGIONAL);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME_MULTI_REGIONAL);
- assertEquals(response.location(), Location.US);
- assertThat(response.storageClass()).isEqualTo(StorageClass.MULTI_REGIONAL);
-
- api().deleteBucket(BUCKET_NAME_NEARLINE);
- }
-
- @Test(groups = "live")
- public void testCreateBucketNearline() {
- BucketTemplate template = new BucketTemplate()
- .name(BUCKET_NAME_NEARLINE)
- .location(Location.US)
- .storageClass(StorageClass.NEARLINE);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME_NEARLINE);
- assertEquals(response.location(), Location.US);
- assertThat(response.storageClass()).isEqualTo(StorageClass.NEARLINE);
-
- api().deleteBucket(BUCKET_NAME_NEARLINE);
- }
-
- @Test(groups = "live", dependsOnMethods = { "testCreateBucket" })
- public void testCreateAlreadyExistBucket() {
-
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME).location(Location.US_CENTRAL2)
- .storageClass(StorageClass.DURABLE_REDUCED_AVAILABILITY);
-
- assertNull(api().createBucket(PROJECT_NUMBER, template));
- }
-
- @Test(groups = "live")
- public void testCreateBucketWithOptions() {
- ObjectAccessControls oac = ObjectAccessControls.builder().bucket(BUCKET_NAME_WITHOPTIONS)
- .entity("allUsers").role(ObjectRole.OWNER).build();
- Cors cors = Cors.create(Arrays.asList("http://example.appspot.com"), Arrays.asList("GET", "HEAD"),
- Arrays.asList("x-meta-goog-custom"), 10);
- Versioning version = Versioning.create(true);
-
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME_WITHOPTIONS).addDefaultObjectAccessControls(oac)
- .versioning(version).location(Location.US_CENTRAL2)
- .storageClass(StorageClass.DURABLE_REDUCED_AVAILABILITY).addCORS(cors);
-
- InsertBucketOptions options = new InsertBucketOptions().projection(Projection.FULL);
-
- Bucket response = api().createBucket(PROJECT_NUMBER, template, options);
-
- assertNotNull(response);
- assertNotNull(response.cors());
- assertEquals(response.name(), BUCKET_NAME_WITHOPTIONS);
- assertEquals(response.location(), Location.US_CENTRAL2);
- assertTrue(response.versioning().enabled());
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucket")
- public void testUpdateBucket() {
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(BUCKET_NAME)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME).addAcl(bucketacl);
- Bucket response = api().updateBucket(BUCKET_NAME, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME);
- assertNotNull(response.acl());
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucketWithOptions")
- public void testUpdateBucketWithOptions() {
- BucketAccessControls bucketacl = BucketAccessControls.builder().bucket(BUCKET_NAME_WITHOPTIONS)
- .entity("allAuthenticatedUsers").role(Role.OWNER).build();
- UpdateBucketOptions options = new UpdateBucketOptions().projection(Projection.FULL);
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME_WITHOPTIONS).addAcl(bucketacl);
- Bucket response = api().updateBucket(BUCKET_NAME_WITHOPTIONS, template, options);
-
- assertNotNull(response);
-
- metageneration = response.metageneration();
-
- assertEquals(response.name(), BUCKET_NAME_WITHOPTIONS);
- assertNotNull(response.acl());
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucket")
- public void testGetBucket() {
- Bucket response = api().getBucket(BUCKET_NAME);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateBucketWithOptions")
- public void testGetBucketWithOptions() {
- GetBucketOptions options = new GetBucketOptions().ifMetagenerationMatch(metageneration);
- Bucket response = api().getBucket(BUCKET_NAME_WITHOPTIONS, options);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME_WITHOPTIONS);
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucket")
- public void testListBucket() {
- ListPage<Bucket> bucket = api().listBucket(PROJECT_NUMBER);
-
- Iterator<Bucket> pageIterator = bucket.iterator();
- assertTrue(pageIterator.hasNext());
-
- Bucket iteratedBucket = pageIterator.next();
- List<Bucket> bucketAsList = Lists.newArrayList(iteratedBucket);
-
- assertNotNull(iteratedBucket);
- assertSame(bucketAsList.size(), 1);
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateBucket")
- public void testPatchBucket() {
- Logging logging = Logging.create(LOG_BUCKET_NAME, BUCKET_NAME);
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME).logging(logging);
-
- Bucket response = api().patchBucket(BUCKET_NAME, template);
-
- assertNotNull(response);
- assertEquals(response.name(), BUCKET_NAME);
- assertEquals(response.logging().logBucket(), LOG_BUCKET_NAME);
- }
-
- @Test(groups = "live", dependsOnMethods = { "testListBucket", "testGetBucket", "testUpdateBucket" })
- public void testDeleteBucket() {
- assertTrue(api().deleteBucket(BUCKET_NAME));
- assertTrue(api().deleteBucket(LOG_BUCKET_NAME));
- }
-
- @Test(groups = "live", dependsOnMethods = { "testDeleteBucket" })
- public void testDeleteNotExistingBucket() {
- assertFalse(api().deleteBucket(BUCKET_NAME));
- }
-
- @Test(groups = "live", dependsOnMethods = { "testGetBucketWithOptions" })
- public void testDeleteBucketWithOptions() {
-
- DeleteBucketOptions options = new DeleteBucketOptions().ifMetagenerationMatch(metageneration)
- .ifMetagenerationNotMatch(metageneration + 1);
-
- api().deleteBucket(BUCKET_NAME_WITHOPTIONS, options);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiExpectTest.java
deleted file mode 100644
index 42804be..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiExpectTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiExpectTest;
-import org.jclouds.googlecloudstorage.parse.DefaultObjectAclGetTest;
-import org.jclouds.googlecloudstorage.parse.DefaultObjectAclInsertTest;
-import org.jclouds.googlecloudstorage.parse.DefaultObjectAclListTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "DefaultObjectAccessControlsApiExpectTest")
-public class DefaultObjectAccessControlsApiExpectTest extends BaseGoogleCloudStorageApiExpectTest {
-
- private static final String EXPECTED_TEST_BUCKET = "jcloudstestbucket";
- private static final String EXPECTED_TEST_GROUP_ENTITY = "group-00b4903a971ec6cff233284d6d24f5bf5cba904c4ade4d43ebd6a5d33800e68b";
-
- private static final HttpRequest GET_DEFAULT_OBJECT_ACL_REQUEST = HttpRequest
- .builder()
- .method("GET")
- .endpoint(
- "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/group-00b4903a971ec6cff233284d6d24f5bf5cba904c4ade4d43ebd6a5d33800e68b")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse GET_DEFAULT_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_get.json")).build();
-
- private final HttpResponse CREATE_DEFAULT_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_insert_response.json")).build();
-
- public final HttpRequest LIST_DEFAULT_OBJECT_ACL_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- private final HttpResponse LIST_DEFAULT_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_list.json")).build();
-
- // Test getDefaultObjectAccessControls
- public void testGetDefaultObjectAclResponseIs2xx() throws Exception {
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, GET_DEFAULT_OBJECT_ACL_REQUEST, GET_DEFAULT_OBJECT_ACL_RESPONSE)
- .getDefaultObjectAccessControlsApi();
-
- assertEquals(api.getDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_GROUP_ENTITY),
- new DefaultObjectAclGetTest().expected());
- }
-
- public void testGetDefaultObjectAclResponseIs4xx() throws Exception {
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, GET_DEFAULT_OBJECT_ACL_REQUEST, getResponse).getDefaultObjectAccessControlsApi();
-
- assertNull(api.getDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_GROUP_ENTITY));
- }
-
- // Test listDefaultObjectAccessControls
- public void testListDefaultObjectAclWithNoOptionsResponseIs2xx() throws Exception {
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, LIST_DEFAULT_OBJECT_ACL_REQUEST, LIST_DEFAULT_OBJECT_ACL_RESPONSE)
- .getDefaultObjectAccessControlsApi();
-
- assertEquals(api.listDefaultObjectAccessControls(EXPECTED_TEST_BUCKET), new DefaultObjectAclListTest().expected());
- }
-
- public void testListDefaultObjectAclResponseIs4xx() throws Exception {
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, LIST_DEFAULT_OBJECT_ACL_REQUEST, listResponse).getDefaultObjectAccessControlsApi();
-
- assertNull(api.listDefaultObjectAccessControls(EXPECTED_TEST_BUCKET));
- }
-
- // Test insertDefaultObjectAccessControls
- public void testInsertDefaultObjectAclResponseIs2xx() throws Exception {
- HttpRequest insertRequest = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/default_object_acl_insert_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, insertRequest, CREATE_DEFAULT_OBJECT_ACL_RESPONSE).getDefaultObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", ObjectRole.OWNER);
-
- assertEquals(api.createDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, template),
- new DefaultObjectAclInsertTest().expected());
- }
-
- // Test deleteDefaultObjectAccessControls
- public void testDeleteDefaultObjectAclResponseIs2xx() throws Exception {
- HttpRequest delete = HttpRequest.builder().method("DELETE")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/allUsers")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- HttpResponse deleteResponse = HttpResponse.builder().statusCode(204).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDefaultObjectAccessControlsApi();
-
- assertEquals(api.deleteDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, "allUsers"), deleteResponse);
- }
-
- public void testDeleteObjectAclResponseIs4xx() throws Exception {
- HttpRequest delete = HttpRequest.builder().method("DELETE")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/allUsers")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, delete, deleteResponse).getDefaultObjectAccessControlsApi();
-
- assertNull(api.deleteDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, "allUsers"));
- }
-
- // Test updateDefaultObjectAccessControls
- public void testUpdateDefaultObjectAclWithNoOptionsResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/default_object_acl_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_update_initial.json")).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, update, updateResponse).getDefaultObjectAccessControlsApi();
-
- ObjectAccessControls options = ObjectAccessControls.builder().entity("allUsers").role(ObjectRole.OWNER).build();
-
- assertEquals(api.updateDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, "allUsers", options),
- new DefaultObjectAclInsertTest().expected());
- }
-
- // Test updateDefaultObjectAccessControls
- public void testUpdateDefaultObjectAclWithOptionsResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .addQueryParam("role", ObjectRole.OWNER.toString())
- .payload(payloadFromResourceWithContentType("/default_object_acl_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_update_initial.json")).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, update, updateResponse).getDefaultObjectAccessControlsApi();
-
- ObjectAccessControls options = ObjectAccessControls.builder().entity("allUsers").role(ObjectRole.OWNER).build();
-
- assertEquals(api.updateDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, "allUsers", options, ObjectRole.OWNER),
- new DefaultObjectAclInsertTest().expected());
- }
-
- // Test patchDefaultObjectAccessControls
- public void testPatchDefaultObjectAclWithNoOptionsResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PATCH")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/defaultObjectAcl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/default_object_acl_update_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/default_object_acl_update_initial.json")).build();
-
- DefaultObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE),
- TOKEN_RESPONSE, update, updateResponse).getDefaultObjectAccessControlsApi();
-
- ObjectAccessControls options = ObjectAccessControls.builder().entity("allUsers").role(ObjectRole.OWNER).build();
-
- assertEquals(api.patchDefaultObjectAccessControls(EXPECTED_TEST_BUCKET, "allUsers", options),
- new DefaultObjectAclInsertTest().expected());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiLiveTest.java
deleted file mode 100644
index d2697d4..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiLiveTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiLiveTest;
-import org.testng.annotations.Test;
-
-public class DefaultObjectAccessControlsApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
-
- protected static final String BUCKET_NAME = "jcloudsdefaultoacltest" + UUID.randomUUID();
-
- private DefaultObjectAccessControlsApi api() {
- return api.getDefaultObjectAccessControlsApi();
- }
-
- private void createBucket(String BucketName) {
- BucketTemplate template = new BucketTemplate().name(BucketName);
- Bucket response = api.getBucketApi().createBucket(PROJECT_NUMBER, template);
- assertNotNull(response);
- }
-
- @Test(groups = "live")
- public void testCreateDefaultObjectAcl() {
- createBucket(BUCKET_NAME);
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", ObjectRole.READER);
-
- ObjectAccessControls response = api().createDefaultObjectAccessControls(BUCKET_NAME, template);
-
- assertNotNull(response);
- assertEquals(response.entity(), "allUsers");
- assertEquals(response.role(), ObjectRole.READER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testCreateDefaultObjectAcl")
- public void testUpdateDefaultObjectAcl() {
- ObjectAccessControls defaultObjectAcl = ObjectAccessControls.builder().bucket(BUCKET_NAME)
- .entity("allUsers").role(ObjectRole.OWNER).build();
- ObjectAccessControls response = api().updateDefaultObjectAccessControls(BUCKET_NAME, "allUsers", defaultObjectAcl);
-
- assertNotNull(response);
- assertEquals(response.entity(), "allUsers");
- assertEquals(response.role(), ObjectRole.OWNER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateDefaultObjectAcl")
- public void testGetDefaultObjectAcl() {
- ObjectAccessControls response = api().getDefaultObjectAccessControls(BUCKET_NAME, "allUsers");
-
- assertNotNull(response);
- assertEquals(response.entity(), "allUsers");
- assertEquals(response.role(), ObjectRole.OWNER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateDefaultObjectAcl")
- public void testListDefaultObjectAcl() {
- List<ObjectAccessControls> response = api().listDefaultObjectAccessControls(BUCKET_NAME);
- assertNotNull(response);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateDefaultObjectAcl")
- public void testPatchDefaultObjectAcl() {
- ObjectAccessControls defaultObjectAcl = ObjectAccessControls.builder().bucket(BUCKET_NAME)
- .entity("allUsers").role(ObjectRole.READER).build();
- ObjectAccessControls response = api().patchDefaultObjectAccessControls(BUCKET_NAME, "allUsers", defaultObjectAcl);
-
- assertNotNull(response);
- assertEquals(response.entity(), "allUsers");
- assertEquals(response.role(), ObjectRole.READER);
- }
-
- @Test(groups = "live", dependsOnMethods = "testPatchDefaultObjectAcl")
- public void testDeleteBucketAcl() {
- api().deleteDefaultObjectAccessControls(BUCKET_NAME, "allUsers");
- deleteBucket(BUCKET_NAME);
- }
-
- @Test(groups = "live", dependsOnMethods = "testDeleteBucketAcl")
- public void testDeleteNotExistingBucketAccessControls() {
- api().deleteDefaultObjectAccessControls(BUCKET_NAME, "allUsers");
- }
-
- private void deleteBucket(String bucketName) {
- api.getBucketApi().deleteBucket(bucketName);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApiExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApiExpectTest.java
deleted file mode 100644
index abf6010..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApiExpectTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole.OWNER;
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertNull;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiExpectTest;
-import org.jclouds.googlecloudstorage.parse.ObjectAclGetTest;
-import org.jclouds.googlecloudstorage.parse.ObjectAclInsertTest;
-import org.jclouds.googlecloudstorage.parse.ObjectAclListTest;
-import org.jclouds.googlecloudstorage.parse.ObjectAclUpdateTest;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ObjectAccessControlsApiExpectTest")
-public class ObjectAccessControlsApiExpectTest extends BaseGoogleCloudStorageApiExpectTest {
-
- private static final String EXPECTED_TEST_BUCKET = "jcloudstestbucket";
- private static final String EXPECTED_TEST_OBJECT = "foo.txt";
- private static final String EXPECTED_TEST_GROUP_ENTITY = "group-00b4903a971ec6cff233284d6d24f5bf5cba904c4ade4d43ebd6a5d33800e68b";
- private static final String EXPECTED_TEST_USER_ENTITY = "user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d";
-
- public static final HttpRequest GET_OBJECT_ACL_REQUEST = HttpRequest
- .builder()
- .method("GET")
- .endpoint(
- "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/group-00b4903a971ec6cff233284d6d24f5bf5cba904c4ade4d43ebd6a5d33800e68b")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- public static final HttpRequest GET_OBJECT_ACL_REQUEST_WITHOPTIONS = HttpRequest
- .builder()
- .method("GET")
- .endpoint(
- "https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/group-00b4903a971ec6cff233284d6d24f5bf5cba904c4ade4d43ebd6a5d33800e68b")
- .addQueryParam("generation", "100").addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
-
- public final HttpResponse GET_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_get.json")).build();
-
- public final HttpResponse CREATE_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_insert_response.json")).build();
-
- public final HttpRequest LIST_OBJECT_ACL_REQUEST = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl")
- .addHeader("Accept", "application/json").addHeader("Authorization", "Bearer " + TOKEN).build();
-
- public final HttpRequest LIST_OBJECT_ACL_REQUEST_WITHOPTIONS = HttpRequest.builder().method("GET")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl")
- .addQueryParam("generation", "100").addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN).build();
-
- public final HttpResponse LIST_OBJECT_ACL_RESPONSE = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_list.json")).build();
-
- // Test getObjectAccessControls
- public void testGetObjectaclWithNoOptionsResponseIs2xx() throws Exception {
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- GET_OBJECT_ACL_REQUEST, GET_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- assertEquals(api.getObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, EXPECTED_TEST_GROUP_ENTITY),
- new ObjectAclGetTest().expected());
- }
-
- public void testGetObjectaclWithOptionsResponseIs2xx() throws Exception {
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- GET_OBJECT_ACL_REQUEST_WITHOPTIONS, GET_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- assertEquals(
- api.getObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, EXPECTED_TEST_GROUP_ENTITY,
- Long.valueOf(100)), new ObjectAclGetTest().expected());
- }
-
- public void testGetObjectaclResponseIs4xx() throws Exception {
-
- HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- GET_OBJECT_ACL_REQUEST, getResponse).getObjectAccessControlsApi();
-
- assertNull(api.getObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, EXPECTED_TEST_GROUP_ENTITY));
- }
-
- // Test listObjectAccessControls
- public void testListObjectaclWithNoOptionsResponseIs2xx() throws Exception {
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- LIST_OBJECT_ACL_REQUEST, LIST_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- assertEquals(api.listObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT),
- new ObjectAclListTest().expected());
-
- }
-
- // Test listObjectAccessControls
- public void testListObjectaclWithOptionsResponseIs2xx() throws Exception {
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- LIST_OBJECT_ACL_REQUEST_WITHOPTIONS, LIST_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- assertEquals(api.listObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, Long.valueOf(100)),
- new ObjectAclListTest().expected());
-
- }
-
- public void testListObjectaclResponseIs4xx() throws Exception {
-
- HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- LIST_OBJECT_ACL_REQUEST, listResponse).getObjectAccessControlsApi();
-
- assertNull(api.listObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT));
- }
-
- // Test insertObjectAccessControls
- public void testInsertObjectaclWithNoOptionsResponseIs2xx() throws Exception {
- HttpRequest insertRequest = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/object_acl_insert_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- insertRequest, CREATE_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create(EXPECTED_TEST_USER_ENTITY, OWNER);
-
- assertEquals(api.createObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, template),
- new ObjectAclInsertTest().expected());
-
- }
-
- public void testInsertObjectaclWithOptionsResponseIs2xx() throws Exception {
- HttpRequest insertRequest = HttpRequest
- .builder()
- .method("POST")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .addQueryParam("generation", "100")
- .payload(payloadFromResourceWithContentType("/object_acl_insert_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- insertRequest, CREATE_OBJECT_ACL_RESPONSE).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate
- .create("user-00b4903a97adfde729f0650133a7379693099d8d85d6b1b18255ca70bf89e31d", OWNER);
-
- assertEquals(
- api.createObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, template, Long.valueOf(100)),
- new ObjectAclInsertTest().expected());
-
- }
-
- // Test updateObjectAccessControls
- public void testUpdateObjectaclWithNoOptionsResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/object_acl_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_update_initial.json")).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- update, updateResponse).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", OWNER);
-
- assertEquals(api.updateObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, "allUsers", template),
- new ObjectAclUpdateTest().expected());
- }
-
- public void testUpdateObjectaclWithOptionsResponseIs2xx() throws Exception {
- HttpRequest update = HttpRequest
- .builder()
- .method("PUT")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers")
- .addQueryParam("generation", "100")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/object_acl_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse updateResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_update_initial.json")).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- update, updateResponse).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", OWNER);
-
- assertEquals(
- api.updateObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, "allUsers", template,
- Long.valueOf(100)), new ObjectAclUpdateTest().expected());
- }
-
- // Test updateObjectAccessControls
- public void testPatchObjectaclWithNoOptionsResponseIs2xx() throws Exception {
- HttpRequest patchRequest = HttpRequest
- .builder()
- .method("PATCH")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/object_acl_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse patchResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_update_initial.json")).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- patchRequest, patchResponse).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", OWNER);
-
- assertEquals(api.patchObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, "allUsers", template),
- new ObjectAclUpdateTest().expected());
- }
-
- public void testPatchObjectaclWithOptionsResponseIs2xx() throws Exception {
- HttpRequest patchRequest = HttpRequest
- .builder()
- .method("PATCH")
- .endpoint("https://www.googleapis.com/storage/v1/b/jcloudstestbucket/o/foo.txt/acl/allUsers")
- .addQueryParam("generation", "100")
- .addHeader("Accept", "application/json")
- .addHeader("Authorization", "Bearer " + TOKEN)
- .payload(payloadFromResourceWithContentType("/object_acl_request_payload.json",
- MediaType.APPLICATION_JSON)).build();
-
- HttpResponse patchResponse = HttpResponse.builder().statusCode(200)
- .payload(staticPayloadFromResource("/object_acl_update_initial.json")).build();
-
- ObjectAccessControlsApi api = requestsSendResponses(requestForScopes(STORAGE_FULLCONTROL_SCOPE), TOKEN_RESPONSE,
- patchRequest, patchResponse).getObjectAccessControlsApi();
-
- ObjectAccessControlsTemplate template = ObjectAccessControlsTemplate.create("allUsers", OWNER);
- assertEquals(
- api.patchObjectAccessControls(EXPECTED_TEST_BUCKET, EXPECTED_TEST_OBJECT, "allUsers", template,
- Long.valueOf(100)), new ObjectAclUpdateTest().expected());
- }
-
-}
[5/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java
deleted file mode 100644
index 8636625..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
-import org.jclouds.googlecloud.domain.ListPage;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageFallbacks.NullOnBucketAlreadyExists;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.options.DeleteBucketOptions;
-import org.jclouds.googlecloudstorage.options.GetBucketOptions;
-import org.jclouds.googlecloudstorage.options.InsertBucketOptions;
-import org.jclouds.googlecloudstorage.options.ListOptions;
-import org.jclouds.googlecloudstorage.options.UpdateBucketOptions;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides access to Bucket entities via their REST API.
- *
- * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/buckets"/>
- */
-
-@SkipEncoding({ '/', '=' })
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface BucketApi {
-
- /**
- * Check the existence of a bucket
- *
- * @param bucketName
- * Name of the bucket
- *
- * @return a {@link Bucket} true if bucket exist
- */
- @Named("Bucket:get")
- @GET
- @Path("/b/{bucket}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean bucketExist(@PathParam("bucket") String bucketName);
-
- /**
- * Returns metadata for the specified bucket.
- *
- * @param bucketName
- * Name of the bucket
- *
- * @return a {@link Bucket} resource
- */
- @Named("Bucket:get")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- Bucket getBucket(@PathParam("bucket") String bucketName);
-
- /**
- * Returns metadata for the specified bucket
- *
- * @param bucketName
- * Name of the bucket
- * @param options
- * Supply {@link GetBucketOptions} with optional query parameters
- *
- * @return a {@link Bucket} resource
- */
- @Named("Bucket:get")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- Bucket getBucket(@PathParam("bucket") String bucketName, GetBucketOptions options);
-
- /**
- * Creates a new bucket
- *
- * @param projectId
- * A valid API project identifier
- * @param bucketTemplate
- * supply a {@link BucketTemplate} resource
- *
- * @return If successful, this method returns a {@link Bucket} resource.
- */
- @Named("Bucket:insert")
- @POST
- @Path("/b")
- @Fallback(NullOnBucketAlreadyExists.class)
- Bucket createBucket(@QueryParam("project") String projectId, @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate);
-
- /**
- * Creates a new Bucket
- *
- * @param projectId
- * A valid API project identifier
- *
- * @param bucketTemplate
- * Supply a {@link BucketTemplate} resource
- * @param options
- * Supply {@link InsertBucketOptions} with optional query parameters
- *
- * @return If successful, this method returns a {@link Bucket} resource.
- */
- @Named("Bucket:insert")
- @POST
- @Path("/b")
- @Fallback(NullOnKeyAlreadyExists.class)
- Bucket createBucket(@QueryParam("project") String projectId,
- @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, InsertBucketOptions options);
-
- /**
- * Permanently deletes an empty Bucket.If bucket is not empty 409 error to indicate the conflict.
- *
- * @param bucketName
- * Name of the bucket
- */
- @Named("Bucket:delete")
- @DELETE
- @Path("/b/{bucket}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean deleteBucket(@PathParam("bucket") String bucketName);
-
- /**
- * Permanently deletes an empty Bucket.If bucket is not empty 409 error to indicate the conflict.
- *
- * @param bucketName
- * Name of the bucket
- * @param options
- * Supply {@link DeleteBucketOptions} with optional query parameters
- */
- @Named("Bucket:delete")
- @DELETE
- @Path("/b/{bucket}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean deleteBucket(@PathParam("bucket") String bucketName, DeleteBucketOptions options);
-
- /**
- * Retrieves a list of buckets for a given project
- *
- * @param projectId
- * A valid API project identifier
- *
- * @return a {@link ListPage<Bucket>}
- */
- @Named("Bucket:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b")
- ListPage<Bucket> listBucket(@QueryParam("project") String projectId);
-
- /**
- * Retrieves a list of buckets for a given project
- *
- * @param projectId
- * A valid API project identifier
- * @param options
- * Supply {@link ListOptions} with optional query parameters
- */
- @Named("Bucket:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b")
- ListPage<Bucket> listBucket(@QueryParam("project") String projectId, ListOptions options);
-
- /**
- * Updates a bucket
- *
- * @param bucketName
- * Name of the bucket
- * @param bucketTemplate
- * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls}
- *
- * @return If successful, this method returns the updated {@link Bucket} resource.
- */
- @Named("Bucket:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- Bucket updateBucket(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate);
-
- /**
- * Updates a bucket
- *
- * @param bucketName
- * Name of the bucket
- * @param bucketTemplate
- * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls}
- * @param options
- * Supply {@link UpdateBucketOptions} with optional query parameters
- *
- * @return If successful,this method returns the updated {@link Bucket} resource.
- */
- @Named("Bucket:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- Bucket updateBucket(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, UpdateBucketOptions options);
-
- /**
- * Updates a bucket supporting patch semantics.
- *
- * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/how-tos/performance#patch"/>
- *
- * @param bucketName
- * Name of the bucket
- * @param bucketTemplate
- * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls}
- *
- * @return If successful, this method returns the updated {@link Bucket} resource.
- */
- @Named("Bucket:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- Bucket patchBucket(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate);
-
- /**
- * Updates a bucket supporting patch semantics.
- *
- * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/how-tos/performance#patch"/>
- *
- * @param bucketName
- * Name of the bucket
- * @param bucketTemplate
- * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls}
- * @param options
- * Supply {@link UpdateBucketOptions} with optional query parameters
- *
- * @return If successful, this method returns the updated {@link Bucket} resource.
- */
- @Named("Bucket:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}")
- @Fallback(NullOnNotFoundOr404.class)
- Bucket patchBucket(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, UpdateBucketOptions options);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java
deleted file mode 100644
index 8ec7e6a..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.util.List;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides access to DefaultObjectAccessControl entities via their REST API.
- *
- * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/defaultObjectAccessControls"/>
- */
-
-@SkipEncoding({ '/', '=' })
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface DefaultObjectAccessControlsApi {
-
- /**
- * Returns the ACL entry for the specified entity on the specified object.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- *
- * @return an DefaultObjectAccessControls resource
- */
- @Named("DefaultObjectAccessControls:get")
- @GET
- @Path("/b/{bucket}/defaultObjectAcl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- ObjectAccessControls getDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity);
-
- /**
- * Creates a new ACL entry for specified object
- *
- * @param bucketName
- * Name of the bucket of that ACL to be created In the request body, supply a DefaultObjectAccessControls
- * resource with the following properties
- *
- * @return If successful, this method returns a DefaultObjectAccessControls resource
- */
- @Named("DefaultObjectAccessControls:insert")
- @POST
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/defaultObjectAcl")
- ObjectAccessControls createDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template);
-
- /**
- * Permanently deletes the DefaultObjectAcessControl entry for the specified entity on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- *
- * @return If successful, this method returns an empty response body
- */
- @Named("DefaultObjectAccessControls:delete")
- @DELETE
- @Path("/b/{bucket}/defaultObjectAcl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- HttpResponse deleteDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity);
-
- /**
- * Retrieves ACL entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- *
- * @return ListObjectAccessControls resource
- *
- */
- @Named("DefaultObjectAccessControls:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/defaultObjectAcl")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- @SelectJson("items")
- List<ObjectAccessControls> listDefaultObjectAccessControls(@PathParam("bucket") String bucketName);
-
- /**
- * Retrieves ACL entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- *
- * @return DefaultObjectAccessControls resource
- *
- */
- @Named("DefaultObjectAccessControls:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/defaultObjectAcl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- ObjectAccessControls updateDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload);
-
- /**
- * Retrieves ACL entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- */
- @Named("DefaultObjectAccessControls:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/defaultObjectAcl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- ObjectAccessControls updateDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload,
- @QueryParam("role") ObjectRole role);
-
- /**
- * Retrieves ACL entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- */
- @Named("DefaultObjectAccessControls:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/defaultObjectAcl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- ObjectAccessControls patchDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java
deleted file mode 100644
index 32b5e7c..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.util.List;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.Encoded;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides access to ObjectAccessControl entities via their REST API.
- *
- * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/objectAccessControls "/>
- */
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface ObjectAccessControlsApi {
-
- /**
- * Returns the acl entry for the specified entity on the specified object.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the bucket of that acl is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- *
- * @return an {@link ObjectAccessControls }
- */
-
- @Named("ObjectAccessControls:get")
- @GET
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- ObjectAccessControls getObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity);
-
- /**
- * Returns the acl entry for the specified entity on the specified object.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the object of that acl is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- * @param generation
- * If present, selects a specific revision of this object
- *
- * @return an {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:get")
- @GET
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- ObjectAccessControls getObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @QueryParam("generation") Long generation);
-
- /**
- * Creates a new acl entry for specified object
- *
- * @param bucketName
- * Name of the bucket of that acl to be created In the request body, supply a ObjectAccessControls resource
- * with the following properties
- * @param objectName
- * Name of the bucket of that acl is related
- *
- * @return an {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:insert")
- @POST
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl")
- ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template);
-
- /**
- * Creates a new acl entry for specified object
- *
- * @param bucketName
- * Name of the bucket of that acl to be created In the request body, supply a ObjectAccessControls resource
- * with the following properties
- * @param objectName
- * Name of the bucket of that acl is related
- * @param generation
- * If present, selects a specific revision of this object
- *
- * @return an {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:insert")
- @POST
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl")
- ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template,
- @QueryParam("generation") Long generation);
-
- /**
- * Permanently deletes the acl entry for the specified entity on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the bucket of which acl is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- */
- @Named("ObjectAccessControls:delete")
- @DELETE
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- void deleteObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity);
-
- /**
- * Permanently deletes the acl entry for the specified entity on the specified bucket.
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the bucket of that acl is related
- * @param generation
- * If present, selects a specific revision of this object
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- */
- @Named("ObjectAccessControls:delete")
- @DELETE
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- void deleteObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @QueryParam("generation") Long generation);
-
- /**
- * Retrieves acl entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the bucket of that acl is related
- */
- @Named("ObjectAccessControls:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl")
- @SelectJson("items")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- List<ObjectAccessControls> listObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName);
-
- /**
- * Retrieves acl entries on a specified object
- *
- * @param bucketName
- * Name of the bucket which contains the object
- * @param objectName
- * Name of the bucket of that acl is related
- * @param generation
- * If present, selects a specific revision of this object
- *
- */
- @Named("ObjectAccessControls:list")
- @GET
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl")
- @SelectJson("items")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- List<ObjectAccessControls> listObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @QueryParam("generation") Long generation);
-
- /**
- * Updates an acl entry on the specified object
- *
- * @param bucketName
- * Name of the bucket of which contains the object
- * @param objectName
- * Name of the object which acl is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers.
- * @param template
- * Supply an {@link ObjectAccessControlsTemplate}
- *
- * @return an {@link ObjectAccessControls }
- */
-
- @Named("ObjectAccessControls:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- ObjectAccessControls updateObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template);
-
- /**
- * Updates an acl entry on the specified object
- *
- * @param bucketName
- * Name of the bucket of which contains the object
- * @param objectName
- * Name of the object which acl is related *
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- * @param template
- * Supply an {@link ObjectAccessControlsTemplate}
- * @param generation
- * If present, selects a specific revision of this object
- *
- * @return {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:update")
- @PUT
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- ObjectAccessControls updateObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template,
- @QueryParam("generation") Long generation);
-
- /**
- * Updates an acl entry on the specified object
- *
- * @param bucketName
- * Name of the bucket of which contains the object
- * @param objectName
- * Name of the object which acl is related
- * @param template
- * Supply an {@link ObjectAccessControlsTemplate}
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers.
- *
- * @return an {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- ObjectAccessControls patchObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template);
-
- /**
- * Updates an acl entry on the specified object
- *
- * @param bucketName
- * Name of the bucket of which contains the object
- * @param objectName
- * Name of the object which acl is related
- * @param entity
- * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId,
- * group-emailAddress, allUsers, or allAuthenticatedUsers
- * @param template
- * Supply an {@link ObjectAccessControlsTemplate}
- * @param generation
- * If present, selects a specific revision of this object
- *
- * @return {@link ObjectAccessControls }
- */
- @Named("ObjectAccessControls:patch")
- @PATCH
- @Produces(APPLICATION_JSON)
- @Path("/b/{bucket}/o/{object}/acl/{entity}")
- ObjectAccessControls patchObjectAccessControls(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity,
- @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template,
- @QueryParam("generation") Long generation);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java
deleted file mode 100644
index b750406..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.Encoded;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.googlecloudstorage.binders.MultipartUploadBinder;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
-import org.jclouds.googlecloudstorage.domain.RewriteResponse;
-import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.options.ComposeObjectOptions;
-import org.jclouds.googlecloudstorage.options.CopyObjectOptions;
-import org.jclouds.googlecloudstorage.options.DeleteObjectOptions;
-import org.jclouds.googlecloudstorage.options.GetObjectOptions;
-import org.jclouds.googlecloudstorage.options.InsertObjectOptions;
-import org.jclouds.googlecloudstorage.options.ListObjectOptions;
-import org.jclouds.googlecloudstorage.options.RewriteObjectOptions;
-import org.jclouds.googlecloudstorage.options.UpdateObjectOptions;
-import org.jclouds.googlecloudstorage.parser.ParseToPayloadEnclosing;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.jclouds.io.Payload;
-import org.jclouds.io.PayloadEnclosing;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides access to Object entities via their REST API.
- *
- * @see <a href="https://developers.google.com/storage/docs/json_api/v1/objects"/>
- */
-@RequestFilters(OAuthFilter.class)
-public interface ObjectApi {
-
- /**
- * Check the existence of an object
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- *
- * @return a {@link Object} true if object exists
- */
- @Named("Object:Exist")
- @GET
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean objectExists(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName);
-
- /**
- * Retrieve an object metadata
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- *
- * @return a {@link Object} resource
- */
- @Named("Object:get")
- @GET
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Consumes(APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName);
-
- /**
- * Retrieves objects metadata
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param options
- * A class that implements {@link HttpRequestOptions}
- * such as {@link GetObjectOptions} with optional query parameters
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:get")
- @GET
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Consumes(APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName, HttpRequestOptions options);
-
- /**
- * Retrieve an object or their metadata
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- *
- * @return a {@link Object} resource
- */
- @Named("Object:get")
- @GET
- @QueryParams(keys = "alt", values = "media")
- @Path("storage/v1/b/{bucket}/o/{object}")
- @ResponseParser(ParseToPayloadEnclosing.class)
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- PayloadEnclosing download(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName);
-
- /**
- * Retrieves objects
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param options
- * A class that implements {@link HttpRequestOptions}
- * such as {@link GetObjectOptions} with optional query parameters
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:get")
- @GET
- @QueryParams(keys = "alt", values = "media")
- @Path("storage/v1/b/{bucket}/o/{object}")
- @ResponseParser(ParseToPayloadEnclosing.class)
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- PayloadEnclosing download(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName,
- HttpRequestOptions options);
-
- /**
- * Stores a new object. Object metadata setting is not supported with simple uploads
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#simple
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param options
- * Supply an {@link InsertObjectOptions}. 'name' should not null.
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:simpleUpload")
- @POST
- @QueryParams(keys = "uploadType", values = "media")
- @Consumes(APPLICATION_JSON)
- @Path("/upload/storage/v1/b/{bucket}/o")
- GoogleCloudStorageObject simpleUpload(@PathParam("bucket") String bucketName, @HeaderParam("Content-Type") String contentType,
- @HeaderParam("Content-Length") Long contentLength, @PayloadParam("payload") Payload payload,
- InsertObjectOptions options);
-
- /**
- * Deletes an object and its metadata. Deletions are permanent if versioning is not enabled.
- *
- * @param bucketName
- * Name of the bucket in which the object to be deleted resides
- * @param objectName
- * Name of the object
- */
- @Named("Object:delete")
- @DELETE
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean deleteObject(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName);
-
- /**
- * Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the
- * generation parameter is used.
- *
- * @param bucketName
- * Name of the bucket in which the object to be deleted resides
- * @param objectName
- * Name of the object
- * @param options
- * Supply {@link DeleteObjectOptions} with optional query parameters
- */
- @Named("Object:delete")
- @DELETE
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean deleteObject(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName,
- DeleteObjectOptions options);
-
- /**
- * Retrieves a list of objects matching the criteria.
- *
- * @param bucketName
- * Name of the bucket in which to look for objects.
- */
- @Named("Object:list")
- @GET
- @Consumes(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o")
- @Fallback(NullOnNotFoundOr404.class)
- ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName);
-
- /**
- * Retrieves a list of objects matching the criteria.
- *
- * @param bucketName
- * Name of the bucket in which to look for objects.
- * @param options
- * Supply {@link ListObjectOptions}
- * @return a {@link ListPage<GoogleCloudStorageObject>}
- */
- @Named("Object:list")
- @GET
- @Consumes(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o")
- @Fallback(NullOnNotFoundOr404.class)
- ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName, ListObjectOptions options);
-
- /**
- * Updates an object metadata
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param objectTemplate
- * Supply an {@link ObjectTemplate}
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:update")
- @PUT
- @Consumes(APPLICATION_JSON)
- @Produces(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(NullOnNotFoundOr404.class)
- GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
-
- /**
- * Updates an object
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param objectTemplate
- * Supply an{@link ObjectTemplate}
- * @param options
- * Supply {@link UpdateObjectOptions} with optional query parameters
- *
- * @return a {@link GoogleCloudStorageObject} .
- */
- @Named("Object:update")
- @PUT
- @Consumes(APPLICATION_JSON)
- @Produces(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(NullOnNotFoundOr404.class)
- GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
-
- /**
- * Updates an object according to patch semantics
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param objectTemplate
- * Supply {@link ObjectTemplate} with optional query parameters
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:patch")
- @PATCH
- @Consumes(APPLICATION_JSON)
- @Produces(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(NullOnNotFoundOr404.class)
- GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
-
- /**
- * Updates an object according to patch semantics
- *
- * @param bucketName
- * Name of the bucket in which the object resides
- * @param objectName
- * Name of the object
- * @param objectTemplate
- * Supply {@link ObjectTemplate} with optional query parameters
- * @param options
- * Supply {@link UpdateObjectOptions} with optional query parameters
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:patch")
- @PUT
- @Consumes(APPLICATION_JSON)
- @Produces(APPLICATION_JSON)
- @Path("storage/v1/b/{bucket}/o/{object}")
- @Fallback(NullOnNotFoundOr404.class)
- GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName,
- @PathParam("object") @Encoded String objectName,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
-
- /**
- * Concatenates a list of existing objects into a new object in the same bucket.
- *
- * @param destinationBucket
- * Name of the bucket in which the object to be stored
- * @param destinationObject
- * The type of upload request.
- * @param composeObjectTemplate
- * Supply a {@link ComposeObjectTemplate}
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:compose")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
- GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate);
-
- /**
- * Concatenates a list of existing objects into a new object in the same bucket.
- *
- * @param destinationBucket
- * Name of the bucket in which the object to be stored
- * @param destinationObject
- * The type of upload request.
- * @param composeObjectTemplate
- * Supply a {@link ComposeObjectTemplate}
- * @param options
- * Supply an {@link ComposeObjectOptions}
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:compose")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
- GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate,
- ComposeObjectOptions options);
-
- /**
- * Copies an object to a specified location.
- *
- * @param destinationBucket
- * Name of the bucket in which to store the new object
- * @param destinationObject
- * Name of the new object.
- * @param sourceBucket
- * Name of the bucket in which to find the source object
- * @param sourceObject
- * Name of the source object
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:copy")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
- GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @PathParam("sourceBucket") String sourceBucket,
- @PathParam("sourceObject") @Encoded String sourceObject);
-
- /**
- * Copies an object to a specified location with updated metadata.
- *
- * @param destinationBucket
- * Name of the bucket in which to store the new object
- * @param destinationObject
- * Name of the new object.
- * @param sourceBucket
- * Name of the bucket in which to find the source object
- * @param sourceObject
- * Name of the source object
- * @param template
- * Supply a {@link CopyObjectOptions}
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:copy")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
- GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @PathParam("sourceBucket") String sourceBucket,
- @PathParam("sourceObject") @Encoded String sourceObject,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate template);
-
- /**
- * Copies an object to a specified location. Optionally overrides metadata.
- *
- * @param destinationBucket
- * Name of the bucket in which to store the new object
- * @param destinationObject
- * Name of the new object.
- * @param sourceBucket
- * Name of the bucket in which to find the source object
- * @param sourceObject
- * Name of the source object
- * @param options
- * Supply a {@link CopyObjectOptions}
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:copy")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
- GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @PathParam("sourceBucket") String sourceBucket,
- @PathParam("sourceObject") @Encoded String sourceObject, CopyObjectOptions options);
-
- /**
- * Stores a new object with metadata.
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#multipart
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param objectTemplate
- * Supply an {@link ObjectTemplate}.
- *
- * @return a {@link GoogleCloudStorageObject}
- */
- @Named("Object:multipartUpload")
- @POST
- @QueryParams(keys = "uploadType", values = "multipart")
- @Consumes(APPLICATION_JSON)
- @Path("/upload/storage/v1/b/{bucket}/o")
- @MapBinder(MultipartUploadBinder.class)
- GoogleCloudStorageObject multipartUpload(@PathParam("bucket") String bucketName,
- @PayloadParam("template") ObjectTemplate objectTemplate,
- @PayloadParam("payload") Payload payload);
-
- /**
- * Rewrites a source object to a destination object.
- *
- * @param destinationBucket
- * Name of the bucket in which the object to be stored
- * @param destinationObject
- * Name of the new object.
- * @param sourceBucket
- * Name of the bucket in which to find the source object.
- * @param sourceObject
- * Name of the source object.
- *
- * @return a {@link RewriteResponse}
- */
- @Named("Object:rewrite")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
- RewriteResponse rewriteObjects(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @PathParam("sourceBucket") String sourceBucket, @PathParam("sourceObject") @Encoded String sourceObject);
-
- /**
- * Rewrites a source object to a destination object.
- *
- * @param destinationBucket
- * Name of the bucket in which the object to be stored
- * @param destinationObject
- * Name of the new object.
- * @param sourceBucket
- * Name of the bucket in which to find the source object.
- * @param sourceObject
- * Name of the source object.
- * @param options
- * Supply an {@link RewriteObjectOptions}
- *
- * @return a {@link RewriteResponse}
- */
- @Named("Object:rewrite")
- @POST
- @Consumes(APPLICATION_JSON)
- @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
- RewriteResponse rewriteObjects(@PathParam("destinationBucket") String destinationBucket,
- @PathParam("destinationObject") @Encoded String destinationObject,
- @PathParam("sourceBucket") String sourceBucket,
- @PathParam("sourceObject") @Encoded String sourceObject,
- RewriteObjectOptions options);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java
deleted file mode 100644
index 9ec41ab..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-
-import org.jclouds.googlecloudstorage.binders.UploadBinder;
-import org.jclouds.googlecloudstorage.domain.ResumableUpload;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.options.InsertObjectOptions;
-import org.jclouds.googlecloudstorage.parser.ParseToResumableUpload;
-import org.jclouds.io.Payload;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * Provides Resumable Upload support via Rest API
- *
- * @see <a href="https://developers.google.com/storage/docs/json_api/v1/objects"/>
- * @see <a href="https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable"/>
- */
-@SkipEncoding({ '/', '=' })
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface ResumableUploadApi {
-
- /**
- * initiate a Resumable Upload Session
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param objectName
- * Name of the object to upload
- * @param contentType
- * Content type of the uploaded data
- * @param contentLength
- * ContentLength of the uploaded object (Media part)
- *
- * @return a {@link ResumableUpload}
- */
- @Named("Object:initResumableUpload")
- @POST
- @QueryParams(keys = "uploadType", values = "resumable")
- @Path("/upload/storage/v1/b/{bucket}/o")
- @ResponseParser(ParseToResumableUpload.class)
- ResumableUpload initResumableUpload(@PathParam("bucket") String bucketName, @QueryParam("name") String objectName,
- @HeaderParam("X-Upload-Content-Type") String contentType,
- @HeaderParam("X-Upload-Content-Length") String contentLength);
-
- /**
- * initiate a Resumable Upload Session
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#simple
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param contentType
- * Content type of the uploaded data (Media part)
- * @param contentLength
- * Content length of the uploaded data (Media part)
- * @param metada
- * Supply an {@link ObjectTemplate}
- *
- * @return a {@link ResumableUpload}
- */
- @Named("Object:resumableUpload")
- @POST
- @QueryParams(keys = "uploadType", values = "resumable")
- @Path("/upload/storage/v1/b/{bucket}/o")
- @ResponseParser(ParseToResumableUpload.class)
- ResumableUpload initResumableUpload(@PathParam("bucket") String bucketName,
- @HeaderParam("X-Upload-Content-Type") String contentType,
- @HeaderParam("X-Upload-Content-Length") Long contentLength,
- @BinderParam(BindToJsonPayload.class) ObjectTemplate metadata);
-
- /**
- * Stores a new object
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param options
- * Supply {@link InsertObjectOptions} with optional query parameters. 'name' is mandatory.
- *
- * @return If successful, this method returns a {@link GoogleCloudStorageObject} resource.
- */
- @Named("Object:resumableUpload")
- @PUT
- @QueryParams(keys = "uploadType", values = "resumable")
- @Path("/upload/storage/v1/b/{bucket}/o")
- @MapBinder(UploadBinder.class)
- @ResponseParser(ParseToResumableUpload.class)
- ResumableUpload upload(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId,
- @HeaderParam("Content-Type") String contentType, @HeaderParam("Content-Length") String contentLength,
- @PayloadParam("payload") Payload payload);
-
- /**
- * Facilitate to use resumable upload operation to upload files in chunks
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param uploadId
- * uploadId returned from initResumableUpload operation
- * @param contentType
- * Content type of the uploaded data
- * @param contentLength
- * Content length of the uploaded data
- * @param contentRange
- * Range in {bytes StartingByte - Endingbyte/Totalsize } format ex: bytes 0 - 1213/2000
- * @param payload
- * a {@link Payload} with actual data to upload
- *
- * @return a {@link ResumableUpload}
- */
- @Named("Object:Upload")
- @PUT
- @QueryParams(keys = "uploadType", values = "resumable")
- @Path("/upload/storage/v1/b/{bucket}/o")
- @MapBinder(UploadBinder.class)
- @ResponseParser(ParseToResumableUpload.class)
- ResumableUpload chunkUpload(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId,
- @HeaderParam("Content-Type") String contentType, @HeaderParam("Content-Length") Long contentLength,
- @HeaderParam("Content-Range") String contentRange, @PayloadParam("payload") Payload payload);
-
- /**
- * Check the status of a resumable upload
- *
- * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
- *
- * @param bucketName
- * Name of the bucket in which the object to be stored
- * @param uploadId
- * uploadId returned from initResumableUpload operation
- * @param contentRange
- * Range in {bytes StartingByte - Endingbyte/Totalsize } format ex: bytes 0 - 1213/2000
- *
- * @return a {@link ResumableUpload}
- */
-
- @Named("Object:Upload")
- @PUT
- @DefaultValue("0")
- @QueryParams(keys = "uploadType", values = "resumable")
- @Path("/upload/storage/v1/b/{bucket}/o")
- @ResponseParser(ParseToResumableUpload.class)
- ResumableUpload checkStatus(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId,
- @HeaderParam("Content-Range") String contentRange);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java
deleted file mode 100644
index d330146..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.handlers;
-
-import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-@Singleton
-public class GoogleCloudStorageErrorHandler implements HttpErrorHandler {
- public void handleError(HttpCommand command, HttpResponse response) {
- // it is important to always read fully and close streams
- byte[] data = closeClientButKeepContentStream(response);
- String message = data != null ? new String(data) : null;
-
- Exception exception = message != null ? new HttpResponseException(command, response, message)
- : new HttpResponseException(command, response);
- message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
- response.getStatusLine());
-
- String message411 = "MissingContentLength: You must provide the Content-Length HTTP header.\n";
- String message412 = "PreconditionFailed: At least one of the pre-conditions you specified did not hold.\n";
-
- switch (response.getStatusCode()) {
- case 308:
- return;
- case 400:
- if (message.indexOf("<Code>ExpiredToken</Code>") != -1) {
- exception = new AuthorizationException(message, exception);
- }
- break;
- case 401:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- exception = new ResourceNotFoundException(message, exception);
- break;
- case 409:
- exception = new IllegalStateException(message, exception);
- break;
- case 411:
- exception = new IllegalStateException(message411 + message, exception);
- break;
- case 412:
- exception = new IllegalStateException(message412 + message, exception);
- break;
- }
- command.setException(exception);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java
deleted file mode 100644
index b7c236b..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.handlers;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.http.handlers.RedirectionRetryHandler;
-
-import com.google.inject.Inject;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-@Singleton
-public class GoogleCloudStorageRedirectRetryHandler extends RedirectionRetryHandler {
-
- @Inject
- protected GoogleCloudStorageRedirectRetryHandler(BackoffLimitedRetryHandler backoffHandler) {
- super(backoffHandler);
- }
-
- @Override
- public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
- if (response.getStatusCode() == 308) {
- return false;
- } else {
- return super.shouldRetryRequest(command, response);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java
deleted file mode 100644
index fb9eeb5..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and destinationPredefinedAcl when
- * ComposingObjects operation.
- */
-public class ComposeObjectOptions extends BaseHttpRequestOptions {
-
- public ComposeObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public ComposeObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public ComposeObjectOptions destinationPredefinedAcl(DestinationPredefinedAcl destinationPredefinedAcl) {
- this.queryParameters.put("destinationPredefinedAcl",
- checkNotNull(destinationPredefinedAcl, "destinationPredefinedAcl").toString());
- return this;
- }
-
- public static class Builder {
-
- public ComposeObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new ComposeObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public ComposeObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new ComposeObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public ComposeObjectOptions destinationPredefinedAcl(DestinationPredefinedAcl destinationPredefinedAcl) {
- return new ComposeObjectOptions().destinationPredefinedAcl(destinationPredefinedAcl);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java
deleted file mode 100644
index a003686..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class CopyObjectOptions extends BaseHttpRequestOptions {
-
- public CopyObjectOptions contentEncoding(String contentEncoding) {
- this.queryParameters.put("contentEncoding", checkNotNull(contentEncoding, "contentEncoding") + "");
- return this;
- }
-
- public CopyObjectOptions name(String name) {
- this.queryParameters.put("name", checkNotNull(name, "name") + "");
- return this;
- }
-
- public CopyObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + "");
- return this;
- }
-
- public CopyObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public CopyObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public CopyObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
- public CopyObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) {
- this.queryParameters.put("ifSourceGenerationMatch", checkNotNull(ifSourceGenerationMatch, "ifSourceGenerationMatch") + "");
- return this;
- }
-
- public CopyObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) {
- this.queryParameters.put("ifSourceGenerationNotMatch", checkNotNull(ifSourceGenerationNotMatch, "ifSourceGenerationNotMatch") + "");
- return this;
- }
-
- public CopyObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) {
- this.queryParameters.put("ifSourceMetagenerationMatch", checkNotNull(ifSourceMetagenerationMatch, "ifSourceMetagenerationMatch")
- + "");
- return this;
- }
-
- public CopyObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) {
- this.queryParameters.put("ifSourceMetagenerationNotMatch",
- checkNotNull(ifSourceMetagenerationNotMatch, "ifSourceMetagenerationNotMatch") + "");
- return this;
- }
-
- public CopyObjectOptions sourceGeneration(Long sourceGeneration) {
- this.queryParameters.put("sourceGeneration", checkNotNull(sourceGeneration, "sourceGeneration") + "");
- return this;
- }
-
- public CopyObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public CopyObjectOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public CopyObjectOptions contentEncoding(String contentEncoding) {
- return new CopyObjectOptions().contentEncoding(contentEncoding);
- }
-
- public CopyObjectOptions name(String name) {
- return new CopyObjectOptions().name(name);
- }
-
- public CopyObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new CopyObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public CopyObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new CopyObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public CopyObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new CopyObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public CopyObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new CopyObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public CopyObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) {
- return new CopyObjectOptions().ifSourceGenerationMatch(ifSourceGenerationMatch);
- }
-
- public CopyObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) {
- return new CopyObjectOptions().ifSourceGenerationNotMatch(ifSourceGenerationNotMatch);
- }
-
- public CopyObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) {
- return new CopyObjectOptions().ifSourceMetagenerationMatch(ifSourceMetagenerationMatch);
- }
-
- public CopyObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) {
- return new CopyObjectOptions().ifSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch);
- }
-
-
- public CopyObjectOptions sourceGeneration(Long sourceGeneration) {
- return new CopyObjectOptions().sourceGeneration(sourceGeneration);
- }
-
- public CopyObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new CopyObjectOptions().predefinedAcl(predefinedAcl);
- }
-
- public UpdateObjectOptions projection(Projection projection) {
- return new UpdateObjectOptions().projection(projection);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java
deleted file mode 100644
index e6bcb73..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class DeleteBucketOptions extends BaseHttpRequestOptions {
-
- public DeleteBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public DeleteBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public static class Builder {
-
- public DeleteBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new DeleteBucketOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public DeleteBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new DeleteBucketOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java
deleted file mode 100644
index d2c0d01..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class DeleteObjectOptions extends BaseHttpRequestOptions {
-
- public DeleteObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + "");
- return this;
- }
-
- public DeleteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + "");
- return this;
- }
-
- public DeleteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public DeleteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public DeleteObjectOptions generation(Long generation) {
- this.queryParameters.put("generation", checkNotNull(generation, "generation").toString());
- return this;
- }
-
- public DeleteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString());
- return this;
- }
-
- public static class Builder {
-
- public DeleteObjectOptions ifGenerationMatch(Long ifGenerationMatch) {
- return new DeleteObjectOptions().ifGenerationMatch(ifGenerationMatch);
- }
-
- public DeleteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) {
- return new DeleteObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch);
- }
-
- public DeleteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new DeleteObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public DeleteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new DeleteObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public DeleteObjectOptions generation(Long generation) {
- return new DeleteObjectOptions().generation(generation);
- }
-
- public DeleteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) {
- return new DeleteObjectOptions().predefinedAcl(predefinedAcl);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java
deleted file mode 100644
index 9d992fa..0000000
--- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.http.options.BaseHttpRequestOptions;
-
-/**
- * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket
- */
-public class GetBucketOptions extends BaseHttpRequestOptions {
-
- public GetBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch")
- + "");
- return this;
- }
-
- public GetBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- this.queryParameters.put("ifMetagenerationNotMatch",
- checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + "");
- return this;
- }
-
- public GetBucketOptions projection(Projection projection) {
- this.queryParameters.put("projection", checkNotNull(projection, "projection").toString());
- return this;
- }
-
- public static class Builder {
-
- public GetBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) {
- return new GetBucketOptions().ifMetagenerationMatch(ifMetagenerationMatch);
- }
-
- public GetBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) {
- return new GetBucketOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch);
- }
-
- public GetBucketOptions projection(Projection projection) {
- return new GetBucketOptions().projection(projection);
- }
-
- }
-}
[2/7] jclouds-labs-google git commit: JCLOUDS-944: Promote Google
Cloud Storage to core
Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiLiveTest.java
deleted file mode 100644
index 4bf48cb..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiLiveTest.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static com.google.common.io.BaseEncoding.base64;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.entry;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.UUID;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.RewriteResponse;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiLiveTest;
-import org.jclouds.googlecloudstorage.options.ComposeObjectOptions;
-import org.jclouds.googlecloudstorage.options.CopyObjectOptions;
-import org.jclouds.googlecloudstorage.options.DeleteObjectOptions;
-import org.jclouds.googlecloudstorage.options.GetObjectOptions;
-import org.jclouds.googlecloudstorage.options.InsertObjectOptions;
-import org.jclouds.googlecloudstorage.options.ListObjectOptions;
-import org.jclouds.googlecloudstorage.options.UpdateObjectOptions;
-import org.jclouds.http.internal.PayloadEnclosingImpl;
-import org.jclouds.io.ByteStreams2;
-import org.jclouds.io.ContentMetadata;
-import org.jclouds.io.PayloadEnclosing;
-import org.jclouds.io.Payloads;
-import org.jclouds.io.payloads.ByteSourcePayload;
-import org.jclouds.utils.TestUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.beust.jcommander.internal.Lists;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.hash.Hashing;
-import com.google.common.io.ByteSource;
-
-public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
-
- private static final String BUCKET_NAME = "jcloudsobjectoperations" + UUID.randomUUID();
- private static final String BUCKET_NAME2 = "jcloudsobjectdestination" + UUID.randomUUID();
- private static final String UPLOAD_OBJECT_NAME = "objectOperation.txt";
- private static final String UPLOAD_OBJECT_NAME2 = "jcloudslogo.jpg";
- private static final String MULTIPART_UPLOAD_OBJECT = "multipart_related.jpg";
- private static final String COPIED_OBJECT_NAME = "copyofObjectOperation.txt";
- private static final String COPIED_OBJECT_NAME2 = "copyObjectWithMeta.txt";
- private static final String COMPOSED_OBJECT = "ComposedObject1.txt";
- private static final String COMPOSED_OBJECT2 = "ComposedObject2.json";
- private static final String NONEXISTENT_OBJECT_NAME = "noSuchObject.txt";
- private static final String REWRITE_OBJECT_NAME = "rewriteObject.txt";
-
- private PayloadEnclosing testPayload;
- private Long RANDOM_LONG = 100L;
-
- private Long metageneration;
- private Long generation;
- private String md5Hash;
- private String crc32c;
-
- private ObjectApi api() {
- return api.getObjectApi();
- }
-
- // Create the buckets
- @BeforeClass
- private void createBucket() {
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME);
- Bucket bucket = api.getBucketApi().createBucket(PROJECT_NUMBER, template);
- assertNotNull(bucket);
-
- BucketTemplate template2 = new BucketTemplate().name(BUCKET_NAME2);
- Bucket bucket2 = api.getBucketApi().createBucket(PROJECT_NUMBER, template2);
- assertNotNull(bucket2);
- }
-
- // Object Operations
- @Test(groups = "live")
- public void testSimpleUpload() throws IOException {
- long contentLength = 512L;
- ByteSource byteSource = TestUtils.randomByteSource().slice(0, contentLength);
- ByteSourcePayload byteSourcePayload = Payloads.newByteSourcePayload(byteSource);
-
- PayloadEnclosing payload = new PayloadEnclosingImpl(byteSourcePayload);
- payload.getPayload().getContentMetadata().setContentLength(contentLength);
-
- this.testPayload = payload;
-
- InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME);
-
- GoogleCloudStorageObject gcsObject = api().simpleUpload(BUCKET_NAME, "text/plain",
- payload.getPayload().getContentMetadata().getContentLength(), payload.getPayload(), options);
-
- assertNotNull(gcsObject);
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME);
- }
-
- @Test(groups = "live", dependsOnMethods = "testSimpleUpload")
- public void testRewrite() throws IOException {
- GoogleCloudStorageObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME);
- System.out.println(gcsObject);
-
- RewriteResponse response = api().rewriteObjects(BUCKET_NAME, REWRITE_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME);
- assertNotNull(response);
- assertTrue(response.done());
- assertEquals(response.objectSize(), 512);
- assertEquals(response.totalBytesRewritten(), 512);
- assertEquals(response.rewriteToken(), null);
- assertNotNull(response.resource());
- }
-
- @Test(groups = "live", dependsOnMethods = "testRewrite")
- public void testDownload() throws IOException {
- PayloadEnclosing impl = api().download(BUCKET_NAME, UPLOAD_OBJECT_NAME);
- ContentMetadata meta = impl.getPayload().getContentMetadata();
- assertNotNull(impl);
- assertNotNull(impl.getPayload());
- assertNotNull(meta);
- assertEquals(meta.getContentType(), "text/plain");
-
- testPayload.getPayload().getContentMetadata().setContentDisposition("attachment");
-
- assertEquals(ByteStreams2.toByteArrayAndClose(impl.getPayload().openStream()),
- ByteStreams2.toByteArrayAndClose(testPayload.getPayload().openStream()));
- }
-
- @Test(groups = "live", dependsOnMethods = "testSimpleUpload")
- public void testSimpleJpegUpload() throws IOException {
- long contentLength = 2 * 1024L;
- ByteSource testSource = TestUtils.randomByteSource().slice(0, contentLength);
- ByteSourcePayload payload = Payloads.newByteSourcePayload(testSource);
-
- InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME2);
-
- GoogleCloudStorageObject gcsObject = api().simpleUpload(BUCKET_NAME, "image/jpeg", contentLength, payload, options);
-
- assertNotNull(gcsObject);
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME2);
-
- // This is a client side validation of md5
- md5Hash = base64().encode(testSource.hash(Hashing.md5()).asBytes());
- // TODO: crc32c = without making a compile dep on guava 18.
-
- checkHashCodes(gcsObject);
- }
-
- @Test(groups = "live", dependsOnMethods = "testSimpleUpload")
- public void testGetObject() {
- GoogleCloudStorageObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME);
-
- assertNotNull(gcsObject);
-
- metageneration = gcsObject.metageneration();
- generation = gcsObject.generation();
-
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME);
- assertEquals(gcsObject.contentType(), "text/plain");
- }
-
- @Test(groups = "live", dependsOnMethods = "testGetObject")
- public void testGetObjectWithOptions() {
- GetObjectOptions options = new GetObjectOptions().ifGenerationMatch(generation)
- .ifMetagenerationMatch(metageneration).ifGenerationNotMatch(generation + 1).projection(Projection.FULL);
-
- GoogleCloudStorageObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME);
- assertEquals(gcsObject.contentType(), "text/plain");
- }
-
- @Test(groups = "live", dependsOnMethods = "testGetObject")
- public void testCopyObject() throws IOException {
- GoogleCloudStorageObject gcsObject = api().copyObject(BUCKET_NAME2, COPIED_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME);
-
- assertNotNull(gcsObject);
- assertEquals(gcsObject.bucket(), BUCKET_NAME2);
- assertEquals(gcsObject.name(), COPIED_OBJECT_NAME);
- assertEquals(gcsObject.contentType(), "text/plain");
-
- // Test for data
-
- PayloadEnclosing impl = api().download(BUCKET_NAME2, COPIED_OBJECT_NAME);
- assertNotNull(impl);
- assertEquals(ByteStreams2.toByteArrayAndClose(impl.getPayload().openStream()),
- ByteStreams2.toByteArrayAndClose(testPayload.getPayload().openStream()));
-
- }
-
- @Test(groups = "live", dependsOnMethods = "testGetObject")
- public void testCopyObjectWithUpdatedMetadata() throws IOException {
- String METADATA_KEY = "key1";
- String METADATA_VALUE = "value1";
-
- ObjectTemplate template = new ObjectTemplate().contentLanguage("fr").contentType("text/plain")
- .contentDisposition("attachment").customMetadata(METADATA_KEY, METADATA_VALUE);
-
- GoogleCloudStorageObject gcsObject = api().copyObject(BUCKET_NAME2, COPIED_OBJECT_NAME2, BUCKET_NAME, UPLOAD_OBJECT_NAME, template);
-
- assertNotNull(gcsObject);
- assertEquals(gcsObject.bucket(), BUCKET_NAME2);
- assertEquals(gcsObject.name(), COPIED_OBJECT_NAME2);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.contentType(), "text/plain");
- assertEquals(gcsObject.metadata().get(METADATA_KEY), METADATA_VALUE);
- assertEquals(gcsObject.contentLanguage(), "fr");
- // Test for data
-
- PayloadEnclosing impl = api().download(BUCKET_NAME2, COPIED_OBJECT_NAME2);
- assertNotNull(impl);
- assertEquals(ByteStreams2.toByteArrayAndClose(impl.getPayload().openStream()),
- ByteStreams2.toByteArrayAndClose(testPayload.getPayload().openStream()));
- }
-
- @Test(groups = "live", dependsOnMethods = "testCopyObject")
- public void testCopyObjectWithOptions() {
- CopyObjectOptions options = new CopyObjectOptions().ifSourceGenerationMatch(generation)
- .ifSourceMetagenerationMatch(metageneration).projection(Projection.FULL);
-
- GoogleCloudStorageObject gcsObject = api()
- .copyObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME2);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME);
- assertEquals(gcsObject.contentType(), "text/plain");
- }
-
- @Test(groups = "live", dependsOnMethods = "testCopyObjectWithOptions")
- public void testComposeObject() {
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- ObjectTemplate destination = new ObjectTemplate().contentType("text/plain").addAcl(oacl);
- List<GoogleCloudStorageObject> sourceList = Lists.newArrayList();
- sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
- sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
-
- ComposeObjectTemplate requestTemplate = ComposeObjectTemplate.builder()
- .fromGoogleCloudStorageObject(sourceList)
- .destination(destination)
- .build();
-
- GoogleCloudStorageObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT, requestTemplate);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME2);
- assertEquals(gcsObject.name(), COMPOSED_OBJECT);
- assertEquals(gcsObject.contentType(), "text/plain");
- }
-
- @Test(groups = "live", dependsOnMethods = "testComposeObject")
- public void testComposeObjectWithOptions() {
- ObjectTemplate destination = new ObjectTemplate().contentType(MediaType.APPLICATION_JSON);
- List<GoogleCloudStorageObject> sourceList = Lists.newArrayList();
- sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
- sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
-
- ComposeObjectTemplate requestTemplate = ComposeObjectTemplate.builder()
- .fromGoogleCloudStorageObject(sourceList)
- .destination(destination)
- .build();
- ComposeObjectOptions options = new ComposeObjectOptions().destinationPredefinedAcl(
- DestinationPredefinedAcl.BUCKET_OWNER_READ).ifMetagenerationNotMatch(RANDOM_LONG);
-
- GoogleCloudStorageObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT2, requestTemplate, options);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME2);
- assertEquals(gcsObject.name(), COMPOSED_OBJECT2);
- assertEquals(gcsObject.contentType(), MediaType.APPLICATION_JSON);
- }
-
- @Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
- public void listObjects() {
- ListPageWithPrefixes<GoogleCloudStorageObject> list = api().listObjects(BUCKET_NAME);
-
- assertNotNull(list);
- assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
- }
-
- @Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
- public void testListObjectsWithOptions() {
- ListObjectOptions options = new ListObjectOptions().maxResults(1);
- ListPageWithPrefixes<GoogleCloudStorageObject> list = api().listObjects(BUCKET_NAME, options);
-
- while (list.nextPageToken() != null) {
- assertNotNull(list);
- assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
- assertEquals(list.size(), 1);
-
- options = new ListObjectOptions().maxResults(1).pageToken(list.nextPageToken());
- list = api().listObjects(BUCKET_NAME, options);
- }
- }
-
- @Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
- public void testUpdateObject() {
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
- GoogleCloudStorageObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME2);
- assertEquals(gcsObject.contentType(), "image/jpeg");
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateObject")
- public void testUpdateObjectWithOptions() {
- String METADATA_KEY = "key1";
- String METADATA_VALUE = "value1";
-
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- UpdateObjectOptions options = new UpdateObjectOptions().ifMetagenerationNotMatch(RANDOM_LONG)
- .ifGenerationNotMatch(RANDOM_LONG);
-
- ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
- .contentDisposition("attachment").customMetadata(METADATA_KEY, METADATA_VALUE);
- GoogleCloudStorageObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME2);
- assertEquals(gcsObject.contentType(), "image/jpeg");
- assertNotNull(gcsObject.metadata());
- assertNotNull(gcsObject.metadata().get(METADATA_KEY), METADATA_VALUE);
- }
-
- @Test(groups = "live", dependsOnMethods = "testUpdateObjectWithOptions")
- public void testPatchObject() {
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.READER).build();
-
- ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
- GoogleCloudStorageObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME2);
- assertEquals(gcsObject.contentType(), "image/jpeg");
- }
-
- @Test(groups = "live", dependsOnMethods = "testPatchObject")
- public void testPatchObjectsWithOptions() {
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- UpdateObjectOptions options = new UpdateObjectOptions().ifMetagenerationNotMatch(RANDOM_LONG)
- .ifGenerationNotMatch(RANDOM_LONG);
-
-
- ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
- .contentDisposition("attachment");
- GoogleCloudStorageObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
-
- assertNotNull(gcsObject);
- assertNotNull(gcsObject.acl());
- assertEquals(gcsObject.bucket(), BUCKET_NAME);
- assertEquals(gcsObject.name(), UPLOAD_OBJECT_NAME2);
- assertEquals(gcsObject.contentType(), "image/jpeg");
- assertEquals(gcsObject.contentDisposition(), "attachment");
- }
-
- @Test(groups = "live", dependsOnMethods = "testPatchObjectsWithOptions")
- public void testMultipartJpegUpload() throws IOException {
- long contentLength = 32 * 1024L;
- ByteSource byteSource = TestUtils.randomByteSource().slice(0, contentLength);
- ByteSourcePayload payload = Payloads.newByteSourcePayload(byteSource);
- PayloadEnclosing payloadImpl = new PayloadEnclosingImpl(payload);
-
- ObjectTemplate template = new ObjectTemplate();
-
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- // This would trigger server side validation of md5
- md5Hash = base64().encode(byteSource.hash(Hashing.md5()).asBytes());
- // TODO: crc32c = without making a compile dep on guava 18
-
- template.contentType("image/jpeg").addAcl(oacl).size(contentLength).name(MULTIPART_UPLOAD_OBJECT)
- .contentLanguage("en").contentDisposition("attachment").md5Hash(md5Hash)
- .customMetadata("custommetakey1", "custommetavalue1").crc32c(crc32c)
- .customMetadata(ImmutableMap.of("Adrian", "powderpuff"));
-
- GoogleCloudStorageObject gcsObject = api().multipartUpload(BUCKET_NAME, template, payloadImpl.getPayload());
-
- assertThat(gcsObject.bucket()).isEqualTo(BUCKET_NAME);
- assertThat(gcsObject.name()).isEqualTo(MULTIPART_UPLOAD_OBJECT);
- checkHashCodes(gcsObject);
-
- assertThat(gcsObject.metadata()).contains(entry("custommetakey1", "custommetavalue1"),
- entry("Adrian", "powderpuff")).doesNotContainKey("adrian");
-
- PayloadEnclosing impl = api().download(BUCKET_NAME, MULTIPART_UPLOAD_OBJECT);
-
- assertThat(ByteStreams2.toByteArrayAndClose(impl.getPayload().openStream())).isEqualTo(
- ByteStreams2.toByteArrayAndClose(payloadImpl.getPayload().openStream()));
- }
-
- private void checkHashCodes(GoogleCloudStorageObject gcsObject) {
- assertEquals(gcsObject.md5Hash(), md5Hash);
- if (crc32c != null) {
- assertEquals(gcsObject.crc32c(), crc32c);
- }
- }
-
- @Test(groups = "live", dependsOnMethods = "testMultipartJpegUpload")
- public void testDeleteObject() {
- assertTrue(api().deleteObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
- assertTrue(api().deleteObject(BUCKET_NAME2, COMPOSED_OBJECT2));
- assertTrue(api().deleteObject(BUCKET_NAME2, COMPOSED_OBJECT));
- assertTrue(api().deleteObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
- assertTrue(api().deleteObject(BUCKET_NAME2, COPIED_OBJECT_NAME2));
- assertFalse(api().deleteObject(BUCKET_NAME, UPLOAD_OBJECT_NAME));
- assertTrue(api().deleteObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2));
- assertTrue(api().deleteObject(BUCKET_NAME, MULTIPART_UPLOAD_OBJECT));
- assertTrue(api().deleteObject(BUCKET_NAME, REWRITE_OBJECT_NAME));
- assertFalse(api().deleteObject(BUCKET_NAME, NONEXISTENT_OBJECT_NAME));
- }
-
- @Test(groups = "live", dependsOnMethods = "testPatchObjectsWithOptions")
- public void testDeleteObjectWithOptions() {
- DeleteObjectOptions options = new DeleteObjectOptions().ifGenerationMatch(generation).ifMetagenerationMatch(
- metageneration);
- api().deleteObject(BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
- }
-
- @AfterClass
- private void deleteBucket() {
- api.getBucketApi().deleteBucket(BUCKET_NAME);
- api.getBucketApi().deleteBucket(BUCKET_NAME2);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiMockTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiMockTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiMockTest.java
deleted file mode 100644
index 863581b..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectApiMockTest.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
-import static com.google.common.base.Charsets.UTF_8;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
-import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiMockTest;
-import org.jclouds.googlecloudstorage.options.ComposeObjectOptions;
-import org.jclouds.googlecloudstorage.options.CopyObjectOptions;
-import org.jclouds.googlecloudstorage.options.GetObjectOptions;
-import org.jclouds.googlecloudstorage.options.InsertObjectOptions;
-import org.jclouds.googlecloudstorage.options.ListObjectOptions;
-import org.jclouds.googlecloudstorage.options.RewriteObjectOptions;
-import org.jclouds.googlecloudstorage.parse.ParseGoogleCloudStorageObject;
-import org.jclouds.googlecloudstorage.parse.ParseGoogleCloudStorageObjectListTest;
-import org.jclouds.googlecloudstorage.parse.ParseObjectRewriteResponse;
-import org.jclouds.http.internal.PayloadEnclosingImpl;
-import org.jclouds.io.PayloadEnclosing;
-import org.jclouds.util.Strings2;
-import org.testng.annotations.Test;
-
-import com.google.common.net.MediaType;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.RecordedRequest;
-
-@Test(groups = "unit", testName = "ObjectApiMockTest", singleThreaded = true)
-public class ObjectApiMockTest extends BaseGoogleCloudStorageApiMockTest {
-
-
- public void exists() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- assertTrue(objectApi().objectExists("test", "file_name"));
- assertSent(server, "GET", "/storage/v1/b/test/o/file_name", null);
- }
-
- public void existsEncoded() throws Exception {
- server.enqueue(jsonResponse("/object_encoded_get.json"));
-
- assertTrue(objectApi().objectExists("test", Strings2.urlEncode("dir/file name")));
- assertSent(server, "GET", "/storage/v1/b/test/o/dir%2Ffile%20name", null);
- }
-
- public void exists_4xx() throws Exception {
- server.enqueue(response404());
-
- assertFalse(objectApi().objectExists("test", "file_name"));
- assertSent(server, "GET", "/storage/v1/b/test/o/file_name", null);
- }
-
- public void get() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- assertEquals(objectApi().getObject("test", "file_name"),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "GET", "/storage/v1/b/test/o/file_name");
- }
-
- public void get_4xx() throws Exception {
- server.enqueue(response404());
-
- assertNull(objectApi().getObject("test", "file_name"));
- assertSent(server, "GET", "/storage/v1/b/test/o/file_name");
- }
-
- public void get_with_options() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- GetObjectOptions options = new GetObjectOptions().ifGenerationMatch((long) 1000);
- options.range(0, 1023);
-
- assertEquals(objectApi().getObject("test", "file_name", options),
- new ParseGoogleCloudStorageObject().expected());
- RecordedRequest request = assertSent(server, "GET", "/storage/v1/b/test/o/file_name?ifGenerationMatch=1000");
- assertEquals(request.getHeader("Range"), "bytes=0-1023");
- }
-
- public void simpleUpload() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- PayloadEnclosing p = new PayloadEnclosingImpl();
- String testPayload = "this is a test payload for upload!";
- p.setPayload(testPayload.getBytes());
-
- InsertObjectOptions options = new InsertObjectOptions()
- .name("new_object")
- .predefinedAcl(PredefinedAcl.PUBLIC_READ_WRITE);
-
- assertEquals(objectApi().simpleUpload("bucket_name", "text/plain",
- p.getPayload().getContentMetadata().getContentLength(), p.getPayload(), options),
- new ParseGoogleCloudStorageObject().expected());
-
- RecordedRequest request = assertSent(server, "POST", "/upload/storage/v1/b/bucket_name/o" +
- "?uploadType=media&name=new_object&predefinedAcl=publicReadWrite", null);
- assertEquals(request.getHeader("Content-Type"), "text/plain");
- assertEquals(new String(request.getBody(), UTF_8), testPayload);
- }
-
- public void delete() throws Exception {
- server.enqueue(new MockResponse());
-
- // TODO: Should this be returning True on not found?
- assertTrue(objectApi().deleteObject("test", "object_name"));
- assertSent(server, "DELETE", "/storage/v1/b/test/o/object_name", null);
- }
-
- public void delete_encoded() throws Exception {
- server.enqueue(new MockResponse());
-
- // TODO: Should this be returning True on not found?
- assertTrue(objectApi().deleteObject("test", Strings2.urlEncode("dir/object name")));
- assertSent(server, "DELETE", "/storage/v1/b/test/o/dir%2Fobject%20name", null);
- }
-
- public void list() throws Exception {
- server.enqueue(jsonResponse("/object_list.json"));
-
- assertEquals(objectApi().listObjects("test"),
- new ParseGoogleCloudStorageObjectListTest().expected());
- assertSent(server, "GET", "/storage/v1/b/test/o");
- }
-
- public void list_with_options() throws Exception {
- server.enqueue(jsonResponse("/object_list.json"));
- ListObjectOptions options = new ListObjectOptions()
- .delimiter("-")
- .prefix("test")
- .versions(Boolean.TRUE)
- .pageToken("asdf")
- .maxResults(4)
- .projection(Projection.FULL);
- assertEquals(objectApi().listObjects("test", options),
- new ParseGoogleCloudStorageObjectListTest().expected());
- assertSent(server, "GET", "/storage/v1/b/test/o?" +
- "delimiter=-&prefix=test&versions=true&pageToken=asdf&maxResults=4&projection=full");
- }
-
- public void update() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) 1000).crc32c("crc32c");
-
- assertEquals(objectApi().updateObject("test", "file_name", template),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "PUT", "/storage/v1/b/test/o/file_name", APPLICATION_JSON,
- "{" +
- " \"name\": \"file_name\"," +
- " \"size\": 1000," +
- " \"crc32c\": \"crc32c\"" +
- "}");
- }
-
- public void patch() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) 1000).crc32c("crc32c");
-
- assertEquals(objectApi().patchObject("test", "file_name", template),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "PATCH", "/storage/v1/b/test/o/file_name", APPLICATION_JSON,
- "{" +
- " \"name\": \"file_name\"," +
- " \"size\": 1000," +
- " \"crc32c\": \"crc32c\"" +
- "}");
- }
-
- public void compose() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) 1000).crc32c("crc32c");
-
- ComposeObjectTemplate composeTemplate = ComposeObjectTemplate.builder()
- .fromGoogleCloudStorageObject(new ParseGoogleCloudStorageObjectListTest().expected())
- .destination(template).build();
-
- assertEquals(objectApi().composeObjects("destination_bucket", "destination_object", composeTemplate),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "POST", "/storage/v1/b/destination_bucket/o/destination_object/compose", APPLICATION_JSON,
- stringFromResource("/object_compose_request.json"));
- }
-
- public void compose_with_options() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) 1000).crc32c("crc32c");
- ComposeObjectTemplate composeTemplate = ComposeObjectTemplate.builder()
- .fromGoogleCloudStorageObject(new ParseGoogleCloudStorageObjectListTest().expected())
- .destination(template).build();
-
- ComposeObjectOptions options = new ComposeObjectOptions()
- .destinationPredefinedAcl(DestinationPredefinedAcl.BUCKET_OWNER_FULLCONTROL)
- .ifMetagenerationMatch((long) 15);
-
- assertEquals(objectApi().composeObjects("destination_bucket", "destination_object", composeTemplate, options),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "POST", "/storage/v1/b/destination_bucket/o/destination_object/compose" +
- "?destinationPredefinedAcl=bucketOwnerFullcontrol&ifMetagenerationMatch=15", APPLICATION_JSON,
- stringFromResource("/object_compose_request.json"));
- }
-
- public void copy() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- assertEquals(objectApi().copyObject("destination_bucket", "destination_object", "source_bucket", "source_object"),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "POST", "/storage/v1/b/source_bucket/o/source_object/copyTo" +
- "/b/destination_bucket/o/destination_object", APPLICATION_JSON);
- }
-
- public void copy_update_metadata() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) 1000).crc32c("crc32c");
-
- assertEquals(objectApi().copyObject("destination_bucket", "destination_object", "source_bucket", "source_object", template),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "POST", "/storage/v1/b/source_bucket/o/source_object/copyTo" +
- "/b/destination_bucket/o/destination_object", APPLICATION_JSON, "{" +
- " \"name\": \"file_name\"," +
- " \"size\": 1000," +
- " \"crc32c\": \"crc32c\"" +
- "}");
- }
-
- public void copy_with_options() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- CopyObjectOptions options = new CopyObjectOptions().ifGenerationMatch((long) 50);
-
- assertEquals(objectApi().copyObject("destination_bucket", "destination_object", "source_bucket", "source_object", options),
- new ParseGoogleCloudStorageObject().expected());
- assertSent(server, "POST", "/storage/v1/b/source_bucket/o/source_object/copyTo" +
- "/b/destination_bucket/o/destination_object?ifGenerationMatch=50", APPLICATION_JSON);
- }
-
- public void multipartUpload() throws Exception {
- server.enqueue(jsonResponse("/object_get.json"));
-
- PayloadEnclosing p = new PayloadEnclosingImpl();
- String testPayload = "this is a test payload for upload!";
- p.setPayload(testPayload.getBytes());
-
- ObjectTemplate template = new ObjectTemplate().name("file_name").size((long) testPayload.length()).crc32c("crc32c").contentType(MediaType.ANY_TEXT_TYPE);
-
- assertEquals(objectApi().multipartUpload("bucket_name", template, p.getPayload()),
- new ParseGoogleCloudStorageObject().expected());
-
- RecordedRequest request = assertSent(server, "POST", "/upload/storage/v1/b/bucket_name/o?uploadType=multipart", null);
- assertTrue(new String(request.getBody(), UTF_8).contains(testPayload));
-
- assertTrue(new String(request.getBody(), UTF_8).contains(testPayload));
- //TODO: this should be a more robust assertion about the formatting of the payload
- }
-
- public void rewrite() throws Exception {
- server.enqueue(jsonResponse("/object_rewrite.json"));
-
- assertEquals(objectApi().rewriteObjects("destinationBucket", "destinationObject", "sourceBucket", "sourceObject"),
- new ParseObjectRewriteResponse().expected());
-
- assertSent(server, "POST", "/storage/v1/b/sourceBucket/o/sourceObject/rewriteTo/b/destinationBucket/o/destinationObject");
- }
-
- public void rewriteWithOptions() throws Exception {
- server.enqueue(jsonResponse("/object_rewrite.json"));
-
- RewriteObjectOptions options = new RewriteObjectOptions.Builder().rewriteToken("rewriteToken");
- assertEquals(objectApi().rewriteObjects("destinationBucket", "destinationObject", "sourceBucket", "sourceObject", options),
- new ParseObjectRewriteResponse().expected());
-
- assertSent(server, "POST",
- "/storage/v1/b/sourceBucket/o/sourceObject/rewriteTo/b/destinationBucket/o/destinationObject?rewriteToken=rewriteToken");
- }
-
- public ObjectApi objectApi(){
- return api().getObjectApi();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ResumableUploadApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ResumableUploadApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ResumableUploadApiLiveTest.java
deleted file mode 100644
index 441c255..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ResumableUploadApiLiveTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.features;
-
-import static javax.ws.rs.core.Response.Status.CREATED;
-import static javax.ws.rs.core.Response.Status.OK;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.util.UUID;
-
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.ResumableUpload;
-import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
-import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageApiLiveTest;
-import org.jclouds.io.Payloads;
-import org.jclouds.io.payloads.ByteSourcePayload;
-import org.jclouds.utils.TestUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.io.ByteSource;
-
-public class ResumableUploadApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
-
- private static final String BUCKET_NAME = "resumableuploadbucket" + UUID.randomUUID();
- private static final String UPLOAD_OBJECT_NAME = "jcloudslogo.jpg";
- private static final String CHUNKED_OBJECT_NAME = "jclouds.pdf";
- private static final int INCOMPLETE = 308;
- private static final long MIN_CHUNK_SIZE = 256 * 1024; // Min allowed size for a chunk
-
- private ResumableUploadApi api() {
- return api.getResumableUploadApi();
- }
-
- @BeforeClass
- private void createBucket() {
- BucketTemplate template = new BucketTemplate().name(BUCKET_NAME);
- Bucket bucket = api.getBucketApi().createBucket(PROJECT_NUMBER, template);
- assertNotNull(bucket);
- }
-
- @Test(groups = "live")
- public void testResumableJpegUpload() throws IOException {
-
- // Read Object
- long contentLength = MIN_CHUNK_SIZE * 4;
- ByteSource byteSource = TestUtils.randomByteSource().slice(0, contentLength);
-
- // Initialize resumableUpload with metadata. ObjectTemaplete must provide the name
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- ObjectTemplate template = new ObjectTemplate();
- template.contentType("image/jpeg").addAcl(oacl).size(contentLength).name(UPLOAD_OBJECT_NAME)
- .contentLanguage("en").contentDisposition("attachment");
-
- ResumableUpload initResponse = api().initResumableUpload(BUCKET_NAME, "image/jpeg", contentLength, template);
-
- assertNotNull(initResponse);
- assertEquals(initResponse.statusCode(), OK.getStatusCode());
- assertNotNull(initResponse.uploadId());
-
- String uploadId = initResponse.uploadId();
-
- // Upload the payload
- ByteSourcePayload payload = Payloads.newByteSourcePayload(byteSource);
- ResumableUpload uploadResponse = api().upload(BUCKET_NAME, uploadId, "image/jpeg", byteSource.read().length + "",
- payload);
-
- assertEquals(uploadResponse.statusCode(), OK.getStatusCode());
-
- // CheckStatus
- ResumableUpload status = api().checkStatus(BUCKET_NAME, uploadId, "bytes */*");
-
- int code = status.statusCode();
- assertNotEquals(code, INCOMPLETE);
- }
-
- @Test(groups = "live")
- public void testResumableChunkedUpload() throws IOException, InterruptedException {
-
- // Read Object
- long contentLength = MIN_CHUNK_SIZE * 3;
- ByteSource byteSource = TestUtils.randomByteSource().slice(0, contentLength);
-
- // Initialize resumableUpload with metadata. ObjectTemaplete must provide the name
- ObjectAccessControls oacl = ObjectAccessControls.builder().bucket(BUCKET_NAME).entity("allUsers")
- .role(ObjectRole.OWNER).build();
-
- ObjectTemplate template = new ObjectTemplate();
- template.contentType("application/pdf").addAcl(oacl).size(contentLength).name(CHUNKED_OBJECT_NAME)
- .contentLanguage("en").contentDisposition("attachment");
-
- ResumableUpload initResponse = api().initResumableUpload(BUCKET_NAME, "application/pdf", contentLength, template);
-
- assertNotNull(initResponse);
- assertEquals(initResponse.statusCode(), OK.getStatusCode());
- assertNotNull(initResponse.uploadId());
-
- // Get the upload_id for the session
- String uploadId = initResponse.uploadId();
-
- // Check the status first
- ResumableUpload status = api().checkStatus(BUCKET_NAME, uploadId, "bytes */*");
- int code = status.statusCode();
- assertEquals(code, INCOMPLETE);
-
- // Uploads in 2 chunks.
- long totalSize = byteSource.read().length;
- long offset = 0;
- // Size of the first chunk
- long chunkSize = MIN_CHUNK_SIZE * 2;
-
- // Uploading First chunk
- ByteSourcePayload payload = Payloads.newByteSourcePayload(byteSource.slice(offset, chunkSize));
- long length = byteSource.slice(offset, chunkSize).size();
- String Content_Range = generateContentRange(0L, length - 1, totalSize);
- ResumableUpload uploadResponse = api().chunkUpload(BUCKET_NAME, uploadId, "application/pdf", length,
- Content_Range, payload);
-
- int code2 = uploadResponse.statusCode();
- assertEquals(code2, INCOMPLETE);
-
- // Read uploaded length
- long lowerValue = uploadResponse.rangeLowerValue();
- long uploaded = uploadResponse.rangeUpperValue();
-
- assertThat(lowerValue).isEqualTo(0);
- assertThat(uploaded).isEqualTo(chunkSize - 1); // confirms chunk is totally uploaded
-
- long resumeLength = totalSize - (uploaded + 1);
-
- // 2nd chunk
- ByteSourcePayload payload2 = Payloads.newByteSourcePayload(byteSource.slice(uploaded + 1,
- byteSource.read().length - uploaded - 1));
- // Upload the 2nd chunk
- String Content_Range2 = generateContentRange(uploaded + 1, totalSize - 1, totalSize);
- ResumableUpload resumeResponse = api().chunkUpload(BUCKET_NAME, uploadId, "application/pdf", resumeLength,
- Content_Range2, payload2);
-
- int code3 = resumeResponse.statusCode();
- assertThat(code3).isIn(OK.getStatusCode(), CREATED.getStatusCode()); // 200 or 201 if upload succeeded
- }
-
- @AfterClass
- private void deleteObjectsandBucket() {
- api.getObjectApi().deleteObject(BUCKET_NAME, UPLOAD_OBJECT_NAME);
- api.getObjectApi().deleteObject(BUCKET_NAME, CHUNKED_OBJECT_NAME);
- api.getBucketApi().deleteBucket(BUCKET_NAME);
- }
-
- private static String generateContentRange(Long lowerLimit, Long upperLimit, Long totalSize) {
- return "bytes " + lowerLimit + "-" + upperLimit + "/" + totalSize;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandlerTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandlerTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandlerTest.java
deleted file mode 100644
index 668eadb..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandlerTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.handlers;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reportMatcher;
-import static org.easymock.EasyMock.verify;
-
-import java.net.URI;
-
-import org.easymock.IArgumentMatcher;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "GoogleStorageErrorHandlerTest")
-public class GoogleCloudStorageErrorHandlerTest {
-
- @Test
- public void test409MakesIllegalStateException() {
- assertCodeMakes("POST", URI.create("https://www.googleapis.com/storage/v1"), 409, "HTTP/1.1 409 Conflict",
- "\"{\"code\":\"InvalidState\",\"message\":\"An incompatible transition has already been queued for this"
- + " resource\"}\"", IllegalStateException.class);
- }
-
- @Test
- public void test401MakesAuthorizationException() {
- assertCodeMakes("POST", URI.create("https://www.googleapis.com/storage/v1"), 401, "HTTP/1.1 401 Unauthorized",
- "Login Required", AuthorizationException.class);
- }
-
- @Test
- public void test403MakesAuthorizationException() {
- assertCodeMakes("POST", URI.create("https://www.googleapis.com/storage/v1"), 403, "HTTP/1.1 403 Forbidden",
- "Login Required", AuthorizationException.class);
- }
-
- @Test
- public void test404MakesResourceNotFoundException() {
- assertCodeMakes("POST", URI.create("https://www.googleapis.com/storage/v1"), 404, "HTTP/1.1 404 Not Found",
- "Not Found", ResourceNotFoundException.class);
- }
-
- private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
- Class<? extends Exception> expected) {
- assertCodeMakes(method, uri, statusCode, message, "application/json", content, expected);
- }
-
- private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
- String content, Class<? extends Exception> expected) {
-
- GoogleCloudStorageErrorHandler function = new GoogleCloudStorageErrorHandler();
-
- HttpCommand command = createMock(HttpCommand.class);
- HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
- HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
- response.getPayload().getContentMetadata().setContentType(contentType);
-
- expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
- command.setException(classEq(expected));
-
- replay(command);
-
- function.handleError(command, response);
-
- verify(command);
- }
-
- public static Exception classEq(final Class<? extends Exception> in) {
- reportMatcher(new IArgumentMatcher() {
-
- @Override
- public void appendTo(StringBuffer buffer) {
- buffer.append("classEq(");
- buffer.append(in);
- buffer.append(")");
- }
-
- @Override
- public boolean matches(Object arg) {
- return arg.getClass() == in;
- }
-
- });
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiExpectTest.java
deleted file mode 100644
index 088932b..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiExpectTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.internal;
-
-import java.util.Properties;
-
-import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
-
-public class BaseGoogleCloudStorageApiExpectTest extends BaseGoogleCloudStorageExpectTest<GoogleCloudStorageApi> {
-
- @Override protected Properties setupProperties() {
- Properties properties = super.setupProperties();
- properties.put("google-cloud-storage.identity", "JcloudTest");
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiLiveTest.java
deleted file mode 100644
index ea4e97f..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiLiveTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.internal;
-
-import java.util.Properties;
-
-import org.jclouds.apis.BaseApiLiveTest;
-import org.jclouds.googlecloud.config.CurrentProject;
-import org.jclouds.googlecloud.internal.TestProperties;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageProviderMetadata;
-import org.jclouds.providers.ProviderMetadata;
-
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-public class BaseGoogleCloudStorageApiLiveTest extends BaseApiLiveTest<GoogleCloudStorageApi> {
-
- protected static String PROJECT_NUMBER;
-
- protected BaseGoogleCloudStorageApiLiveTest() {
- provider = "google-cloud-storage";
- }
-
- @Override protected ProviderMetadata createProviderMetadata(){
- return new GoogleCloudStorageProviderMetadata();
- }
-
- @Override protected Properties setupProperties() {
- TestProperties.setGoogleCredentialsFromJson(provider);
- Properties props = TestProperties.apply(provider, super.setupProperties());
- PROJECT_NUMBER = CurrentProject.ClientEmail.toProjectNumber(System.getProperty("test.google-cloud-storage.identity"));
- return props;
- }
-
- @Override protected GoogleCloudStorageApi create(Properties props, Iterable<Module> modules) {
- Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
- return injector.getInstance(GoogleCloudStorageApi.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiMockTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiMockTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiMockTest.java
deleted file mode 100644
index c303145..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiMockTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.internal;
-
-import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.jclouds.googlecloud.config.GoogleCloudProperties.CREDENTIAL_TYPE;
-import static org.jclouds.googlecloud.config.GoogleCloudProperties.PROJECT_NAME;
-import static org.jclouds.oauth.v2.config.CredentialType.BEARER_TOKEN_CREDENTIALS;
-import static org.jclouds.util.Strings2.toStringAndClose;
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.concurrent.config.ExecutorServiceModule;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageProviderMetadata;
-import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.gson.JsonParser;
-import com.google.inject.AbstractModule;
-import com.squareup.okhttp.mockwebserver.MockResponse;
-import com.squareup.okhttp.mockwebserver.MockWebServer;
-import com.squareup.okhttp.mockwebserver.RecordedRequest;
-
-/**
- * Tests need to run {@code singleThreaded = true} as otherwise tests will clash on the server field.
- * Sharing the server field means less code to write.
- */
-public class BaseGoogleCloudStorageApiMockTest {
-
- protected final String identity = "761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com";
- protected final String credential = "1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M"; // Fake Bearer Token
-
- protected MockWebServer server;
-
- protected GoogleCloudStorageApi api() {
- return builder().buildApi(GoogleCloudStorageApi.class);
- }
-
-
- protected ContextBuilder builder() {
- Properties overrides = new Properties();
- overrides.put(PROJECT_NAME, "party");
- overrides.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString());
- return ContextBuilder.newBuilder(new GoogleCloudStorageProviderMetadata())
- .credentials(identity, credential)
- .endpoint(url(""))
- .overrides(overrides)
- .modules(modules);
- }
-
- private final Set<AbstractModule> modules = ImmutableSet
- .of(new ExecutorServiceModule(sameThreadExecutor()), new OkHttpCommandExecutorServiceModule());
-
-
- final AtomicInteger suffix = new AtomicInteger();
-
- @BeforeMethod
- public void start() throws IOException {
- suffix.set(0);
- server = new MockWebServer();
- server.play();
- }
-
- protected String url(String path) {
- return server.getUrl(path).toString();
- }
-
- @AfterMethod(alwaysRun = true)
- public void stop() throws IOException {
- server.shutdown();
- }
-
- protected MockResponse jsonResponse(String resource) {
- return new MockResponse().addHeader("Content-Type", "application/json").setBody(stringFromResource(resource));
- }
-
- protected MockResponse response404(){
- return new MockResponse().setStatus("HTTP/1.1 404 Not Found");
- }
-
- protected String stringFromResource(String resourceName) {
- try {
- return toStringAndClose(getClass().getResourceAsStream(resourceName));
- } catch (IOException e) {
- throw propagate(e);
- }
- }
-
- protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException {
- return assertSent(server, method, path, APPLICATION_JSON);
- }
- protected RecordedRequest assertSent(MockWebServer server, String method, String path, String type) throws InterruptedException {
- RecordedRequest request = server.takeRequest();
- assertEquals(request.getMethod(), method);
- assertEquals(request.getPath(), path);
- if (type != null){
- assertEquals(request.getHeader("Accept"), type);
- }
- assertEquals(request.getHeader("Authorization"), "Bearer " + credential);
- return request;
- }
-
- protected RecordedRequest assertSent(MockWebServer server, String method, String path, String type, String json)
- throws InterruptedException {
- RecordedRequest request = assertSent(server, method, path, type);
- assertEquals(request.getHeader("Content-Type"), APPLICATION_JSON);
- assertEquals(parser.parse(new String(request.getBody(), UTF_8)), parser.parse(json));
- return request;
- }
-
- /** So that we can ignore formatting. */
- private final JsonParser parser = new JsonParser();
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageExpectTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageExpectTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageExpectTest.java
deleted file mode 100644
index dd3c644..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageExpectTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.internal;
-
-import static com.google.common.base.Charsets.UTF_8;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.io.BaseEncoding.base64Url;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.jclouds.crypto.Pems.privateKeySpec;
-import static org.jclouds.crypto.Pems.publicKeySpec;
-import static org.jclouds.crypto.PemsTest.PRIVATE_KEY;
-import static org.jclouds.crypto.PemsTest.PUBLIC_KEY;
-import static org.jclouds.oauth.v2.config.OAuthProperties.JWS_ALG;
-
-import java.io.IOException;
-import java.net.URI;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.spec.InvalidKeySpecException;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.crypto.Crypto;
-import org.jclouds.googlecloudstorage.GoogleCloudStorageProviderMetadata;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payload;
-import org.jclouds.io.Payloads;
-import org.jclouds.oauth.v2.filters.JWTBearerTokenFlow;
-import org.jclouds.oauth.v2.filters.TestJWTBearerTokenFlow;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseRestApiExpectTest;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Joiner;
-import com.google.common.base.Supplier;
-import com.google.common.base.Throwables;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
-import com.google.inject.Binder;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-
-public class BaseGoogleCloudStorageExpectTest<T> extends BaseRestApiExpectTest<T> {
- protected static final String STORAGE_READONLY_SCOPE = "https://www.googleapis.com/auth/devstorage.read_only";
-
- protected static final String STORAGE_READWRITE_SCOPE = "https://www.googleapis.com/auth/devstorage.read_write";
-
- protected static final String STORAGE_FULLCONTROL_SCOPE = "https://www.googleapis.com/auth/devstorage.full_control";
-
- private static final String header = "{\"alg\":\"none\",\"typ\":\"JWT\"}";
-
- private static final String CLAIMS_TEMPLATE = "{" + "\"iss\":\"JcloudTest\"," + "\"scope\":\"%s\","
- + "\"aud\":\"https://accounts.google.com/o/oauth2/token\"," + "\"exp\":3600," + "\"iat\":0}";
-
- protected static final String TOKEN = "1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M";
-
- protected static final HttpResponse TOKEN_RESPONSE = HttpResponse
- .builder()
- .statusCode(200)
- .payload(payloadFromString("{\n" + " \"access_token\" : \"" + TOKEN + "\",\n"
- + " \"token_type\" : \"Bearer\",\n" + " \"expires_in\" : 3600\n" + "}")).build();
-
- protected BaseGoogleCloudStorageExpectTest() {
- provider = "google-cloud-storage";
- }
-
- @Override protected Module createModule() {
- return new Module() {
- @Override
- public void configure(Binder binder) {
- // Predictable time
- binder.bind(JWTBearerTokenFlow.class).to(TestJWTBearerTokenFlow.class);
- try {
- KeyFactory keyfactory = KeyFactory.getInstance("RSA");
- PrivateKey privateKey = keyfactory.generatePrivate(privateKeySpec(ByteSource.wrap(PRIVATE_KEY
- .getBytes(UTF_8))));
- PublicKey publicKey = keyfactory
- .generatePublic(publicKeySpec(ByteSource.wrap(PUBLIC_KEY.getBytes(UTF_8))));
- KeyPair keyPair = new KeyPair(publicKey, privateKey);
- final Crypto crypto = createMock(Crypto.class);
- KeyPairGenerator rsaKeyPairGenerator = createMock(KeyPairGenerator.class);
- final SecureRandom secureRandom = createMock(SecureRandom.class);
- expect(crypto.rsaKeyPairGenerator()).andReturn(rsaKeyPairGenerator).anyTimes();
- rsaKeyPairGenerator.initialize(2048, secureRandom);
- expectLastCall().anyTimes();
- expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair).anyTimes();
- replay(crypto, rsaKeyPairGenerator, secureRandom);
- binder.bind(Crypto.class).toInstance(crypto);
- binder.bind(SecureRandom.class).toInstance(secureRandom);
- } catch (NoSuchAlgorithmException e) {
- propagate(e);
- } catch (InvalidKeySpecException e) {
- propagate(e);
- } catch (IOException e) {
- propagate(e);
- }
- // predictable node names
- final AtomicInteger suffix = new AtomicInteger();
- binder.bind(new TypeLiteral<Supplier<String>>() {
- }).toInstance(new Supplier<String>() {
- @Override
- public String get() {
- return suffix.getAndIncrement() + "";
- }
- });
- }
- };
- }
-
- @Override protected Properties setupProperties() {
- Properties props = super.setupProperties();
- // use no sig algorithm for expect tests (means no credential is required either)
- props.put(JWS_ALG, "none");
- return props;
- }
-
- @Override protected ProviderMetadata createProviderMetadata(){
- return new GoogleCloudStorageProviderMetadata();
- }
-
- @Override
- protected HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) {
- HttpRequestComparisonType reqType = HttpRequestComparisonType.DEFAULT;
- if (input.getPayload() != null) {
- if (MediaType.APPLICATION_JSON.toString().equals(input.getPayload().getContentMetadata().getContentType())) {
- reqType = HttpRequestComparisonType.JSON;
- }
- }
- return reqType;
- }
-
- protected HttpRequest requestForScopes(String... scopes) {
- String claims = String.format(CLAIMS_TEMPLATE, Joiner.on(",").join(scopes));
-
- String payload = "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" +
- // Base64 Encoded Header
- "assertion=" + base64Url().omitPadding().encode(header.getBytes(UTF_8)) + "." +
- // Base64 Encoded Claims
- base64Url().omitPadding().encode(claims.getBytes(UTF_8)) + ".";
-
- return HttpRequest.builder().method("POST").endpoint(URI.create("https://accounts.google.com/o/oauth2/token"))
- .addHeader("Accept", MediaType.APPLICATION_JSON)
- .payload(payloadFromStringWithContentType(payload, "application/x-www-form-urlencoded")).build();
- }
-
- protected Payload staticPayloadFromResource(String resource) {
- try {
- return Payloads.newStringPayload(Resources.toString(Resources.getResource(getClass(), resource), Charsets.UTF_8));
- } catch (IOException ex) {
- throw Throwables.propagate(ex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageParseTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageParseTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageParseTest.java
deleted file mode 100644
index 52820e6..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageParseTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.internal;
-
-import java.util.Date;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloudstorage.config.GoogleCloudStorageParserModule;
-import org.jclouds.json.BaseItemParserTest;
-import org.jclouds.json.config.GsonModule;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-public abstract class BaseGoogleCloudStorageParseTest<T> extends BaseItemParserTest<T> {
-
- @Override protected Injector injector() {
- return Guice.createInjector(new GsonModule(), new GoogleCloudStorageParserModule());
- }
-
- protected static Date parse(String iso8601) {
- return new SimpleDateFormatDateService().iso8601DateParse(iso8601);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclGetTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclGetTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclGetTest.java
deleted file mode 100644
index 4544128..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclGetTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class BucketAclGetTest extends BaseGoogleCloudStorageParseTest<BucketAccessControls> {
-
- @Override
- public String resource() {
- return "/bucket_acl_get.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public BucketAccessControls expected() {
- return BucketAccessControls.builder().bucket("jcloudstestbucket").entity("allUsers").role(Role.READER)
- .id("jcloudstestbucket/allUsers").build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclInsertTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclInsertTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclInsertTest.java
deleted file mode 100644
index d7cac85..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclInsertTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class BucketAclInsertTest extends BaseGoogleCloudStorageParseTest<BucketAccessControls> {
-
- @Override
- public String resource() {
- return "/bucket_acl_insert_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public BucketAccessControls expected() {
- return BucketAccessControls
- .builder()
- .id("jcloudstestbucket/allAuthenticatedUsers")
- .bucket("jcloudstestbucket").entity("allAuthenticatedUsers").role(Role.WRITER).build();
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclListTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclListTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclListTest.java
deleted file mode 100644
index 3f6a0d4..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclListTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam.Team;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-import org.jclouds.rest.annotations.SelectJson;
-
-import com.google.common.collect.ImmutableList;
-
-public class BucketAclListTest extends BaseGoogleCloudStorageParseTest<List<BucketAccessControls>> {
-
- private BucketAccessControls item_1 = BucketAccessControls.builder().id("jcloudstestbucket/allUsers")
- .bucket("jcloudstestbucket").entity("allUsers").role(Role.READER).build();
-
- private BucketAccessControls item_2 = BucketAccessControls
- .builder()
- .id("jcloudstestbucket/project-owners-1082289308625")
- .projectTeam(ProjectTeam.create("1082289308625", Team.OWNERS))
- .bucket("jcloudstestbucket").entity("project-owners-1082289308625").role(Role.OWNER).build();
-
- @Override
- public String resource() {
- return "/bucket_acl_list.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- @SelectJson("items")
- public List<BucketAccessControls> expected() {
- return ImmutableList.of(item_1, item_2);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclUpdateTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclUpdateTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclUpdateTest.java
deleted file mode 100644
index b3548f2..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketAclUpdateTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
-import org.jclouds.googlecloudstorage.domain.BucketAccessControls.Role;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class BucketAclUpdateTest extends BaseGoogleCloudStorageParseTest<BucketAccessControls> {
-
- @Override
- public String resource() {
- return "/bucket_acl_update_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public BucketAccessControls expected() {
- return BucketAccessControls.builder().id("jcloudstestbucket/allUsers")
- .bucket("jcloudstestbucket").entity("allUsers").role(Role.OWNER).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketUpdateTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketUpdateTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketUpdateTest.java
deleted file mode 100644
index df28169..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/BucketUpdateTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.googlecloudstorage.domain.Bucket;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Location;
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.StorageClass;
-import org.jclouds.googlecloudstorage.domain.Owner;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class BucketUpdateTest extends BaseGoogleCloudStorageParseTest<Bucket> {
-
- @Override
- public String resource() {
- return "/bucket_update_response.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public Bucket expected() {
- return Bucket.create(
- "bhashbucket", // id
- "bhashbucket", // name
- 1082289308625L, // projectNumber
- new SimpleDateFormatDateService().iso8601DateParse("2014-06-02T19:19:41.112z"), // timeCreated
- 204L, // metageneration
- null, // acl
- null, // defaultObjectAcl
- Owner.create("project-owners-1082289308625", null), // owner
- Location.US, // location
- null, // website
- null, // logging
- null, // versioning
- null, // cors
- null, // lifeCycle
- StorageClass.STANDARD // storageClass
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclGetTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclGetTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclGetTest.java
deleted file mode 100644
index 0183d71..0000000
--- a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/parse/DefaultObjectAclGetTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.jclouds.googlecloudstorage.parse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
-import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam;
-import org.jclouds.googlecloudstorage.domain.ProjectTeam.Team;
-import org.jclouds.googlecloudstorage.internal.BaseGoogleCloudStorageParseTest;
-
-public class DefaultObjectAclGetTest extends BaseGoogleCloudStorageParseTest<ObjectAccessControls> {
-
- @Override
- public String resource() {
- return "/default_object_acl_get.json";
- }
-
- @Override
- @Consumes(MediaType.APPLICATION_JSON)
- public ObjectAccessControls expected() {
- return ObjectAccessControls.builder().entity("project-owners-1082289308625").role(ObjectRole.OWNER)
- .projectTeam(ProjectTeam.create("1082289308625", Team.OWNERS))
- .build();
- }
-}