A simple usage example showing how to create a table if it does not exist and load data into * it. For the complete source code see - * + * * CreateTableAndLoadData.java. *
{@code
* BigQuery bigquery = BigQueryOptions.defaultInstance().service();
@@ -44,4 +44,4 @@
*
* @see Google Cloud BigQuery
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpc.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpc.java
similarity index 98%
rename from gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpc.java
rename to gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpc.java
index d0b740e9e390..e221079cdd03 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpc.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpc.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery.spi;
+package com.google.cloud.bigquery.spi;
import com.google.api.services.bigquery.model.Dataset;
import com.google.api.services.bigquery.model.GetQueryResultsResponse;
@@ -26,7 +26,7 @@
import com.google.api.services.bigquery.model.TableDataInsertAllRequest;
import com.google.api.services.bigquery.model.TableDataInsertAllResponse;
import com.google.api.services.bigquery.model.TableRow;
-import com.google.gcloud.bigquery.BigQueryException;
+import com.google.cloud.bigquery.BigQueryException;
import java.util.Map;
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpcFactory.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpcFactory.java
similarity index 85%
rename from gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpcFactory.java
rename to gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpcFactory.java
index 1323ec0624f4..8c9fb2413a41 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/BigQueryRpcFactory.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/BigQueryRpcFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery.spi;
+package com.google.cloud.bigquery.spi;
-import com.google.gcloud.bigquery.BigQueryOptions;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.bigquery.BigQueryOptions;
+import com.google.cloud.spi.ServiceRpcFactory;
/**
* An interface for BigQuery RPC factory.
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/DefaultBigQueryRpc.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java
similarity index 95%
rename from gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/DefaultBigQueryRpc.java
rename to gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java
index 71712bda7806..59cc7730107f 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/spi/DefaultBigQueryRpc.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/spi/DefaultBigQueryRpc.java
@@ -12,17 +12,17 @@
* the License.
*/
-package com.google.gcloud.bigquery.spi;
+package com.google.cloud.bigquery.spi;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.ALL_DATASETS;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.ALL_USERS;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.DELETE_CONTENTS;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.FIELDS;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.MAX_RESULTS;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.PAGE_TOKEN;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.START_INDEX;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.STATE_FILTER;
-import static com.google.gcloud.bigquery.spi.BigQueryRpc.Option.TIMEOUT;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.ALL_DATASETS;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.ALL_USERS;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.DELETE_CONTENTS;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.FIELDS;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.MAX_RESULTS;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.PAGE_TOKEN;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.START_INDEX;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.STATE_FILTER;
+import static com.google.cloud.bigquery.spi.BigQueryRpc.Option.TIMEOUT;
import static java.net.HttpURLConnection.HTTP_CREATED;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_OK;
@@ -60,8 +60,8 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import com.google.gcloud.bigquery.BigQueryException;
-import com.google.gcloud.bigquery.BigQueryOptions;
+import com.google.cloud.bigquery.BigQueryException;
+import com.google.cloud.bigquery.BigQueryOptions;
import java.io.IOException;
import java.math.BigInteger;
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/RemoteBigQueryHelper.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelper.java
similarity index 94%
rename from gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/RemoteBigQueryHelper.java
rename to gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelper.java
index 491e822d683c..d844ad56235a 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/RemoteBigQueryHelper.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelper.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery.testing;
+package com.google.cloud.bigquery.testing;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQueryException;
-import com.google.gcloud.bigquery.BigQueryOptions;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.RetryParams;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQueryException;
+import com.google.cloud.bigquery.BigQueryOptions;
import java.io.IOException;
import java.io.InputStream;
diff --git a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/package-info.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/package-info.java
similarity index 96%
rename from gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/package-info.java
rename to gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/package-info.java
index 9ca792ecd77d..be00683c9ce8 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/package-info.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/testing/package-info.java
@@ -35,4 +35,4 @@
* @see
* gcloud-java tools for testing
*/
-package com.google.gcloud.bigquery.testing;
+package com.google.cloud.bigquery.testing;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/AclTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java
similarity index 88%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/AclTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java
index 438526b95b6e..51b5e1ad496e 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/AclTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/AclTest.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import com.google.api.services.bigquery.model.Dataset;
-import com.google.gcloud.bigquery.Acl.Domain;
-import com.google.gcloud.bigquery.Acl.Entity;
-import com.google.gcloud.bigquery.Acl.Entity.Type;
-import com.google.gcloud.bigquery.Acl.Group;
-import com.google.gcloud.bigquery.Acl.Role;
-import com.google.gcloud.bigquery.Acl.User;
-import com.google.gcloud.bigquery.Acl.View;
+import com.google.cloud.bigquery.Acl.Domain;
+import com.google.cloud.bigquery.Acl.Entity;
+import com.google.cloud.bigquery.Acl.Entity.Type;
+import com.google.cloud.bigquery.Acl.Group;
+import com.google.cloud.bigquery.Acl.Role;
+import com.google.cloud.bigquery.Acl.User;
+import com.google.cloud.bigquery.Acl.View;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryErrorTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryErrorTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryErrorTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryErrorTest.java
index c8de039e233f..1d30bb87815e 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryErrorTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryErrorTest.java
@@ -1,4 +1,4 @@
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryExceptionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryExceptionTest.java
similarity index 96%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryExceptionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryExceptionTest.java
index 66e5289424e2..b0a32cd7f0c7 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryExceptionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryExceptionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@@ -25,8 +25,8 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java
index c7d7cf846ef2..7cb7b162fd10 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.eq;
@@ -36,13 +36,13 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.gcloud.Page;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.bigquery.InsertAllRequest.RowToInsert;
-import com.google.gcloud.bigquery.spi.BigQueryRpc;
-import com.google.gcloud.bigquery.spi.BigQueryRpc.Tuple;
-import com.google.gcloud.bigquery.spi.BigQueryRpcFactory;
+import com.google.cloud.Page;
+import com.google.cloud.RetryParams;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.bigquery.InsertAllRequest.RowToInsert;
+import com.google.cloud.bigquery.spi.BigQueryRpc;
+import com.google.cloud.bigquery.spi.BigQueryRpc.Tuple;
+import com.google.cloud.bigquery.spi.BigQueryRpcFactory;
import org.easymock.Capture;
import org.easymock.EasyMock;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CopyJobConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CopyJobConfigurationTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CopyJobConfigurationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CopyJobConfigurationTest.java
index 3f3f6f0fd15c..54d2370b1c57 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CopyJobConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CopyJobConfigurationTest.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.bigquery.JobInfo.CreateDisposition;
-import com.google.gcloud.bigquery.JobInfo.WriteDisposition;
+import com.google.cloud.bigquery.JobInfo.CreateDisposition;
+import com.google.cloud.bigquery.JobInfo.WriteDisposition;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CsvOptionsTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CsvOptionsTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CsvOptionsTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CsvOptionsTest.java
index 371202174431..df56a5ae096e 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/CsvOptionsTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/CsvOptionsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetIdTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetIdTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetIdTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetIdTest.java
index ec645d71c96f..5cf627a42e38 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetIdTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetIdTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetInfoTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetInfoTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java
index 474a31d44a20..6e9c961f207f 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetInfoTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java
index 43c550c59d11..747c8ae4f0dc 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/DatasetTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/DatasetTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
@@ -32,8 +32,8 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
import org.junit.After;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExternalTableDefinitionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExternalTableDefinitionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java
index 247032dff890..e3e1c01b9403 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExternalTableDefinitionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExternalTableDefinitionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExtractJobConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExtractJobConfigurationTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExtractJobConfigurationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExtractJobConfigurationTest.java
index 7ac67f41b1f8..62d5274e491d 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ExtractJobConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ExtractJobConfigurationTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldTest.java
index 5f039eaed206..8e044d889313 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldValueTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldValueTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java
index d6d879dbd58f..82086768b8ce 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FieldValueTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FieldValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FormatOptionsTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FormatOptionsTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FormatOptionsTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FormatOptionsTest.java
index df939143156b..7406d8a7a283 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/FormatOptionsTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/FormatOptionsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllRequestTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllRequestTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllRequestTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllRequestTest.java
index 0866f0b9349e..607b6c4145a8 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllRequestTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllRequestTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllResponseTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllResponseTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllResponseTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllResponseTest.java
index b2eb0458f27f..dc30620200bc 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/InsertAllResponseTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/InsertAllResponseTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobIdTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobIdTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobIdTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobIdTest.java
index 740830f07544..68caf62413c9 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobIdTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobIdTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobInfoTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobInfoTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobInfoTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobInfoTest.java
index 9c90fbe7b05f..16fe980fe171 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobInfoTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -23,11 +23,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.bigquery.JobInfo.CreateDisposition;
-import com.google.gcloud.bigquery.JobInfo.WriteDisposition;
-import com.google.gcloud.bigquery.JobStatistics.ExtractStatistics;
-import com.google.gcloud.bigquery.JobStatistics.LoadStatistics;
-import com.google.gcloud.bigquery.JobStatistics.QueryStatistics;
+import com.google.cloud.bigquery.JobInfo.CreateDisposition;
+import com.google.cloud.bigquery.JobInfo.WriteDisposition;
+import com.google.cloud.bigquery.JobStatistics.ExtractStatistics;
+import com.google.cloud.bigquery.JobStatistics.LoadStatistics;
+import com.google.cloud.bigquery.JobStatistics.QueryStatistics;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java
similarity index 96%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java
index 4a3940ba4543..0dc5fea0b1d7 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatisticsTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatisticsTest.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.bigquery.JobStatistics.ExtractStatistics;
-import com.google.gcloud.bigquery.JobStatistics.LoadStatistics;
-import com.google.gcloud.bigquery.JobStatistics.QueryStatistics;
-import com.google.gcloud.bigquery.QueryStage.QueryStep;
+import com.google.cloud.bigquery.JobStatistics.ExtractStatistics;
+import com.google.cloud.bigquery.JobStatistics.LoadStatistics;
+import com.google.cloud.bigquery.JobStatistics.QueryStatistics;
+import com.google.cloud.bigquery.QueryStage.QueryStep;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatusTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatusTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatusTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatusTest.java
index c44386a3e72c..78a4345a339b 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobStatusTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobStatusTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobTest.java
index 61c9c521196a..b2a2461f1267 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/JobTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/JobTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/LoadJobConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/LoadJobConfigurationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java
index 88ae6a4fc1b8..d811f7d1b569 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/LoadJobConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/LoadJobConfigurationTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.bigquery.JobInfo.CreateDisposition;
-import com.google.gcloud.bigquery.JobInfo.WriteDisposition;
+import com.google.cloud.bigquery.JobInfo.CreateDisposition;
+import com.google.cloud.bigquery.JobInfo.WriteDisposition;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/OptionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/OptionTest.java
similarity index 96%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/OptionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/OptionTest.java
index 42f19830fb6c..2e40d63ff80c 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/OptionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/OptionTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
-import com.google.gcloud.bigquery.spi.BigQueryRpc;
+import com.google.cloud.bigquery.spi.BigQueryRpc;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryJobConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryJobConfigurationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
index 1ef270ee69cf..6ad2facb3288 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryJobConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -23,9 +23,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.bigquery.JobInfo.CreateDisposition;
-import com.google.gcloud.bigquery.JobInfo.WriteDisposition;
-import com.google.gcloud.bigquery.QueryJobConfiguration.Priority;
+import com.google.cloud.bigquery.JobInfo.CreateDisposition;
+import com.google.cloud.bigquery.JobInfo.WriteDisposition;
+import com.google.cloud.bigquery.QueryJobConfiguration.Priority;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryRequestTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryRequestTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
index 7875dee9e315..f3682aa78457 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryRequestTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResponseTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResponseTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResponseTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResponseTest.java
index 08e885c8b3aa..8eae6a9e03e3 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResponseTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResponseTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResultTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResultTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResultTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResultTest.java
index b6810ed93143..db4df54bfc0c 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryResultTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryResultTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryStageTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryStageTest.java
index ac60967a8bee..0270abe7efd1 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/QueryStageTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryStageTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import com.google.api.services.bigquery.model.ExplainQueryStep;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.bigquery.QueryStage.QueryStep;
+import com.google.cloud.bigquery.QueryStage.QueryStep;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SchemaTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SchemaTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SchemaTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SchemaTest.java
index d24268d2e7cd..312b7e674991 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SchemaTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SchemaTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SerializationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SerializationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java
index 61e763f9a539..9797a5a5139e 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/SerializationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/SerializationTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.BaseSerializationTest;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.bigquery.StandardTableDefinition.StreamingBuffer;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.BaseSerializationTest;
+import com.google.cloud.Restorable;
+import com.google.cloud.bigquery.StandardTableDefinition.StreamingBuffer;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDataWriteChannelTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDataWriteChannelTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDataWriteChannelTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDataWriteChannelTest.java
index 4c1be470ff57..646d82603950 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDataWriteChannelTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDataWriteChannelTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.capture;
@@ -30,10 +30,10 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.bigquery.spi.BigQueryRpc;
-import com.google.gcloud.bigquery.spi.BigQueryRpcFactory;
+import com.google.cloud.RestorableState;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.bigquery.spi.BigQueryRpc;
+import com.google.cloud.bigquery.spi.BigQueryRpcFactory;
import org.easymock.Capture;
import org.easymock.CaptureType;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDefinitionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDefinitionTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDefinitionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDefinitionTest.java
index d1e3635d00cb..7c7cf2568462 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableDefinitionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableDefinitionTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.bigquery.StandardTableDefinition.StreamingBuffer;
+import com.google.cloud.bigquery.StandardTableDefinition.StreamingBuffer;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableIdTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableIdTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableIdTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableIdTest.java
index bc013bfa5c31..7db923bdd7ca 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableIdTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableIdTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableInfoTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
similarity index 99%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableInfoTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
index 84d224f220cb..0b67f4be3adf 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableInfoTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableTest.java
index cab71d4705d5..58f187c1cedd 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/TableTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/TableTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
@@ -31,9 +31,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterators;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.bigquery.InsertAllRequest.RowToInsert;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
+import com.google.cloud.bigquery.InsertAllRequest.RowToInsert;
import org.junit.After;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/UserDefinedFunctionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/UserDefinedFunctionTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/UserDefinedFunctionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/UserDefinedFunctionTest.java
index 2741aaed89a5..db6cada4e0e5 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/UserDefinedFunctionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/UserDefinedFunctionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ViewDefinitionTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ViewDefinitionTest.java
similarity index 98%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ViewDefinitionTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ViewDefinitionTest.java
index ebab7a6e87ca..25c880bc8b78 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ViewDefinitionTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/ViewDefinitionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/WriteChannelConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/WriteChannelConfigurationTest.java
similarity index 97%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/WriteChannelConfigurationTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/WriteChannelConfigurationTest.java
index dfde4795dacd..03ffbcaf38e3 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/WriteChannelConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/WriteChannelConfigurationTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.bigquery.JobInfo.CreateDisposition;
-import com.google.gcloud.bigquery.JobInfo.WriteDisposition;
+import com.google.cloud.bigquery.JobInfo.CreateDisposition;
+import com.google.cloud.bigquery.JobInfo.WriteDisposition;
import org.junit.Test;
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/it/ITBigQueryTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java
similarity index 94%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/it/ITBigQueryTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java
index cc7f06a251db..738245bc80f7 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/it/ITBigQueryTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery.it;
+package com.google.cloud.bigquery.it;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -25,49 +25,49 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.Page;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQuery.DatasetField;
-import com.google.gcloud.bigquery.BigQuery.DatasetOption;
-import com.google.gcloud.bigquery.BigQuery.JobField;
-import com.google.gcloud.bigquery.BigQuery.JobListOption;
-import com.google.gcloud.bigquery.BigQuery.JobOption;
-import com.google.gcloud.bigquery.BigQuery.TableField;
-import com.google.gcloud.bigquery.BigQuery.TableOption;
-import com.google.gcloud.bigquery.BigQueryError;
-import com.google.gcloud.bigquery.BigQueryException;
-import com.google.gcloud.bigquery.CopyJobConfiguration;
-import com.google.gcloud.bigquery.Dataset;
-import com.google.gcloud.bigquery.DatasetId;
-import com.google.gcloud.bigquery.DatasetInfo;
-import com.google.gcloud.bigquery.ExternalTableDefinition;
-import com.google.gcloud.bigquery.ExtractJobConfiguration;
-import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.FieldValue;
-import com.google.gcloud.bigquery.FormatOptions;
-import com.google.gcloud.bigquery.InsertAllRequest;
-import com.google.gcloud.bigquery.InsertAllResponse;
-import com.google.gcloud.bigquery.Job;
-import com.google.gcloud.bigquery.JobInfo;
-import com.google.gcloud.bigquery.JobStatistics;
-import com.google.gcloud.bigquery.LoadJobConfiguration;
-import com.google.gcloud.bigquery.QueryJobConfiguration;
-import com.google.gcloud.bigquery.QueryRequest;
-import com.google.gcloud.bigquery.QueryResponse;
-import com.google.gcloud.bigquery.Schema;
-import com.google.gcloud.bigquery.StandardTableDefinition;
-import com.google.gcloud.bigquery.Table;
-import com.google.gcloud.bigquery.TableDefinition;
-import com.google.gcloud.bigquery.TableId;
-import com.google.gcloud.bigquery.TableInfo;
-import com.google.gcloud.bigquery.ViewDefinition;
-import com.google.gcloud.bigquery.WriteChannelConfiguration;
-import com.google.gcloud.bigquery.testing.RemoteBigQueryHelper;
-import com.google.gcloud.storage.BlobInfo;
-import com.google.gcloud.storage.BucketInfo;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.testing.RemoteGcsHelper;
+import com.google.cloud.Page;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQuery.DatasetField;
+import com.google.cloud.bigquery.BigQuery.DatasetOption;
+import com.google.cloud.bigquery.BigQuery.JobField;
+import com.google.cloud.bigquery.BigQuery.JobListOption;
+import com.google.cloud.bigquery.BigQuery.JobOption;
+import com.google.cloud.bigquery.BigQuery.TableField;
+import com.google.cloud.bigquery.BigQuery.TableOption;
+import com.google.cloud.bigquery.BigQueryError;
+import com.google.cloud.bigquery.BigQueryException;
+import com.google.cloud.bigquery.CopyJobConfiguration;
+import com.google.cloud.bigquery.Dataset;
+import com.google.cloud.bigquery.DatasetId;
+import com.google.cloud.bigquery.DatasetInfo;
+import com.google.cloud.bigquery.ExternalTableDefinition;
+import com.google.cloud.bigquery.ExtractJobConfiguration;
+import com.google.cloud.bigquery.Field;
+import com.google.cloud.bigquery.FieldValue;
+import com.google.cloud.bigquery.FormatOptions;
+import com.google.cloud.bigquery.InsertAllRequest;
+import com.google.cloud.bigquery.InsertAllResponse;
+import com.google.cloud.bigquery.Job;
+import com.google.cloud.bigquery.JobInfo;
+import com.google.cloud.bigquery.JobStatistics;
+import com.google.cloud.bigquery.LoadJobConfiguration;
+import com.google.cloud.bigquery.QueryJobConfiguration;
+import com.google.cloud.bigquery.QueryRequest;
+import com.google.cloud.bigquery.QueryResponse;
+import com.google.cloud.bigquery.Schema;
+import com.google.cloud.bigquery.StandardTableDefinition;
+import com.google.cloud.bigquery.Table;
+import com.google.cloud.bigquery.TableDefinition;
+import com.google.cloud.bigquery.TableId;
+import com.google.cloud.bigquery.TableInfo;
+import com.google.cloud.bigquery.ViewDefinition;
+import com.google.cloud.bigquery.WriteChannelConfiguration;
+import com.google.cloud.bigquery.testing.RemoteBigQueryHelper;
+import com.google.cloud.storage.BlobInfo;
+import com.google.cloud.storage.BucketInfo;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.testing.RemoteStorageHelper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -135,7 +135,7 @@ public class ITBigQueryTest {
private static final String LOAD_FILE = "load.csv";
private static final String JSON_LOAD_FILE = "load.json";
private static final String EXTRACT_FILE = "extract.csv";
- private static final String BUCKET = RemoteGcsHelper.generateBucketName();
+ private static final String BUCKET = RemoteStorageHelper.generateBucketName();
private static final TableId TABLE_ID = TableId.of(DATASET, "testing_table");
private static final String CSV_CONTENT = "StringValue1\nStringValue2\n";
private static final String JSON_CONTENT = "{"
@@ -172,9 +172,9 @@ public class ITBigQueryTest {
@BeforeClass
public static void beforeClass() throws InterruptedException {
RemoteBigQueryHelper bigqueryHelper = RemoteBigQueryHelper.create();
- RemoteGcsHelper gcsHelper = RemoteGcsHelper.create();
+ RemoteStorageHelper storageHelper = RemoteStorageHelper.create();
bigquery = bigqueryHelper.options().service();
- storage = gcsHelper.options().service();
+ storage = storageHelper.options().service();
storage.create(BucketInfo.of(BUCKET));
storage.create(BlobInfo.builder(BUCKET, LOAD_FILE).contentType("text/plain").build(),
CSV_CONTENT.getBytes(StandardCharsets.UTF_8));
@@ -200,7 +200,7 @@ public static void afterClass() throws ExecutionException, InterruptedException
RemoteBigQueryHelper.forceDelete(bigquery, DATASET);
}
if (storage != null) {
- boolean wasDeleted = RemoteGcsHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS);
+ boolean wasDeleted = RemoteStorageHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS);
if (!wasDeleted && LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
diff --git a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/RemoteBigQueryHelperTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelperTest.java
similarity index 95%
rename from gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/RemoteBigQueryHelperTest.java
rename to gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelperTest.java
index 267ae161b7aa..46badf7bb7be 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/RemoteBigQueryHelperTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/testing/RemoteBigQueryHelperTest.java
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.bigquery;
+package com.google.cloud.bigquery.testing;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.bigquery.BigQuery.DatasetDeleteOption;
-import com.google.gcloud.bigquery.testing.RemoteBigQueryHelper;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQuery.DatasetDeleteOption;
+import com.google.cloud.bigquery.BigQueryOptions;
import org.easymock.EasyMock;
import org.junit.Rule;
diff --git a/gcloud-java-contrib/README.md b/gcloud-java-contrib/README.md
index f0ead8c79dea..547040449034 100644
--- a/gcloud-java-contrib/README.md
+++ b/gcloud-java-contrib/README.md
@@ -5,7 +5,7 @@ Packages that provide higher-level abstraction/functionality for common gcloud-j
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-bigquery.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-bigquery.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-bigquery.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-bigquery.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
@@ -14,18 +14,18 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-contrib
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-contrib:0.1.7'
+compile 'com.google.cloud:gcloud-java-contrib:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-contrib" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-contrib" % "0.2.0"
```
Java Versions
diff --git a/gcloud-java-contrib/pom.xml b/gcloud-java-contrib/pom.xml
index 1ef855a1ae5d..1220c7c3776e 100644
--- a/gcloud-java-contrib/pom.xml
+++ b/gcloud-java-contrib/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-contrib
jar
GCloud Java contributions
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-contrib
Contains packages that provide higher-level abstraction/functionality for common gcloud-java use cases.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-contrib
diff --git a/gcloud-java-core/README.md b/gcloud-java-core/README.md
index 067505179bc9..9a659c0f8cc0 100644
--- a/gcloud-java-core/README.md
+++ b/gcloud-java-core/README.md
@@ -5,30 +5,30 @@ This module provides common functionality required by service-specific modules o
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-core.svg)](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-core.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-core.svg)](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-core.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/package-summary.html)
+- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/package-summary.html)
Quickstart
----------
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-core
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-core:0.1.7'
+compile 'com.google.cloud:gcloud-java-core:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-core" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-core" % "0.2.0"
```
Troubleshooting
diff --git a/gcloud-java-core/pom.xml b/gcloud-java-core/pom.xml
index df116b0b1be4..22648d2e6ffa 100644
--- a/gcloud-java-core/pom.xml
+++ b/gcloud-java-core/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-core
jar
GCloud Java core
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-core
Core module for the gcloud-java.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-core
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/AuthCredentials.java b/gcloud-java-core/src/main/java/com/google/cloud/AuthCredentials.java
similarity index 74%
rename from gcloud-java-core/src/main/java/com/google/gcloud/AuthCredentials.java
rename to gcloud-java-core/src/main/java/com/google/cloud/AuthCredentials.java
index 27cafc181505..ec5a631f5f54 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/AuthCredentials.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/AuthCredentials.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -25,9 +25,15 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
+import java.security.Signature;
+import java.security.SignatureException;
import java.util.Collection;
+import java.util.Date;
import java.util.Objects;
/**
@@ -35,16 +41,27 @@
*/
public abstract class AuthCredentials implements Restorable {
- private static class AppEngineAuthCredentials extends AuthCredentials {
+ /**
+ * Represents built-in credentials when running in Google App Engine.
+ */
+ public static class AppEngineAuthCredentials extends AuthCredentials
+ implements ServiceAccountSigner {
private static final AuthCredentials INSTANCE = new AppEngineAuthCredentials();
private static final AppEngineAuthCredentialsState STATE = new AppEngineAuthCredentialsState();
- private static class AppEngineCredentials extends GoogleCredentials {
+ private AppEngineCredentials credentials;
+
+ private static class AppEngineCredentials extends GoogleCredentials
+ implements ServiceAccountSigner {
private final Object appIdentityService;
+ private final String account;
private final Method getAccessToken;
private final Method getAccessTokenResult;
+ private final Method getExpirationTime;
+ private final Method signForApp;
+ private final Method getSignature;
private final Collection scopes;
AppEngineCredentials() {
@@ -59,6 +76,13 @@ private static class AppEngineCredentials extends GoogleCredentials {
"com.google.appengine.api.appidentity.AppIdentityService$GetAccessTokenResult");
this.getAccessTokenResult = serviceClass.getMethod("getAccessToken", Iterable.class);
this.getAccessToken = tokenResultClass.getMethod("getAccessToken");
+ this.getExpirationTime = tokenResultClass.getMethod("getExpirationTime");
+ this.account = (String) serviceClass.getMethod("getServiceAccountName")
+ .invoke(appIdentityService);
+ this.signForApp = serviceClass.getMethod("signForApp", byte[].class);
+ Class> signingResultClass = Class.forName(
+ "com.google.appengine.api.appidentity.AppIdentityService$SigningResult");
+ this.getSignature = signingResultClass.getMethod("getSignature");
this.scopes = null;
} catch (Exception e) {
throw new RuntimeException("Could not create AppEngineCredentials.", e);
@@ -69,11 +93,15 @@ private static class AppEngineCredentials extends GoogleCredentials {
this.appIdentityService = unscoped.appIdentityService;
this.getAccessToken = unscoped.getAccessToken;
this.getAccessTokenResult = unscoped.getAccessTokenResult;
+ this.getExpirationTime = unscoped.getExpirationTime;
+ this.account = unscoped.account;
+ this.signForApp = unscoped.signForApp;
+ this.getSignature = unscoped.getSignature;
this.scopes = scopes;
}
/**
- * Refresh the access token by getting it from the App Identity service
+ * Refresh the access token by getting it from the App Identity service.
*/
@Override
public AccessToken refreshAccessToken() throws IOException {
@@ -83,7 +111,8 @@ public AccessToken refreshAccessToken() throws IOException {
try {
Object accessTokenResult = getAccessTokenResult.invoke(appIdentityService, scopes);
String accessToken = (String) getAccessToken.invoke(accessTokenResult);
- return new AccessToken(accessToken, null);
+ Date expirationTime = (Date) getExpirationTime.invoke(accessTokenResult);
+ return new AccessToken(accessToken, expirationTime);
} catch (Exception e) {
throw new IOException("Could not get the access token.", e);
}
@@ -98,6 +127,21 @@ public boolean createScopedRequired() {
public GoogleCredentials createScoped(Collection scopes) {
return new AppEngineCredentials(scopes, this);
}
+
+ @Override
+ public String account() {
+ return account;
+ }
+
+ @Override
+ public byte[] sign(byte[] toSign) {
+ try {
+ Object signingResult = signForApp.invoke(appIdentityService, toSign);
+ return (byte[]) getSignature.invoke(signingResult);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ throw new SigningException("Failed to sign the provided bytes", ex);
+ }
+ }
}
private static class AppEngineAuthCredentialsState
@@ -122,14 +166,27 @@ public boolean equals(Object obj) {
}
@Override
- public GoogleCredentials credentials() {
- return new AppEngineCredentials();
+ public AppEngineCredentials credentials() {
+ if (credentials == null) {
+ credentials = new AppEngineCredentials();
+ }
+ return credentials;
}
@Override
public RestorableState capture() {
return STATE;
}
+
+ @Override
+ public String account() {
+ return credentials().account();
+ }
+
+ @Override
+ public byte[] sign(byte[] toSign) {
+ return credentials().sign(toSign);
+ }
}
/**
@@ -138,8 +195,10 @@ public RestorableState capture() {
* @see
* User accounts and service accounts
*/
- public static class ServiceAccountAuthCredentials extends AuthCredentials {
+ public static class ServiceAccountAuthCredentials extends AuthCredentials
+ implements ServiceAccountSigner {
+ private final ServiceAccountCredentials credentials;
private final String account;
private final PrivateKey privateKey;
@@ -178,23 +237,44 @@ public boolean equals(Object obj) {
}
ServiceAccountAuthCredentials(String account, PrivateKey privateKey) {
- this.account = checkNotNull(account);
- this.privateKey = checkNotNull(privateKey);
+ this(new ServiceAccountCredentials(null, account, privateKey, null, null));
+ }
+
+ ServiceAccountAuthCredentials(ServiceAccountCredentials credentials) {
+ this.credentials = checkNotNull(credentials);
+ this.account = checkNotNull(credentials.getClientEmail());
+ this.privateKey = checkNotNull(credentials.getPrivateKey());
}
@Override
public ServiceAccountCredentials credentials() {
- return new ServiceAccountCredentials(null, account, privateKey, null, null);
+ return credentials;
}
+ @Override
public String account() {
return account;
}
+ /**
+ * Returns the private key associated with the service account credentials.
+ */
public PrivateKey privateKey() {
return privateKey;
}
+ @Override
+ public byte[] sign(byte[] toSign) {
+ try {
+ Signature signer = Signature.getInstance("SHA256withRSA");
+ signer.initSign(privateKey());
+ signer.update(toSign);
+ return signer.sign();
+ } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException ex) {
+ throw new SigningException("Failed to sign the provided bytes", ex);
+ }
+ }
+
@Override
public RestorableState capture() {
return new ServiceAccountAuthCredentialsState(account, privateKey);
@@ -242,6 +322,10 @@ public boolean equals(Object obj) {
}
}
+ ApplicationDefaultAuthCredentials(GoogleCredentials credentials) {
+ googleCredentials = credentials;
+ }
+
ApplicationDefaultAuthCredentials() throws IOException {
googleCredentials = GoogleCredentials.getApplicationDefault();
}
@@ -260,7 +344,7 @@ public RestorableState capture() {
/**
* A placeholder for credentials to signify that requests sent to the server should not be
* authenticated. This is typically useful when using the local service emulators, such as
- * {@code LocalGcdHelper} and {@code LocalResourceManagerHelper}.
+ * {@code LocalDatastoreHelper} and {@code LocalResourceManagerHelper}.
*/
public static class NoAuthCredentials extends AuthCredentials {
@@ -320,7 +404,12 @@ public static AuthCredentials createForAppEngine() {
* @throws IOException if the credentials cannot be created in the current environment
*/
public static AuthCredentials createApplicationDefaults() throws IOException {
- return new ApplicationDefaultAuthCredentials();
+ GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();
+ if (credentials instanceof ServiceAccountCredentials) {
+ ServiceAccountCredentials serviceAccountCredentials = (ServiceAccountCredentials) credentials;
+ return new ServiceAccountAuthCredentials(serviceAccountCredentials);
+ }
+ return new ApplicationDefaultAuthCredentials(credentials);
}
/**
@@ -341,7 +430,7 @@ public static ServiceAccountAuthCredentials createFor(String account, PrivateKey
/**
* Creates a placeholder denoting that no credentials should be used. This is typically useful
- * when using the local service emulators, such as {@code LocalGcdHelper} and
+ * when using the local service emulators, such as {@code LocalDatastoreHelper} and
* {@code LocalResourceManagerHelper}.
*/
public static AuthCredentials noAuth() {
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/BaseService.java b/gcloud-java-core/src/main/java/com/google/cloud/BaseService.java
similarity index 95%
rename from gcloud-java-core/src/main/java/com/google/gcloud/BaseService.java
rename to gcloud-java-core/src/main/java/com/google/cloud/BaseService.java
index d9e6f2db7c95..d0476b66c29c 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/BaseService.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/BaseService.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
-import com.google.gcloud.ExceptionHandler.Interceptor;
+import com.google.cloud.ExceptionHandler.Interceptor;
/**
* Base class for service objects.
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/BaseServiceException.java b/gcloud-java-core/src/main/java/com/google/cloud/BaseServiceException.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/BaseServiceException.java
rename to gcloud-java-core/src/main/java/com/google/cloud/BaseServiceException.java
index 4e0d03e0073a..6dc87f4abb3e 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/BaseServiceException.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/BaseServiceException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/BaseWriteChannel.java b/gcloud-java-core/src/main/java/com/google/cloud/BaseWriteChannel.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/BaseWriteChannel.java
rename to gcloud-java-core/src/main/java/com/google/cloud/BaseWriteChannel.java
index 1d18a5a27e81..f803cd6bbacf 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/BaseWriteChannel.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/BaseWriteChannel.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import com.google.common.base.MoreObjects;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ExceptionHandler.java b/gcloud-java-core/src/main/java/com/google/cloud/ExceptionHandler.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/ExceptionHandler.java
rename to gcloud-java-core/src/main/java/com/google/cloud/ExceptionHandler.java
index 0b3c923d1eb9..e72eb1edcf88 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/ExceptionHandler.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/ExceptionHandler.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java b/gcloud-java-core/src/main/java/com/google/cloud/FieldSelector.java
similarity index 98%
rename from gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java
rename to gcloud-java-core/src/main/java/com/google/cloud/FieldSelector.java
index be6ab73d00bf..a2b92d752eaf 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/FieldSelector.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -54,7 +54,7 @@ public String apply(FieldSelector fieldSelector) {
};
private static String selector(List extends FieldSelector> required, FieldSelector[] others,
- String... extraResourceFields) {
+ String... extraResourceFields) {
Set fieldStrings = Sets.newHashSetWithExpectedSize(required.size() + others.length);
fieldStrings.addAll(Lists.transform(required, FIELD_TO_STRING_FUNCTION));
fieldStrings.addAll(Lists.transform(Arrays.asList(others), FIELD_TO_STRING_FUNCTION));
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/IamPolicy.java b/gcloud-java-core/src/main/java/com/google/cloud/IamPolicy.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/IamPolicy.java
rename to gcloud-java-core/src/main/java/com/google/cloud/IamPolicy.java
index 9cce4b23c864..1f214e1b0f71 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/IamPolicy.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/IamPolicy.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Identity.java b/gcloud-java-core/src/main/java/com/google/cloud/Identity.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/Identity.java
rename to gcloud-java-core/src/main/java/com/google/cloud/Identity.java
index 687a76ffc42c..fab70dfe6d37 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/Identity.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/Identity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Page.java b/gcloud-java-core/src/main/java/com/google/cloud/Page.java
similarity index 92%
rename from gcloud-java-core/src/main/java/com/google/gcloud/Page.java
rename to gcloud-java-core/src/main/java/com/google/cloud/Page.java
index 53f3a3842a18..8881a98b46ae 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/Page.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/Page.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import java.util.Iterator;
/**
* Interface for Google Cloud paginated results.
*
- *
- * Use {@code Page} to iterate through all values (also in next pages):
+ *
Use {@code Page} to iterate through all values (also in next pages):
*
{@code
* Page page = ...; // get a Page instance
* Iterator iterator = page.iterateAll();
@@ -30,8 +29,8 @@
* T value = iterator.next();
* // do something with value
* }}
- *
- * Or handle pagination explicitly:
+ *
+ *
Or handle pagination explicitly:
*
{@code
* Page page = ...; // get a Page instance
* while (page != null) {
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/PageImpl.java b/gcloud-java-core/src/main/java/com/google/cloud/PageImpl.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/PageImpl.java
rename to gcloud-java-core/src/main/java/com/google/cloud/PageImpl.java
index 2dc031ab9bd4..de1a3506b750 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/PageImpl.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/PageImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ImmutableMap;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ReadChannel.java b/gcloud-java-core/src/main/java/com/google/cloud/ReadChannel.java
similarity index 98%
rename from gcloud-java-core/src/main/java/com/google/gcloud/ReadChannel.java
rename to gcloud-java-core/src/main/java/com/google/cloud/ReadChannel.java
index 7537c5a8ce0b..2afb8b2d5b32 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/ReadChannel.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/ReadChannel.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import java.io.Closeable;
import java.io.IOException;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java b/gcloud-java-core/src/main/java/com/google/cloud/Restorable.java
similarity index 93%
rename from gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java
rename to gcloud-java-core/src/main/java/com/google/cloud/Restorable.java
index 0b573522e370..e2a515c7861a 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/Restorable.java
@@ -14,20 +14,19 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
/**
* Implementation of this interface can persist their state and restore from it.
*
- *
- * A typical capture usage:
+ *
A typical capture usage:
*
{@code
* X restorableObj; // X instanceof Restorable
* RestorableState state = restorableObj.capture();
* .. persist state
* }
*
- * A typical restore usage:
+ * A typical restore usage:
*
{@code
* RestorableState state = ... // read from persistence
* X restorableObj = state.restore();
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java b/gcloud-java-core/src/main/java/com/google/cloud/RestorableState.java
similarity index 89%
rename from gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java
rename to gcloud-java-core/src/main/java/com/google/cloud/RestorableState.java
index d6ce736ae856..4874756527f7 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/RestorableState.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/RestorableState.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
/**
* A common interface for restorable states. Implementations of {@code RestorableState} are capable
* of saving the state of an object to restore it for later use.
*
- * Implementations of this class must implement {@link java.io.Serializable} to ensure that the
+ * Implementations of this class must implement {@link java.io.Serializable} to ensure that the
* state of a the object can be correctly serialized.
*
* @param the restored object's type
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/RetryHelper.java b/gcloud-java-core/src/main/java/com/google/cloud/RetryHelper.java
similarity index 99%
rename from gcloud-java-core/src/main/java/com/google/gcloud/RetryHelper.java
rename to gcloud-java-core/src/main/java/com/google/cloud/RetryHelper.java
index 9b9c1f6a3124..48bd5fcf9324 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/RetryHelper.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/RetryHelper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.StrictMath.max;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/RetryParams.java b/gcloud-java-core/src/main/java/com/google/cloud/RetryParams.java
similarity index 91%
rename from gcloud-java-core/src/main/java/com/google/gcloud/RetryParams.java
rename to gcloud-java-core/src/main/java/com/google/cloud/RetryParams.java
index ab3644c6d747..02ffda18134f 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/RetryParams.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/RetryParams.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.Preconditions.checkArgument;
@@ -48,12 +48,16 @@ public final class RetryParams implements Serializable {
private static final long serialVersionUID = -8492751576749007700L;
+ /**
+ * Note that App Engine Standard Environment front-end modules have a 60 second deadline for HTTP
+ * requests. For that reason, we set the default total retry period to less than 60 seconds.
+ */
+ public static final long DEFAULT_TOTAL_RETRY_PERIOD_MILLIS = 50_000L;
public static final int DEFAULT_RETRY_MIN_ATTEMPTS = 3;
public static final int DEFAULT_RETRY_MAX_ATTEMPTS = 6;
- public static final long DEFAULT_INITIAL_RETRY_DELAY_MILLIS = 250L;
- public static final long DEFAULT_MAX_RETRY_DELAY_MILLIS = 10_000L;
+ public static final long DEFAULT_INITIAL_RETRY_DELAY_MILLIS = 1000L;
+ public static final long DEFAULT_MAX_RETRY_DELAY_MILLIS = 32_000L;
public static final double DEFAULT_RETRY_DELAY_BACKOFF_FACTOR = 2.0;
- public static final long DEFAULT_TOTAL_RETRY_PERIOD_MILLIS = 50_000L;
private final int retryMinAttempts;
private final int retryMaxAttempts;
@@ -62,6 +66,9 @@ public final class RetryParams implements Serializable {
private final double retryDelayBackoffFactor;
private final long totalRetryPeriodMillis;
+ // Some services may have different backoff requirements listed in their SLAs. Be sure to override
+ // ServiceOptions.defaultRetryParams() in options subclasses when the service's backoff
+ // requirement differs from the default parameters used here.
private static final RetryParams DEFAULT_INSTANCE = new RetryParams(new Builder());
private static final RetryParams NO_RETRIES =
builder().retryMaxAttempts(1).retryMinAttempts(1).build();
@@ -156,7 +163,9 @@ public Builder retryDelayBackoffFactor(double retryDelayBackoffFactor) {
}
/**
- * Sets totalRetryPeriodMillis.
+ * Sets totalRetryPeriodMillis. Note that App Engine Standard Environment front-end modules have
+ * a 60 second deadline for HTTP requests. For that reason, you should set the total retry
+ * period to under 60 seconds if you are using it on an App Engine front-end module.
*
* @param totalRetryPeriodMillis the totalRetryPeriodMillis to set
* @return the Builder for chaining
@@ -295,4 +304,8 @@ public String toString() {
public static Builder builder() {
return new Builder();
}
+
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
}
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/Service.java b/gcloud-java-core/src/main/java/com/google/cloud/Service.java
similarity index 96%
rename from gcloud-java-core/src/main/java/com/google/gcloud/Service.java
rename to gcloud-java-core/src/main/java/com/google/cloud/Service.java
index 60bc26670f2e..a3797eca30b9 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/Service.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/Service.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
/**
* Interface for service objects.
diff --git a/gcloud-java-core/src/main/java/com/google/cloud/ServiceAccountSigner.java b/gcloud-java-core/src/main/java/com/google/cloud/ServiceAccountSigner.java
new file mode 100644
index 000000000000..c68d14116aa8
--- /dev/null
+++ b/gcloud-java-core/src/main/java/com/google/cloud/ServiceAccountSigner.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+package com.google.cloud;
+
+import java.util.Objects;
+
+/**
+ * Interface for a service account signer. A signer for a service account is capable of signing
+ * bytes using the private key associated with its service account.
+ */
+public interface ServiceAccountSigner {
+
+ class SigningException extends RuntimeException {
+
+ private static final long serialVersionUID = 8962780757822799255L;
+
+ SigningException(String message, Exception cause) {
+ super(message, cause);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof SigningException)) {
+ return false;
+ }
+ SigningException other = (SigningException) obj;
+ return Objects.equals(getCause(), other.getCause())
+ && Objects.equals(getMessage(), other.getMessage());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getMessage(), getCause());
+ }
+ }
+
+ /**
+ * Returns the service account associated with the signer.
+ */
+ String account();
+
+ /**
+ * Signs the provided bytes using the private key associated with the service account.
+ *
+ * @param toSign bytes to sign
+ * @return signed bytes
+ * @throws SigningException if the attempt to sign the provided bytes failed
+ */
+ byte[] sign(byte[] toSign);
+}
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceFactory.java b/gcloud-java-core/src/main/java/com/google/cloud/ServiceFactory.java
similarity index 97%
rename from gcloud-java-core/src/main/java/com/google/gcloud/ServiceFactory.java
rename to gcloud-java-core/src/main/java/com/google/cloud/ServiceFactory.java
index 1727e9c3976f..bb06127c77c6 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceFactory.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/ServiceFactory.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
/**
* A base interface for all service factories.
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java b/gcloud-java-core/src/main/java/com/google/cloud/ServiceOptions.java
similarity index 95%
rename from gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java
rename to gcloud-java-core/src/main/java/com/google/cloud/ServiceOptions.java
index d53cfcdafe24..e08d0cd9d155 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/ServiceOptions.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
@@ -28,7 +28,7 @@
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.common.collect.Iterables;
import com.google.common.io.Files;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.spi.ServiceRpcFactory;
import org.json.JSONException;
import org.json.JSONObject;
@@ -100,8 +100,8 @@ public abstract class ServiceOptions, Service
/**
* A base interface for all {@link HttpTransport} factories.
*
- * Implementation must provide a public no-arg constructor. Loading of a factory implementation is
- * done via {@link java.util.ServiceLoader}.
+ * Implementation must provide a public no-arg constructor. Loading of a factory implementation
+ * is done via {@link java.util.ServiceLoader}.
*/
public interface HttpTransportFactory {
HttpTransport create();
@@ -129,7 +129,7 @@ public HttpTransport create() {
* A class providing access to the current time in milliseconds. This class is mainly used for
* testing and will be replaced by Java8's {@code java.time.Clock}.
*
- * Implementations should implement {@code Serializable} wherever possible and must document
+ *
Implementations should implement {@code Serializable} wherever possible and must document
* whether or not they do support serialization.
*/
public abstract static class Clock {
@@ -333,7 +333,7 @@ protected ServiceOptions(Class extends ServiceFactory> ser
authCredentials =
builder.authCredentials != null ? builder.authCredentials : defaultAuthCredentials();
authCredentialsState = authCredentials != null ? authCredentials.capture() : null;
- retryParams = firstNonNull(builder.retryParams, RetryParams.defaultInstance());
+ retryParams = firstNonNull(builder.retryParams, defaultRetryParams());
serviceFactory = firstNonNull(builder.serviceFactory,
getFromServiceLoader(serviceFactoryClass, defaultServiceFactory()));
serviceFactoryClassName = serviceFactory.getClass().getName();
@@ -490,7 +490,7 @@ protected static String appEngineProjectId() {
protected static String serviceAccountProjectId() {
String project = null;
String credentialsPath = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
- if(credentialsPath != null) {
+ if (credentialsPath != null) {
try (InputStream credentialsStream = new FileInputStream(credentialsPath)) {
JSONObject json = new JSONObject(new JSONTokener(credentialsStream));
project = json.getString("project_id");
@@ -518,9 +518,8 @@ public ServiceRpcT rpc() {
}
/**
- * Returns the project id.
- *
- * Return value can be null (for services that don't require a project id).
+ * Returns the project id. Return value can be null (for services that don't require a project
+ * id).
*/
public String projectId() {
return projectId;
@@ -647,14 +646,23 @@ private static T newInstance(String className) throws IOException, ClassNotF
}
}
- protected abstract > T defaultServiceFactory();
+ protected abstract ServiceFactory defaultServiceFactory();
- protected abstract > T defaultRpcFactory();
+ protected abstract ServiceRpcFactory defaultRpcFactory();
protected abstract Set scopes();
public abstract > B toBuilder();
+ /**
+ * Some services may have different backoff requirements listed in their SLAs. Be sure to override
+ * this method in options subclasses when the service's backoff requirement differs from the
+ * default parameters listed in {@link RetryParams}.
+ */
+ protected RetryParams defaultRetryParams() {
+ return RetryParams.defaultInstance();
+ }
+
private static T getFromServiceLoader(Class extends T> clazz, T defaultInstance) {
return Iterables.getFirst(ServiceLoader.load(clazz), defaultInstance);
}
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/WriteChannel.java b/gcloud-java-core/src/main/java/com/google/cloud/WriteChannel.java
similarity index 98%
rename from gcloud-java-core/src/main/java/com/google/gcloud/WriteChannel.java
rename to gcloud-java-core/src/main/java/com/google/cloud/WriteChannel.java
index e6f06e23dc04..636bc60d0243 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/WriteChannel.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/WriteChannel.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import java.io.Closeable;
import java.nio.channels.WritableByteChannel;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/package-info.java b/gcloud-java-core/src/main/java/com/google/cloud/package-info.java
similarity index 96%
rename from gcloud-java-core/src/main/java/com/google/gcloud/package-info.java
rename to gcloud-java-core/src/main/java/com/google/cloud/package-info.java
index d527640c99f9..8b548e3d26e8 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/package-info.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/package-info.java
@@ -17,4 +17,4 @@
/**
* Core classes for the {@code gcloud-java} library.
*/
-package com.google.gcloud;
+package com.google.cloud;
diff --git a/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java b/gcloud-java-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java
similarity index 74%
rename from gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java
rename to gcloud-java-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java
index d19f6047e4b2..21a061f4a5dc 100644
--- a/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java
+++ b/gcloud-java-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java
@@ -14,15 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.spi;
+package com.google.cloud.spi;
-import com.google.gcloud.ServiceOptions;
+import com.google.cloud.ServiceOptions;
/**
- * A base interface for all service RPC factories.
- *
- * Implementation must provide a public no-arg constructor.
- * Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
+ * A base interface for all service RPC factories. Implementation must provide a public no-arg
+ * constructor. Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
*/
@SuppressWarnings("rawtypes")
public interface ServiceRpcFactory {
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/BaseSerializationTest.java b/gcloud-java-core/src/test/java/com/google/cloud/BaseSerializationTest.java
similarity index 99%
rename from gcloud-java-core/src/test/java/com/google/gcloud/BaseSerializationTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/BaseSerializationTest.java
index e9ab3d47984b..57603b9026d8 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/BaseSerializationTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/BaseSerializationTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static com.google.common.base.MoreObjects.firstNonNull;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/BaseServiceExceptionTest.java b/gcloud-java-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java
similarity index 98%
rename from gcloud-java-core/src/test/java/com/google/gcloud/BaseServiceExceptionTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java
index e3c6abb7d1ee..52bc3b2b51a4 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/BaseServiceExceptionTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
-import static com.google.gcloud.BaseServiceException.UNKNOWN_CODE;
+import static com.google.cloud.BaseServiceException.UNKNOWN_CODE;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java b/gcloud-java-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java
similarity index 96%
rename from gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java
index 6d5306a3bc7f..fc476b11ae6e 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/BaseWriteChannelTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
@@ -22,7 +22,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.spi.ServiceRpcFactory;
import org.junit.Before;
import org.junit.Rule;
@@ -82,7 +82,7 @@ protected BaseState.Builder stateBuilder() {
}
@Test
- public void testConstructor() throws IOException {
+ public void testConstructor() {
assertEquals(null, channel.options());
assertEquals(ENTITY, channel.entity());
assertEquals(0, channel.position());
@@ -108,7 +108,7 @@ public void testValidateOpen() throws IOException {
}
@Test
- public void testChunkSize() throws IOException {
+ public void testChunkSize() {
channel.chunkSize(42);
assertEquals(MIN_CHUNK_SIZE, channel.chunkSize());
channel.chunkSize(2 * MIN_CHUNK_SIZE);
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/ExceptionHandlerTest.java b/gcloud-java-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java
similarity index 97%
rename from gcloud-java-core/src/test/java/com/google/gcloud/ExceptionHandlerTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java
index cedc995ddbd0..ddbd2ced841c 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/ExceptionHandlerTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.gcloud.ExceptionHandler.Interceptor;
-import com.google.gcloud.ExceptionHandler.Interceptor.RetryResult;
+import com.google.cloud.ExceptionHandler.Interceptor;
+import com.google.cloud.ExceptionHandler.Interceptor.RetryResult;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/FieldSelectorHelperTest.java b/gcloud-java-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java
similarity index 97%
rename from gcloud-java-core/src/test/java/com/google/gcloud/FieldSelectorHelperTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java
index 9871c942180e..6cdc4bdfb924 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/FieldSelectorHelperTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.FieldSelector.Helper;
+import com.google.cloud.FieldSelector.Helper;
import org.junit.Test;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/IamPolicyTest.java b/gcloud-java-core/src/test/java/com/google/cloud/IamPolicyTest.java
similarity index 99%
rename from gcloud-java-core/src/test/java/com/google/gcloud/IamPolicyTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/IamPolicyTest.java
index 235c2c2b1c85..e79cfd96554c 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/IamPolicyTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/IamPolicyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/IdentityTest.java b/gcloud-java-core/src/test/java/com/google/cloud/IdentityTest.java
similarity index 99%
rename from gcloud-java-core/src/test/java/com/google/gcloud/IdentityTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/IdentityTest.java
index a42bc9db7abd..e720503c547d 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/IdentityTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/IdentityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/PageImplTest.java b/gcloud-java-core/src/test/java/com/google/cloud/PageImplTest.java
similarity index 98%
rename from gcloud-java-core/src/test/java/com/google/gcloud/PageImplTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/PageImplTest.java
index 4389171fb49c..07d979ad857c 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/PageImplTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/PageImplTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/RetryHelperTest.java b/gcloud-java-core/src/test/java/com/google/cloud/RetryHelperTest.java
similarity index 98%
rename from gcloud-java-core/src/test/java/com/google/gcloud/RetryHelperTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/RetryHelperTest.java
index 9a7cc2104f4a..7012813be2d0 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/RetryHelperTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/RetryHelperTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static java.util.concurrent.Executors.callable;
import static org.junit.Assert.assertEquals;
@@ -24,8 +24,8 @@
import com.google.common.base.Stopwatch;
import com.google.common.base.Ticker;
-import com.google.gcloud.RetryHelper.NonRetriableException;
-import com.google.gcloud.RetryHelper.RetriesExhaustedException;
+import com.google.cloud.RetryHelper.NonRetriableException;
+import com.google.cloud.RetryHelper.RetriesExhaustedException;
import org.junit.Test;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/RetryParamsTest.java b/gcloud-java-core/src/test/java/com/google/cloud/RetryParamsTest.java
similarity index 87%
rename from gcloud-java-core/src/test/java/com/google/gcloud/RetryParamsTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/RetryParamsTest.java
index eae44693929b..c3041053110b 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/RetryParamsTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/RetryParamsTest.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
-import static com.google.gcloud.RetryParams.DEFAULT_INITIAL_RETRY_DELAY_MILLIS;
-import static com.google.gcloud.RetryParams.DEFAULT_MAX_RETRY_DELAY_MILLIS;
-import static com.google.gcloud.RetryParams.DEFAULT_RETRY_DELAY_BACKOFF_FACTOR;
-import static com.google.gcloud.RetryParams.DEFAULT_RETRY_MAX_ATTEMPTS;
-import static com.google.gcloud.RetryParams.DEFAULT_RETRY_MIN_ATTEMPTS;
-import static com.google.gcloud.RetryParams.DEFAULT_TOTAL_RETRY_PERIOD_MILLIS;
+import static com.google.cloud.RetryParams.DEFAULT_INITIAL_RETRY_DELAY_MILLIS;
+import static com.google.cloud.RetryParams.DEFAULT_MAX_RETRY_DELAY_MILLIS;
+import static com.google.cloud.RetryParams.DEFAULT_RETRY_DELAY_BACKOFF_FACTOR;
+import static com.google.cloud.RetryParams.DEFAULT_RETRY_MAX_ATTEMPTS;
+import static com.google.cloud.RetryParams.DEFAULT_RETRY_MIN_ATTEMPTS;
+import static com.google.cloud.RetryParams.DEFAULT_TOTAL_RETRY_PERIOD_MILLIS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import com.google.gcloud.RetryParams.Builder;
+import com.google.cloud.RetryParams.Builder;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/SerializationTest.java b/gcloud-java-core/src/test/java/com/google/cloud/SerializationTest.java
similarity index 94%
rename from gcloud-java-core/src/test/java/com/google/gcloud/SerializationTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/SerializationTest.java
index 3255a17333aa..72d622239f3c 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/SerializationTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/SerializationTest.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import com.google.common.collect.ImmutableList;
+import com.google.cloud.ServiceAccountSigner.SigningException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -24,34 +25,14 @@
public class SerializationTest extends BaseSerializationTest {
- private static class SomeIamPolicy extends IamPolicy {
-
- private static final long serialVersionUID = 271243551016958285L;
-
- private static class Builder extends IamPolicy.Builder {
-
- @Override
- public SomeIamPolicy build() {
- return new SomeIamPolicy(this);
- }
- }
-
- protected SomeIamPolicy(Builder builder) {
- super(builder);
- }
-
- @Override
- public Builder toBuilder() {
- return new Builder();
- }
- }
-
private static final BaseServiceException BASE_SERVICE_EXCEPTION =
new BaseServiceException(42, "message", "reason", true);
private static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.defaultInstance();
private static final Identity IDENTITY = Identity.allAuthenticatedUsers();
private static final PageImpl PAGE =
new PageImpl<>(null, "cursor", ImmutableList.of("string1", "string2"));
+ private static final SigningException SIGNING_EXCEPTION =
+ new SigningException("message", BASE_SERVICE_EXCEPTION);
private static final RetryParams RETRY_PARAMS = RetryParams.defaultInstance();
private static final SomeIamPolicy SOME_IAM_POLICY = new SomeIamPolicy.Builder().build();
private static final String JSON_KEY = "{\n"
@@ -81,10 +62,32 @@ public Builder toBuilder() {
+ " \"type\": \"service_account\"\n"
+ "}";
+ private static class SomeIamPolicy extends IamPolicy {
+
+ private static final long serialVersionUID = 271243551016958285L;
+
+ private static class Builder extends IamPolicy.Builder {
+
+ @Override
+ public SomeIamPolicy build() {
+ return new SomeIamPolicy(this);
+ }
+ }
+
+ protected SomeIamPolicy(Builder builder) {
+ super(builder);
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder();
+ }
+ }
+
@Override
protected Serializable[] serializableObjects() {
return new Serializable[]{BASE_SERVICE_EXCEPTION, EXCEPTION_HANDLER, IDENTITY, PAGE,
- RETRY_PARAMS, SOME_IAM_POLICY};
+ RETRY_PARAMS, SOME_IAM_POLICY, SIGNING_EXCEPTION};
}
@Override
diff --git a/gcloud-java-core/src/test/java/com/google/gcloud/ServiceOptionsTest.java b/gcloud-java-core/src/test/java/com/google/cloud/ServiceOptionsTest.java
similarity index 97%
rename from gcloud-java-core/src/test/java/com/google/gcloud/ServiceOptionsTest.java
rename to gcloud-java-core/src/test/java/com/google/cloud/ServiceOptionsTest.java
index d0e3db2d2a55..b6f7a5453ddc 100644
--- a/gcloud-java-core/src/test/java/com/google/gcloud/ServiceOptionsTest.java
+++ b/gcloud-java-core/src/test/java/com/google/cloud/ServiceOptionsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud;
+package com.google.cloud;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
@@ -22,10 +22,10 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.gcloud.ServiceOptions.Clock;
-import com.google.gcloud.ServiceOptions.DefaultHttpTransportFactory;
-import com.google.gcloud.ServiceOptions.HttpTransportFactory;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.ServiceOptions.Clock;
+import com.google.cloud.ServiceOptions.DefaultHttpTransportFactory;
+import com.google.cloud.ServiceOptions.HttpTransportFactory;
+import com.google.cloud.spi.ServiceRpcFactory;
import org.easymock.EasyMock;
import org.junit.Test;
diff --git a/gcloud-java-datastore/README.md b/gcloud-java-datastore/README.md
index 69cf039472a3..86b77c6bf49a 100644
--- a/gcloud-java-datastore/README.md
+++ b/gcloud-java-datastore/README.md
@@ -5,12 +5,12 @@ Java idiomatic client for [Google Cloud Datastore] (https://cloud.google.com/dat
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-datastore.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-datastore.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-datastore.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-datastore.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html)
+- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/datastore/package-summary.html)
> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.
@@ -20,23 +20,23 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-datastore
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-datastore:0.1.7'
+compile 'com.google.cloud:gcloud-java-datastore:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-datastore" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-datastore" % "0.2.0"
```
Example Application
--------------------
-[`DatastoreExample`](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) is a simple command line interface for the Cloud Datastore. Read more about using the application on the [`DatastoreExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/datastore/DatastoreExample.html).
+[`DatastoreExample`](../gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/DatastoreExample.java) is a simple command line interface for the Cloud Datastore. Read more about using the application on the [`DatastoreExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/cloud/examples/datastore/DatastoreExample.html).
Authentication
--------------
@@ -70,8 +70,8 @@ You'll need to obtain the `gcloud-java-datastore` library. See the [Quickstart]
To make authenticated requests to Google Cloud Datastore, you must create a service object with credentials. You can then make API calls by calling methods on the Datastore service object. The simplest way to authenticate is to use [Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials). These credentials are automatically inferred from your environment, so you only need the following code to create your service object:
```java
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
Datastore datastore = DatastoreOptions.defaultInstance().service();
```
@@ -82,9 +82,9 @@ For other authentication options, see the [Authentication](https://github.com/Go
Objects in Datastore are known as entities. Entities are grouped by "kind" and have keys for easy access. In this code snippet, we will create a new entity representing a person and store that data by the person's email. First, add the following imports at the top of your file:
```java
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
```
Then add the following code to put an entity in Datastore.
@@ -112,10 +112,10 @@ In addition to retrieving entities by their keys, you can perform queries to ret
Suppose that you've added more people to Datastore, and now you want to find all people whose favorite food is pizza. Import the following:
```java
-import com.google.gcloud.datastore.Query;
-import com.google.gcloud.datastore.QueryResults;
-import com.google.gcloud.datastore.StructuredQuery;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.datastore.Query;
+import com.google.cloud.datastore.QueryResults;
+import com.google.cloud.datastore.StructuredQuery;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
```
Then add the following code to your program:
@@ -137,7 +137,7 @@ Cloud Datastore relies on indexing to run queries. Indexing is turned on by defa
#### Complete source code
In
-[AddEntitiesAndRunQuery.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java)
+[AddEntitiesAndRunQuery.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java)
we put together all the code shown above into one program. The program assumes that you are
running on Compute Engine or from your own desktop. To run the example on App Engine, simply move
the code from the main method to your application's servlet class and change the print statements to
@@ -191,4 +191,4 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-platform]: https://cloud.google.com/
[cloud-datastore-docs]: https://cloud.google.com/datastore/docs
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
-[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html
+[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/datastore/package-summary.html
diff --git a/gcloud-java-datastore/pom.xml b/gcloud-java-datastore/pom.xml
index 22498ab505f4..2e76072b2881 100644
--- a/gcloud-java-datastore/pom.xml
+++ b/gcloud-java-datastore/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-datastore
jar
GCloud Java datastore
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-datastore
Java idiomatic client for Google Cloud Datastore.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-datastore
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseDatastoreBatchWriter.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseDatastoreBatchWriter.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java
index 3aa0d38f45f1..8804ef7e8dda 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseDatastoreBatchWriter.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseDatastoreBatchWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseEntity.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
similarity index 96%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseEntity.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
index c7d7219abfb8..c7417faa79f3 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseEntity.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
-
-import static com.google.gcloud.datastore.BlobValue.of;
-import static com.google.gcloud.datastore.BooleanValue.of;
-import static com.google.gcloud.datastore.DateTimeValue.of;
-import static com.google.gcloud.datastore.DoubleValue.of;
-import static com.google.gcloud.datastore.EntityValue.of;
-import static com.google.gcloud.datastore.KeyValue.of;
-import static com.google.gcloud.datastore.LatLngValue.of;
-import static com.google.gcloud.datastore.ListValue.of;
-import static com.google.gcloud.datastore.LongValue.of;
-import static com.google.gcloud.datastore.NullValue.of;
-import static com.google.gcloud.datastore.StringValue.of;
+package com.google.cloud.datastore;
+
+import static com.google.cloud.datastore.BlobValue.of;
+import static com.google.cloud.datastore.BooleanValue.of;
+import static com.google.cloud.datastore.DateTimeValue.of;
+import static com.google.cloud.datastore.DoubleValue.of;
+import static com.google.cloud.datastore.EntityValue.of;
+import static com.google.cloud.datastore.KeyValue.of;
+import static com.google.cloud.datastore.LatLngValue.of;
+import static com.google.cloud.datastore.ListValue.of;
+import static com.google.cloud.datastore.LongValue.of;
+import static com.google.cloud.datastore.NullValue.of;
+import static com.google.cloud.datastore.StringValue.of;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Maps;
@@ -43,7 +43,7 @@
* A base class for entities (key and properties).
* An entity is a Google Cloud Datastore persistent data object.
* An entity holds one or more properties, represented by a name (as {@link String})
- * and a value (as {@link com.google.gcloud.datastore.Value}), and may be associated with a
+ * and a value (as {@link com.google.cloud.datastore.Value}), and may be associated with a
* key. For a list of possible values see {@link ValueType}.
*
* @see Google Cloud Datastore
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseKey.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java
similarity index 95%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseKey.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java
index f2bb87e740d0..73f98562e0e5 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseKey.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
-import static com.google.gcloud.datastore.Validator.validateDatabase;
-import static com.google.gcloud.datastore.Validator.validateKind;
-import static com.google.gcloud.datastore.Validator.validateNamespace;
+import static com.google.cloud.datastore.Validator.validateDatabase;
+import static com.google.cloud.datastore.Validator.validateKind;
+import static com.google.cloud.datastore.Validator.validateNamespace;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Batch.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Batch.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Batch.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Batch.java
index 5306a685195a..dbe6f86c4b99 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Batch.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Batch.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.List;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BatchImpl.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BatchImpl.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java
index 303e9703f4cc..603e9464c9c1 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BatchImpl.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BatchImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Blob.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Blob.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Blob.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Blob.java
index b86c4ccb963e..0fd7213d7be3 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Blob.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Blob.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BlobValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BlobValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java
index 19d545e1790c..d65bb6ee8652 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BlobValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.BLOB_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BooleanValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BooleanValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java
index 3e1bdc14e822..c5d7910b5984 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BooleanValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.BOOLEAN_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Cursor.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Cursor.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Cursor.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Cursor.java
index c4d2b37672da..f9d51638b35b 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Cursor.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Cursor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Datastore.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Datastore.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
index c0efaa52b4e8..8b2afcb5ad0c 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Datastore.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Datastore.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
-import com.google.gcloud.Service;
+import com.google.cloud.Service;
import java.util.Iterator;
import java.util.List;
@@ -35,7 +35,7 @@ public interface Datastore extends Service, DatastoreReaderWri
/**
* A callback for running with a transactional
- * {@link com.google.gcloud.datastore.DatastoreReaderWriter}.
+ * {@link com.google.cloud.datastore.DatastoreReaderWriter}.
* The associated transaction will be committed after a successful return from the {@code run}
* method. Any propagated exception will cause the transaction to be rolled-back.
*
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreBatchWriter.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreBatchWriter.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreBatchWriter.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreBatchWriter.java
index 3a80452349dc..918711aa2822 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreBatchWriter.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreBatchWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.List;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreException.java
similarity index 93%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreException.java
index a940fe573f93..c097980aec29 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreException.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.RetryHelper.RetryInterruptedException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.RetryHelper.RetryInterruptedException;
import java.io.IOException;
import java.util.Set;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreFactory.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreFactory.java
similarity index 90%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreFactory.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreFactory.java
index b1f5a026a3e5..1a1b49cf71b3 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreFactory.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
-import com.google.gcloud.ServiceFactory;
+import com.google.cloud.ServiceFactory;
/**
* An interface for Datastore factories.
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreHelper.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreHelper.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java
index e3cf9c055576..04b3e96c5175 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreHelper.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.collect.Iterators;
import com.google.common.collect.Maps;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreImpl.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreImpl.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
index 4193931ab990..a05c4229f291 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreImpl.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
@@ -23,12 +23,12 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.datastore.v1beta3.ReadOptions.ReadConsistency;
-import com.google.gcloud.BaseService;
-import com.google.gcloud.RetryHelper;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.datastore.ReadOption.EventualConsistency;
-import com.google.gcloud.datastore.spi.DatastoreRpc;
+import com.google.cloud.BaseService;
+import com.google.cloud.RetryHelper;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.RetryParams;
+import com.google.cloud.datastore.ReadOption.EventualConsistency;
+import com.google.cloud.datastore.spi.DatastoreRpc;
import com.google.protobuf.ByteString;
import java.util.ArrayList;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreOptions.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreOptions.java
similarity index 66%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreOptions.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreOptions.java
index bc0efd837755..a9466939060a 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreOptions.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreOptions.java
@@ -14,20 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
-import static com.google.gcloud.datastore.Validator.validateNamespace;
+import static com.google.cloud.datastore.Validator.validateNamespace;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.datastore.spi.DatastoreRpc;
-import com.google.gcloud.datastore.spi.DatastoreRpcFactory;
-import com.google.gcloud.datastore.spi.DefaultDatastoreRpc;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.datastore.spi.DatastoreRpc;
+import com.google.cloud.datastore.spi.DatastoreRpcFactory;
+import com.google.cloud.datastore.spi.DefaultDatastoreRpc;
import java.lang.reflect.Method;
-import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
@@ -38,7 +36,6 @@ public class DatastoreOptions extends ServiceOptions SCOPES = ImmutableSet.of(DATASTORE_SCOPE);
private final String namespace;
- private final boolean normalizeDataset;
public static class DefaultDatastoreFactory implements DatastoreFactory {
@@ -64,7 +61,6 @@ public static class Builder extends
ServiceOptions.Builder {
private String namespace;
- private boolean normalizeDataset = true;
private Builder() {
}
@@ -72,59 +68,24 @@ private Builder() {
private Builder(DatastoreOptions options) {
super(options);
namespace = options.namespace;
- normalizeDataset = options.normalizeDataset;
}
@Override
public DatastoreOptions build() {
- DatastoreOptions options = new DatastoreOptions(this);
- return normalizeDataset ? options.normalize() : options;
+ return new DatastoreOptions(this);
}
public Builder namespace(String namespace) {
this.namespace = validateNamespace(namespace);
return this;
}
-
- Builder normalizeDataset(boolean normalizeDataset) {
- this.normalizeDataset = normalizeDataset;
- return this;
- }
}
private DatastoreOptions(Builder builder) {
super(DatastoreFactory.class, DatastoreRpcFactory.class, builder);
- normalizeDataset = builder.normalizeDataset;
namespace = builder.namespace != null ? builder.namespace : defaultNamespace();
}
- private DatastoreOptions normalize() {
- if (!normalizeDataset) {
- return this;
- }
-
- Builder builder = toBuilder();
- builder.normalizeDataset(false);
- // Replace provided project-id with full project-id (s~xxx, e~xxx,...)
- com.google.datastore.v1beta3.LookupRequest.Builder requestPb =
- com.google.datastore.v1beta3.LookupRequest.newBuilder();
- com.google.datastore.v1beta3.Key key = com.google.datastore.v1beta3.Key.newBuilder()
- .addPath(com.google.datastore.v1beta3.Key.PathElement.newBuilder()
- .setKind("__foo__").setName("bar"))
- .build();
- requestPb.addKeys(key);
- com.google.datastore.v1beta3.LookupResponse responsePb = rpc().lookup(requestPb.build());
- if (responsePb.getDeferredCount() > 0) {
- key = responsePb.getDeferred(0);
- } else {
- Iterator combinedIter =
- Iterables.concat(responsePb.getMissingList(), responsePb.getFoundList()).iterator();
- key = combinedIter.next().getEntity().getKey();
- }
- builder.projectId(key.getPartitionId().getProjectId());
- return new DatastoreOptions(builder);
- }
-
@Override
protected String defaultHost() {
String host = System.getProperty(
@@ -138,19 +99,14 @@ protected String defaultProject() {
String projectId = System.getProperty(
com.google.datastore.v1beta3.client.DatastoreHelper.PROJECT_ID_ENV_VAR,
System.getenv(com.google.datastore.v1beta3.client.DatastoreHelper.PROJECT_ID_ENV_VAR));
- if (projectId == null) {
- projectId = appEngineAppId();
- }
return projectId != null ? projectId : super.defaultProject();
}
- @SuppressWarnings("unchecked")
@Override
protected DatastoreFactory defaultServiceFactory() {
return DefaultDatastoreFactory.INSTANCE;
}
- @SuppressWarnings("unchecked")
@Override
protected DatastoreRpcFactory defaultRpcFactory() {
return DefaultDatastoreRpcFactory.INSTANCE;
@@ -192,7 +148,7 @@ public Builder toBuilder() {
@Override
public int hashCode() {
- return baseHashCode() ^ Objects.hash(namespace, normalizeDataset);
+ return Objects.hash(baseHashCode(), namespace);
}
@Override
@@ -201,8 +157,7 @@ public boolean equals(Object obj) {
return false;
}
DatastoreOptions other = (DatastoreOptions) obj;
- return baseEquals(other) && Objects.equals(namespace, other.namespace)
- && Objects.equals(normalizeDataset, other.normalizeDataset);
+ return baseEquals(other) && Objects.equals(namespace, other.namespace);
}
public static Builder builder() {
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReader.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReader.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReader.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReader.java
index 3d6e5ec73243..e3989f29ef8b 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReader.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.Iterator;
import java.util.List;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReaderWriter.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReaderWriter.java
similarity index 95%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReaderWriter.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReaderWriter.java
index c64f86a8d0a3..16b6af881929 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreReaderWriter.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreReaderWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreWriter.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreWriter.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreWriter.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreWriter.java
index 66ba98aed9e9..2771bb39ea60 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreWriter.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DatastoreWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.List;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTime.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTime.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTime.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTime.java
index 5e8664395802..fd72edc9806f 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTime.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTime.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTimeValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTimeValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java
index e9c42ffabf4c..8ffa98ea5e74 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DateTimeValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DateTimeValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.TIMESTAMP_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DoubleValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DoubleValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java
index d7409d08fe63..51d175bb51c4 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DoubleValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/DoubleValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.DOUBLE_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Entity.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Entity.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Entity.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Entity.java
index d012eff14422..3449693fe521 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Entity.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Entity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityQuery.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityQuery.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityQuery.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityQuery.java
index 3eda20eed3dc..40249b7ff26b 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityQuery.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityQuery.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
* An implementation of a Google Cloud Datastore entity query that can be constructed by providing
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java
index 4a327383afd4..582310e01e78 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/EntityValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/EntityValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.ENTITY_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/FullEntity.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/FullEntity.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java
index 25225b853556..aa88a92d3554 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/FullEntity.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/FullEntity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
* A full entity is a {@link BaseEntity} that holds all the properties associated with a
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/GqlQuery.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/GqlQuery.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java
index 342eaf7bd8eb..7a34bf4b1f19 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/GqlQuery.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.gcloud.datastore.Validator.validateNamespace;
+import static com.google.cloud.datastore.Validator.validateNamespace;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/IncompleteKey.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/IncompleteKey.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java
index 31039b6826f7..18959005596c 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/IncompleteKey.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/IncompleteKey.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Key.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Key.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Key.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Key.java
index ccc36ef1f533..7cb70d259e82 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Key.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Key.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static java.nio.charset.StandardCharsets.UTF_8;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyFactory.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyFactory.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyFactory.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyFactory.java
index 947880111ea4..f7fc17448a6d 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyFactory.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyFactory.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.collect.ImmutableList;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyQuery.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyQuery.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java
index 4224f2d07ce5..d84dd5b26c20 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyQuery.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyQuery.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
* An implementation of a Google Cloud Datastore key-only query that can be constructed by providing
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyValue.java
index fc1823730d12..78d4caebac79 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/KeyValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/KeyValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.KEY_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLng.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLng.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLng.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLng.java
index 7e2b42fac4d3..72f9e9f4f04f 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLng.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLng.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLngValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLngValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLngValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLngValue.java
index 91723f710816..80faa427cf28 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LatLngValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LatLngValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.GEO_POINT_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ListValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ListValue.java
similarity index 95%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ListValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ListValue.java
index 9d4fe9c186d5..f3692e5395bd 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ListValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ListValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.ARRAY_VALUE_FIELD_NUMBER;
@@ -90,7 +90,7 @@ public Builder addValue(Value> first, Value>... other) {
/**
* Copy the list of values.
*
- * @see com.google.gcloud.datastore.Value.BaseBuilder#set(java.lang.Object)
+ * @see com.google.cloud.datastore.Value.BaseBuilder#set(java.lang.Object)
*/
@Override
public Builder set(List extends Value>> values) {
@@ -108,7 +108,6 @@ public List extends Value>> get() {
@Override
public ListValue build() {
- Preconditions.checkState(!get().isEmpty(), "value list could not be empty");
return new ListValue(this);
}
}
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LongValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LongValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LongValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LongValue.java
index 18cdead6280a..ba79af7fb233 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/LongValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/LongValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.INTEGER_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/NullValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/NullValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/NullValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/NullValue.java
index ed314200b8bb..8b7ab9bfa49b 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/NullValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/NullValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/PathElement.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/PathElement.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/PathElement.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/PathElement.java
index 1759cc82bcea..413b0786e021 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/PathElement.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/PathElement.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntity.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntity.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntity.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntity.java
index f8af814245ab..519262a2e9c6 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntity.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.protobuf.ByteString;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntityQuery.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntityQuery.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntityQuery.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntityQuery.java
index d0e9920f3a61..5ccfed549941 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ProjectionEntityQuery.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ProjectionEntityQuery.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
* An implementation of a Google Cloud Datastore projection entity query that can be constructed by
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Query.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Query.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Query.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Query.java
index dd0ea9f1b798..c37e784d04ee 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Query.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Query.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResults.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResults.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResults.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResults.java
index a6e5971936dd..a907ddcad6b9 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResults.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResults.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.Iterator;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResultsImpl.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResultsImpl.java
index ec3a652c6131..b46f9821cc52 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/QueryResultsImpl.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.base.Preconditions;
import com.google.common.collect.AbstractIterator;
import com.google.datastore.v1beta3.QueryResultBatch.MoreResultsType;
-import com.google.gcloud.datastore.Query.ResultType;
+import com.google.cloud.datastore.Query.ResultType;
import com.google.protobuf.ByteString;
import java.util.Iterator;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/RawValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/RawValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/RawValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/RawValue.java
index cd64bcdeff05..81fec851a6dd 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/RawValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/RawValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
public final class RawValue extends Value {
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ReadOption.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ReadOption.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ReadOption.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ReadOption.java
index f0de06d1651d..baadfe4f9bd2 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ReadOption.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ReadOption.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.common.collect.ImmutableMap;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Serializable.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Serializable.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
index 89d19bcfd892..2e305935f32e 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Serializable.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StringValue.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StringValue.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StringValue.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StringValue.java
index 4b2c8e123be7..c47d2d9a61a4 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StringValue.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StringValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.datastore.v1beta3.Value.STRING_VALUE_FIELD_NUMBER;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java
index d91956d6c1db..9028ba6e536f 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/StructuredQuery.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/StructuredQuery.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.gcloud.datastore.BlobValue.of;
-import static com.google.gcloud.datastore.BooleanValue.of;
-import static com.google.gcloud.datastore.DateTimeValue.of;
-import static com.google.gcloud.datastore.DoubleValue.of;
-import static com.google.gcloud.datastore.KeyValue.of;
-import static com.google.gcloud.datastore.LongValue.of;
-import static com.google.gcloud.datastore.StringValue.of;
+import static com.google.cloud.datastore.BlobValue.of;
+import static com.google.cloud.datastore.BooleanValue.of;
+import static com.google.cloud.datastore.DateTimeValue.of;
+import static com.google.cloud.datastore.DoubleValue.of;
+import static com.google.cloud.datastore.KeyValue.of;
+import static com.google.cloud.datastore.LongValue.of;
+import static com.google.cloud.datastore.StringValue.of;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Transaction.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Transaction.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Transaction.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Transaction.java
index 78ee217f31e7..9ecf2c8caeb6 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Transaction.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Transaction.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import java.util.Iterator;
import java.util.List;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/TransactionImpl.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java
similarity index 99%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/TransactionImpl.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java
index 469c14e1c78a..9016d561905a 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/TransactionImpl.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/TransactionImpl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import com.google.protobuf.ByteString;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Validator.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Validator.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Validator.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Validator.java
index dc7069cebf62..31857af73ddc 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Validator.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Validator.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Value.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Value.java
similarity index 98%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Value.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Value.java
index 4f3d39f1dae1..c2c503c8f9db 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Value.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/Value.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -35,7 +35,6 @@ public abstract class Value extends Serializable, B extends BaseBuilder>
implements ValueBuilder {
@@ -113,11 +111,13 @@ public B excludeFromIndexes(boolean excludeFromIndexes) {
return self();
}
+ @Deprecated
@Override
public int getMeaning() {
return meaning;
}
+ @Deprecated
@Override
public B meaning(int meaning) {
this.meaning = meaning;
@@ -144,6 +144,7 @@ private B self() {
public abstract P build();
}
+ @SuppressWarnings("deprecation")
, B extends BaseBuilder> Value(ValueBuilder builder) {
valueType = builder.getValueType();
excludeFromIndexes = builder.getExcludeFromIndexes();
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ValueBuilder.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ValueBuilder.java
similarity index 83%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ValueBuilder.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ValueBuilder.java
index 236118a18620..0328d4a0637b 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ValueBuilder.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/ValueBuilder.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
/**
* A common interface for Value builders.
@@ -33,8 +33,15 @@ public interface ValueBuilder, B extends ValueBuilderHere's a simple usage example for using gcloud-java from App/Compute Engine. This example
* shows how to create a Datastore entity. For the complete source code see
- *
+ *
* CreateEntity.java.
* {@code
* Datastore datastore = DatastoreOptions.defaultInstance().service();
@@ -35,7 +35,7 @@
*
* This second example shows how to get and update a Datastore entity if it exists. For the complete
* source code see
- *
+ *
* UpdateEntity.java.
*
{@code
* Datastore datastore = DatastoreOptions.defaultInstance().service();
@@ -57,4 +57,4 @@
*
* @see Google Cloud Datastore
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpc.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpc.java
similarity index 96%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpc.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpc.java
index 0aff146835e0..dc3e9ce27249 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpc.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpc.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore.spi;
+package com.google.cloud.datastore.spi;
import com.google.datastore.v1beta3.AllocateIdsRequest;
import com.google.datastore.v1beta3.AllocateIdsResponse;
@@ -28,7 +28,7 @@
import com.google.datastore.v1beta3.RollbackResponse;
import com.google.datastore.v1beta3.RunQueryRequest;
import com.google.datastore.v1beta3.RunQueryResponse;
-import com.google.gcloud.datastore.DatastoreException;
+import com.google.cloud.datastore.DatastoreException;
/**
* Provides access to the remote Datastore service.
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpcFactory.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpcFactory.java
similarity index 85%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpcFactory.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpcFactory.java
index 0979b2203037..c16a7ddb0fea 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DatastoreRpcFactory.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DatastoreRpcFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore.spi;
+package com.google.cloud.datastore.spi;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.spi.ServiceRpcFactory;
/**
* An interface for Datastore RPC factory.
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DefaultDatastoreRpc.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
similarity index 97%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DefaultDatastoreRpc.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
index 1fb0fa3a26c6..04d8c4cc8dd4 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/spi/DefaultDatastoreRpc.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore.spi;
+package com.google.cloud.datastore.spi;
import com.google.datastore.v1beta3.AllocateIdsRequest;
import com.google.datastore.v1beta3.AllocateIdsResponse;
@@ -28,8 +28,8 @@
import com.google.datastore.v1beta3.RollbackResponse;
import com.google.datastore.v1beta3.RunQueryRequest;
import com.google.datastore.v1beta3.RunQueryResponse;
-import com.google.gcloud.datastore.DatastoreException;
-import com.google.gcloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.DatastoreException;
+import com.google.cloud.datastore.DatastoreOptions;
import java.io.IOException;
import java.net.InetAddress;
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/LocalGcdHelper.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
similarity index 80%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/LocalGcdHelper.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
index 6f1a76b0a482..9d04ddbf930e 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/LocalGcdHelper.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore.testing;
+package com.google.cloud.datastore.testing;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
-import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Strings;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.RetryParams;
+import com.google.cloud.datastore.DatastoreOptions;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -28,8 +30,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -52,10 +52,9 @@
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
+import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
@@ -65,28 +64,27 @@
/**
* Utility to start and stop local Google Cloud Datastore process.
*/
-public class LocalGcdHelper {
- private static final Logger log = Logger.getLogger(LocalGcdHelper.class.getName());
-
- private final String projectId;
- private Path gcdPath;
- private Process startProcess;
- private ProcessStreamReader processReader;
- private ProcessErrorStreamReader processErrorReader;
- private final int port;
-
- public static final String DEFAULT_PROJECT_ID = "projectid1";
- public static final int DEFAULT_PORT = 8080;
+public class LocalDatastoreHelper {
+ private static final Logger log = Logger.getLogger(LocalDatastoreHelper.class.getName());
private static final String GCD_VERSION = "v1beta3";
- private static final String GCD_BUILD = "1.0.0";
+ private static final String GCD_BUILD = "1.0.1";
+ private static final double DEFAULT_CONSISTENCY = 0.9;
private static final String GCD_BASENAME = "gcd-" + GCD_VERSION + "-" + GCD_BUILD;
private static final String GCD_FILENAME = GCD_BASENAME + ".zip";
- private static final String MD5_CHECKSUM = "72156cc993835c57f72789519b85249b";
+ private static final String MD5_CHECKSUM = "df876ba8f054d69acff30ec9540ec386";
private static final URL GCD_URL;
private static final String GCLOUD = "gcloud";
private static final Path INSTALLED_GCD_PATH;
private static final String GCD_VERSION_PREFIX = "gcd-emulator ";
- private static final double DEFAULT_CONSISTENCY = 0.9;
+ private static final String PROJECT_ID_PREFIX = "test-project-";
+
+ private final String projectId;
+ private Path gcdPath;
+ private Process startProcess;
+ private ProcessStreamReader processReader;
+ private ProcessErrorStreamReader processErrorReader;
+ private final int port;
+ private final double consistency;
static {
INSTALLED_GCD_PATH = installedGcdPath();
@@ -101,14 +99,6 @@ public class LocalGcdHelper {
}
}
- public static int findAvailablePort(int defaultPort) {
- try (ServerSocket tempSocket = new ServerSocket(0)) {
- return tempSocket.getLocalPort();
- } catch (IOException e) {
- return defaultPort;
- }
- }
-
private static Path installedGcdPath() {
String gcloudExecutableName;
if (isWindows()) {
@@ -388,44 +378,6 @@ public static CommandWrapper create() {
}
}
- public LocalGcdHelper(String projectId, int port) {
- this.projectId = projectId;
- this.port = port;
- }
-
- /**
- * Starts the local datastore for the specific project.
- *
- * This will unzip the gcd tool, create the project and start it.
- * All content is written to a temporary directory that will be deleted when
- * {@link #stop()} is called or when the program terminates) to make sure that no left-over
- * data from prior runs is used.
- *
- * @param consistency the fraction of job application attempts that will succeed, with 0.0
- * resulting in no attempts succeeding, and 1.0 resulting in all attempts succeeding. Defaults
- * to 0.9. Note that setting this to 1.0 may mask incorrect assumptions about the consistency
- * of non-ancestor queries; non-ancestor queries are eventually consistent.
- */
- public void start(double consistency) throws IOException, InterruptedException {
- // send a quick request in case we have a hanging process from a previous run
- checkArgument(consistency >= 0.0 && consistency <= 1.0, "Consistency must be between 0 and 1");
- sendQuitRequest(port);
- // Each run is associated with its own folder that is deleted once test completes.
- gcdPath = Files.createTempDirectory("gcd");
- File gcdFolder = gcdPath.toFile();
- gcdFolder.deleteOnExit();
-
- Path gcdExecutablePath;
- // If cloud is available we use it, otherwise we download and start gcd
- if (INSTALLED_GCD_PATH == null) {
- downloadGcd();
- gcdExecutablePath = gcdPath.resolve("gcd");
- } else {
- gcdExecutablePath = INSTALLED_GCD_PATH;
- }
- startGcd(gcdExecutablePath, consistency);
- }
-
private void downloadGcd() throws IOException {
// check if we already have a local copy of the gcd utility and download it if not.
File gcdZipFile = new File(System.getProperty("java.io.tmpdir"), GCD_FILENAME);
@@ -589,80 +541,96 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
});
}
- public static LocalGcdHelper start(String projectId, int port, double consistency)
- throws IOException, InterruptedException {
- LocalGcdHelper helper = new LocalGcdHelper(projectId, port);
- helper.start(consistency);
- return helper;
+ private LocalDatastoreHelper(double consistency) {
+ checkArgument(consistency >= 0.0 && consistency <= 1.0, "Consistency must be between 0 and 1");
+ projectId = PROJECT_ID_PREFIX + UUID.randomUUID().toString();
+ this.consistency = consistency;
+ this.port = findAvailablePort();
}
- public static void main(String... args) throws IOException, InterruptedException {
- Map parsedArgs = parseArgs(args);
- String action = parsedArgs.get("action");
- int port =
- (parsedArgs.get("port") == null) ? DEFAULT_PORT : Integer.parseInt(parsedArgs.get("port"));
- switch (action) {
- case "START":
- if (!isActive(DEFAULT_PROJECT_ID, port)) {
- double consistency = parsedArgs.get("consistency") == null
- ? DEFAULT_CONSISTENCY : Double.parseDouble(parsedArgs.get("consistency"));
- LocalGcdHelper helper = start(DEFAULT_PROJECT_ID, port, consistency);
- try (FileWriter writer = new FileWriter(".local_gcd_helper")) {
- writer.write(helper.gcdPath.toAbsolutePath().toString() + System.lineSeparator());
- writer.write(Integer.toString(port));
- }
- }
- return;
- case "STOP":
- File file = new File(".local_gcd_helper");
- String path = null;
- boolean fileExists = file.exists();
- if (fileExists) {
- try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
- path = reader.readLine();
- port = Integer.parseInt(reader.readLine());
- }
- }
- sendQuitRequest(port);
- if (fileExists) {
- deleteRecurse(Paths.get(path));
- file.delete();
- }
- return;
- default:
- break;
+ private static int findAvailablePort() {
+ try (ServerSocket tempSocket = new ServerSocket(0)) {
+ return tempSocket.getLocalPort();
+ } catch (IOException e) {
+ return -1;
}
}
- private static Map parseArgs(String[] args) {
- Map parsedArgs = new HashMap();
- for (String arg : args) {
- if (arg.startsWith("--port=")) {
- parsedArgs.put("port", arg.substring("--port=".length()));
- } else if (arg.equals("START") || arg.equals("STOP")) {
- parsedArgs.put("action", arg);
- } else {
- throw new RuntimeException("Only accepts START, STOP, and --port= as arguments");
- }
- }
- if (parsedArgs.get("action") == null) {
- throw new RuntimeException("EXPECTING START | STOP");
- }
- return parsedArgs;
+ /**
+ * Returns a {@link DatastoreOptions} instance that sets the host to use the Datastore emulator on
+ * localhost.
+ */
+ public DatastoreOptions options() {
+ return DatastoreOptions.builder()
+ .projectId(projectId)
+ .host("localhost:" + Integer.toString(port))
+ .authCredentials(AuthCredentials.noAuth())
+ .retryParams(RetryParams.noRetries())
+ .build();
}
- public static boolean isActive(String projectId, int port) {
- try {
- StringBuilder urlBuilder = new StringBuilder("http://localhost:").append(port);
- urlBuilder.append("/datastore/v1beta3/projects/").append(projectId).append(":lookup");
- URL url = new URL(urlBuilder.toString());
- try (BufferedReader reader =
- new BufferedReader(new InputStreamReader(url.openStream(), UTF_8))) {
- return "Valid RPC".equals(reader.readLine());
- }
- } catch (IOException ignore) {
- // assume not active
- return false;
+ /**
+ * Returns the project ID associated with this local Datastore emulator.
+ */
+ public String projectId() {
+ return projectId;
+ }
+
+ /**
+ * Returns the consistency setting for the local Datastore emulator.
+ */
+ public double consistency() {
+ return consistency;
+ }
+
+ /**
+ * Creates a local Datastore helper with the specified settings for project ID and consistency.
+ *
+ * @param consistency the fraction of Datastore writes that are immediately visible to global
+ * queries, with 0.0 meaning no writes are immediately visible and 1.0 meaning all writes
+ * are immediately visible. Note that setting this to 1.0 may mask incorrect assumptions
+ * about the consistency of non-ancestor queries; non-ancestor queries are eventually
+ * consistent.
+ */
+ public static LocalDatastoreHelper create(double consistency) {
+ LocalDatastoreHelper helper = new LocalDatastoreHelper(consistency);
+ return helper;
+ }
+
+ /**
+ * Creates a local Datastore helper with a placeholder project ID and the default consistency
+ * setting of 0.9. Consistency refers to the fraction of Datastore writes that are immediately
+ * visible to global queries, with 0.0 meaning no writes are immediately visible and 1.0 meaning
+ * all writes are immediately visible.
+ */
+ public static LocalDatastoreHelper create() {
+ return create(DEFAULT_CONSISTENCY);
+ }
+
+ /**
+ * Starts the local Datastore emulator. Leftover data from previous uses of the emulator will be
+ * removed.
+ *
+ * @throws InterruptedException if emulator-related tasks are interrupted
+ * @throws IOException if there are socket exceptions or issues creating/deleting the temporary
+ * data folder
+ */
+ public void start() throws IOException, InterruptedException {
+ // send a quick request in case we have a hanging process from a previous run
+ sendQuitRequest(port);
+ // Each run is associated with its own folder that is deleted once test completes.
+ gcdPath = Files.createTempDirectory("gcd");
+ File gcdFolder = gcdPath.toFile();
+ gcdFolder.deleteOnExit();
+
+ Path gcdExecutablePath;
+ // If cloud is available we use it, otherwise we download and start gcd
+ if (INSTALLED_GCD_PATH == null) {
+ downloadGcd();
+ gcdExecutablePath = gcdPath.resolve("gcd");
+ } else {
+ gcdExecutablePath = INSTALLED_GCD_PATH;
}
+ startGcd(gcdExecutablePath, consistency);
}
}
diff --git a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/package-info.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/package-info.java
similarity index 75%
rename from gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/package-info.java
rename to gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/package-info.java
index d03c9d85cd09..1a00a8c13cf2 100644
--- a/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/testing/package-info.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing/package-info.java
@@ -20,20 +20,17 @@
* A simple usage example:
*
Before the test:
*
{@code
- * LocalGcdHelper gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT_NUMBER);
- * DatastoreOptions options = DatastoreOptions.builder()
- * .projectId(PROJECT_ID)
- * .host("localhost:8080")
- * .build();
- * Datastore localDatastore = options.service();
+ * LocalDatastoreHelper helper = LocalDatastoreHelper.create();
+ * helper.start();
+ * Datastore localDatastore = helper.options().service();
* }
*
* After the test:
*
{@code
- * gcdHelper.stop();
+ * helper.stop();
* }
*
* @see
* gcloud-java tools for testing
*/
-package com.google.gcloud.datastore.testing;
+package com.google.cloud.datastore.testing;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseDatastoreBatchWriterTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java
similarity index 99%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseDatastoreBatchWriterTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java
index 7e5938358299..6a30314082b7 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseDatastoreBatchWriterTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseDatastoreBatchWriterTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseEntityTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java
similarity index 99%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseEntityTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java
index bd8bdeebc6da..f5100b14dac5 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseEntityTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseEntityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseKeyTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java
similarity index 99%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseKeyTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java
index 974231d51c21..abbfbd3a2f16 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BaseKeyTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BaseKeyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java
index 1bb7c3fc476e..009c1a31ee1e 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java
index 2a4c0dc956e3..3c6586939a54 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BlobValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BlobValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BooleanValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BooleanValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java
index bff3d67c9465..2750c70e992b 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/BooleanValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/BooleanValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/CursorTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/CursorTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java
index 72fd3d13cebe..34bdd59bf196 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/CursorTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/CursorTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreExceptionTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java
similarity index 96%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreExceptionTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java
index e5bc50eee046..cf086ff25ba0 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreExceptionTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreExceptionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@@ -26,8 +26,8 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper;
import org.junit.Test;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreHelperTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreHelperTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java
index 61b266a9abc2..7f32de7b947b 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreHelperTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreHelperTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
@@ -29,7 +29,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;
-import com.google.gcloud.datastore.Datastore.TransactionCallable;
+import com.google.cloud.datastore.Datastore.TransactionCallable;
import org.easymock.EasyMock;
import org.junit.Test;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreOptionsTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java
similarity index 86%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreOptionsTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java
index 5b77c035a714..786f3ea79623 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreOptionsTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.datastore.spi.DatastoreRpc;
-import com.google.gcloud.datastore.spi.DatastoreRpcFactory;
-import com.google.gcloud.datastore.testing.LocalGcdHelper;
+import com.google.cloud.datastore.spi.DatastoreRpc;
+import com.google.cloud.datastore.spi.DatastoreRpcFactory;
import org.easymock.EasyMock;
import org.junit.Before;
@@ -30,8 +29,8 @@
public class DatastoreOptionsTest {
- private static final String PROJECT_ID = "project_id";
- private static final int PORT = LocalGcdHelper.findAvailablePort(LocalGcdHelper.DEFAULT_PORT);
+ private static final String PROJECT_ID = "project-id";
+ private static final int PORT = 8080;
private DatastoreRpcFactory datastoreRpcFactory;
private DatastoreRpc datastoreRpc;
private DatastoreOptions.Builder options;
@@ -41,7 +40,6 @@ public void setUp() {
datastoreRpcFactory = EasyMock.createMock(DatastoreRpcFactory.class);
datastoreRpc = EasyMock.createMock(DatastoreRpc.class);
options = DatastoreOptions.builder()
- .normalizeDataset(false)
.serviceRpcFactory(datastoreRpcFactory)
.projectId(PROJECT_ID)
.host("http://localhost:" + PORT);
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java
similarity index 96%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java
index 7819c9d689a8..cd028067ca83 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DatastoreTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -37,14 +37,13 @@
import com.google.datastore.v1beta3.ReadOptions.ReadConsistency;
import com.google.datastore.v1beta3.RunQueryRequest;
import com.google.datastore.v1beta3.RunQueryResponse;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.datastore.Query.ResultType;
-import com.google.gcloud.datastore.StructuredQuery.OrderBy;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
-import com.google.gcloud.datastore.spi.DatastoreRpc;
-import com.google.gcloud.datastore.spi.DatastoreRpcFactory;
-import com.google.gcloud.datastore.testing.LocalGcdHelper;
+import com.google.cloud.RetryParams;
+import com.google.cloud.datastore.Query.ResultType;
+import com.google.cloud.datastore.StructuredQuery.OrderBy;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.datastore.spi.DatastoreRpc;
+import com.google.cloud.datastore.spi.DatastoreRpcFactory;
+import com.google.cloud.datastore.testing.LocalDatastoreHelper;
import com.google.protobuf.ByteString;
import org.easymock.EasyMock;
@@ -68,7 +67,10 @@
@RunWith(JUnit4.class)
public class DatastoreTest {
- private static final String PROJECT_ID = LocalGcdHelper.DEFAULT_PROJECT_ID;
+ private static LocalDatastoreHelper helper = LocalDatastoreHelper.create(1.0);
+ private static final DatastoreOptions options = helper.options();
+ private static final Datastore datastore = options.service();
+ private static final String PROJECT_ID = options.projectId();
private static final String KIND1 = "kind1";
private static final String KIND2 = "kind2";
private static final String KIND3 = "kind3";
@@ -91,6 +93,7 @@ public class DatastoreTest {
.addValue(STR_VALUE, BOOL_VALUE)
.build();
private static final ListValue LIST_VALUE2 = ListValue.of(Collections.singletonList(KEY_VALUE));
+ private static final ListValue EMPTY_LIST_VALUE = ListValue.of(Collections.>emptyList());
private static final DateTimeValue DATE_TIME_VALUE = new DateTimeValue(DateTime.now());
private static final LatLngValue LAT_LNG_VALUE =
new LatLngValue(new LatLng(37.422035, -122.084124));
@@ -110,40 +113,27 @@ public class DatastoreTest {
.set("bool", BOOL_VALUE)
.set("partial1", EntityValue.of(PARTIAL_ENTITY1))
.set("list", LIST_VALUE2)
+ .set("emptyList", EMPTY_LIST_VALUE)
.build();
private static final Entity ENTITY2 = Entity.builder(ENTITY1).key(KEY2).remove("str")
.set("name", "Dan").setNull("null").set("age", 20).build();
private static final Entity ENTITY3 = Entity.builder(ENTITY1).key(KEY3).remove("str")
.set("null", NULL_VALUE).set("partial1", PARTIAL_ENTITY2).set("partial2", ENTITY2).build();
- private DatastoreOptions options;
private DatastoreOptions rpcMockOptions;
- private Datastore datastore;
private DatastoreRpcFactory rpcFactoryMock;
private DatastoreRpc rpcMock;
- private static LocalGcdHelper gcdHelper;
- private static final int PORT = LocalGcdHelper.findAvailablePort(LocalGcdHelper.DEFAULT_PORT);
-
@Rule
public ExpectedException thrown = ExpectedException.none();
@BeforeClass
public static void beforeClass() throws IOException, InterruptedException {
- if (!LocalGcdHelper.isActive(PROJECT_ID, PORT)) {
- gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT, 1.0);
- }
+ helper.start();
}
@Before
public void setUp() {
- options = DatastoreOptions.builder()
- .projectId(PROJECT_ID)
- .host("localhost:" + PORT)
- .authCredentials(AuthCredentials.noAuth())
- .retryParams(RetryParams.noRetries())
- .build();
- datastore = options.service();
rpcFactoryMock = EasyMock.createStrictMock(DatastoreRpcFactory.class);
rpcMock = EasyMock.createStrictMock(DatastoreRpc.class);
rpcMockOptions = options
@@ -160,9 +150,7 @@ public void setUp() {
@AfterClass
public static void afterClass() throws IOException, InterruptedException {
- if (gcdHelper != null) {
- gcdHelper.stop();
- }
+ helper.stop();
}
@Test
@@ -738,7 +726,9 @@ public void testGet() {
assertEquals(LAT_LNG_VALUE, value5);
FullEntity value6 = entity.getEntity("partial1");
assertEquals(PARTIAL_ENTITY1, value6);
- assertEquals(6, entity.names().size());
+ ListValue value7 = entity.getValue("emptyList");
+ assertEquals(EMPTY_LIST_VALUE, value7);
+ assertEquals(7, entity.names().size());
assertFalse(entity.contains("bla"));
}
@@ -783,7 +773,8 @@ public void testGetArrayNoDeferredResults() {
assertEquals(ENTITY2, partial2);
assertEquals(ValueType.BOOLEAN, entity3.getValue("bool").type());
assertEquals(LAT_LNG_VALUE, entity3.getValue("latLng"));
- assertEquals(7, entity3.names().size());
+ assertEquals(EMPTY_LIST_VALUE, entity3.getValue("emptyList"));
+ assertEquals(8, entity3.names().size());
assertFalse(entity3.contains("bla"));
try {
entity3.getString("str");
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeTest.java
index 23f3951a5dc3..34c2f7b7e29f 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeValueTest.java
index c90e8c88ba52..8262e97241fa 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DateTimeValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DateTimeValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DoubleValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DoubleValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java
index 24d9113ce873..ecc80fd14454 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DoubleValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/DoubleValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java
index 30bdf16d9397..c3aad6f285ff 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java
index e7df91ac0016..07fb3bb0d5cf 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/EntityValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/EntityValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/FullEntityTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/FullEntityTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java
index 1d62c7a6dfae..c1a47212e422 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/FullEntityTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/FullEntityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/IncompleteKeyTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/IncompleteKeyTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java
index acd1dfd3c9e3..f4562901d5c6 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/IncompleteKeyTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/IncompleteKeyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyFactoryTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java
similarity index 99%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyFactoryTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java
index dacb348c2172..93f08de11be8 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyFactoryTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyFactoryTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java
index 1fdcc5394e7e..398ea22d01e4 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java
index b2e916983b8a..0d2670b48c88 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/KeyValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/KeyValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java
index 1955ec236300..401d8cc0c4c8 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java
index 3a25078237d4..583f89ef6cfe 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LatLngValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LatLngValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ListValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java
similarity index 83%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ListValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java
index 6245c715d476..47acc549d65d 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ListValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ListValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -24,6 +24,7 @@
import org.junit.Test;
+import java.util.Collections;
import java.util.List;
public class ListValueTest {
@@ -37,12 +38,14 @@ public void testToBuilder() throws Exception {
assertEquals(value, value.toBuilder().build());
}
- @SuppressWarnings("deprecation")
@Test
public void testOf() throws Exception {
ListValue value = ListValue.of(CONTENT);
assertEquals(CONTENT, value.get());
assertFalse(value.excludeFromIndexes());
+ value = ListValue.of(Collections.>emptyList());
+ assertEquals(Collections.>emptyList(), value.get());
+ assertFalse(value.excludeFromIndexes());
}
@SuppressWarnings("deprecation")
@@ -59,5 +62,8 @@ public void testBuilder() throws Exception {
builder.addValue(v);
}
assertEquals(CONTENT, builder.build().get());
+
+ builder = builder.set(Collections.>emptyList());
+ assertEquals(Collections.>emptyList(), builder.build().get());
}
}
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LongValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LongValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java
index 717c1567bc45..135f5fb8ac6a 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LongValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/LongValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/NullValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/NullValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java
index 0856fced7992..ffed6e69c4f5 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/NullValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/NullValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/PathElementTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/PathElementTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java
index 393521ff08b9..269dddb51d71 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/PathElementTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/PathElementTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ProjectionEntityTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java
similarity index 98%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ProjectionEntityTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java
index 43eec2f02001..2b53e6efc04c 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ProjectionEntityTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ProjectionEntityTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/RawValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/RawValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java
index 1ab1c36538de..1d603888b5d1 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/RawValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/RawValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/SerializationTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java
similarity index 93%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/SerializationTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java
index 3679aba6825c..ab771f0118a1 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/SerializationTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/SerializationTest.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.BaseSerializationTest;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.datastore.StructuredQuery.CompositeFilter;
-import com.google.gcloud.datastore.StructuredQuery.OrderBy;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.BaseSerializationTest;
+import com.google.cloud.Restorable;
+import com.google.cloud.datastore.StructuredQuery.CompositeFilter;
+import com.google.cloud.datastore.StructuredQuery.OrderBy;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
public class SerializationTest extends BaseSerializationTest {
@@ -110,7 +110,6 @@ public class SerializationTest extends BaseSerializationTest {
protected java.io.Serializable[] serializableObjects() {
DatastoreOptions options = DatastoreOptions.builder()
.authCredentials(AuthCredentials.createForAppEngine())
- .normalizeDataset(false)
.projectId("ds1")
.build();
DatastoreOptions otherOptions = options.toBuilder()
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StringValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java
similarity index 97%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StringValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java
index 4f02568bf924..8dab36015515 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StringValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StringValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StructuredQueryTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java
similarity index 94%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StructuredQueryTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java
index cab98ab53837..7f5bbdd74e82 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/StructuredQueryTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/StructuredQueryTest.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.datastore.Query.ResultType;
-import com.google.gcloud.datastore.StructuredQuery.CompositeFilter;
-import com.google.gcloud.datastore.StructuredQuery.Filter;
-import com.google.gcloud.datastore.StructuredQuery.OrderBy;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.datastore.Query.ResultType;
+import com.google.cloud.datastore.StructuredQuery.CompositeFilter;
+import com.google.cloud.datastore.StructuredQuery.Filter;
+import com.google.cloud.datastore.StructuredQuery.OrderBy;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
import org.junit.Test;
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ValueTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java
similarity index 99%
rename from gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ValueTest.java
rename to gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java
index fb718dffe1e5..bb039d1a1ac9 100644
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/ValueTest.java
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/ValueTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.datastore;
+package com.google.cloud.datastore;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/testing/LocalDatastoreHelperTest.java b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/testing/LocalDatastoreHelperTest.java
new file mode 100644
index 000000000000..73844d2e19b3
--- /dev/null
+++ b/gcloud-java-datastore/src/test/java/com/google/cloud/datastore/testing/LocalDatastoreHelperTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+package com.google.cloud.datastore.testing;
+
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.datastore.DatastoreOptions;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class LocalDatastoreHelperTest {
+
+ private static final double TOLERANCE = 0.00001;
+ private static final String PROJECT_ID_PREFIX = "test-project-";
+
+ @Test
+ public void testCreate() {
+ LocalDatastoreHelper helper = LocalDatastoreHelper.create(0.75);
+ assertTrue(Math.abs(0.75 - helper.consistency()) < TOLERANCE);
+ assertTrue(helper.projectId().startsWith(PROJECT_ID_PREFIX));
+ helper = LocalDatastoreHelper.create();
+ assertTrue(Math.abs(0.9 - helper.consistency()) < TOLERANCE);
+ assertTrue(helper.projectId().startsWith(PROJECT_ID_PREFIX));
+ }
+
+ @Test
+ public void testOptions() {
+ LocalDatastoreHelper helper = LocalDatastoreHelper.create();
+ DatastoreOptions options = helper.options();
+ assertTrue(options.projectId().startsWith(PROJECT_ID_PREFIX));
+ assertTrue(options.host().startsWith("localhost:"));
+ assertSame(AuthCredentials.noAuth(), options.authCredentials());
+ }
+}
diff --git a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LocalGcdHelperTest.java b/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LocalGcdHelperTest.java
deleted file mode 100644
index 5d761a713506..000000000000
--- a/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/LocalGcdHelperTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2015 Google Inc. All Rights Reserved.
- *
- * 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.
- */
-
-package com.google.gcloud.datastore;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.google.gcloud.datastore.testing.LocalGcdHelper;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-@RunWith(JUnit4.class)
-public class LocalGcdHelperTest {
-
- private static final String PROJECT_ID = LocalGcdHelper.DEFAULT_PROJECT_ID;
- private static final int PORT = LocalGcdHelper.findAvailablePort(LocalGcdHelper.DEFAULT_PORT);
-
- @Test
- public void testFindAvailablePort() {
- int chosenPort = LocalGcdHelper.findAvailablePort(LocalGcdHelper.DEFAULT_PORT);
- try (ServerSocket tempSocket = new ServerSocket(chosenPort)) {
- // success
- } catch (IOException e) {
- if (chosenPort != LocalGcdHelper.DEFAULT_PORT) {
- fail("Chosen port not free, even though LocalGcdHelper claimed it was.");
- }
- }
- }
-
- @Test
- public void testSendQuitRequest() throws IOException, InterruptedException {
- LocalGcdHelper gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT, 0.75);
- assertTrue(LocalGcdHelper.sendQuitRequest(PORT));
- long timeoutMillis = 30000;
- long startTime = System.currentTimeMillis();
- boolean datastoreActive = LocalGcdHelper.isActive(PROJECT_ID, PORT);
- while (datastoreActive && System.currentTimeMillis() - startTime < timeoutMillis) {
- datastoreActive = LocalGcdHelper.isActive(PROJECT_ID, PORT);
- }
- assertFalse(datastoreActive);
- assertFalse(LocalGcdHelper.sendQuitRequest(PORT));
- gcdHelper.stop();
- }
-
- @Test
- public void testStartStop() throws IOException, InterruptedException {
- LocalGcdHelper gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT, 0.75);
- assertFalse(LocalGcdHelper.isActive("wrong-project-id", PORT));
- assertTrue(LocalGcdHelper.isActive(PROJECT_ID, PORT));
- gcdHelper.stop();
- assertFalse(LocalGcdHelper.isActive(PROJECT_ID, PORT));
- }
-}
diff --git a/gcloud-java-dns/README.md b/gcloud-java-dns/README.md
index 0bb9a47635a2..994ab5615598 100644
--- a/gcloud-java-dns/README.md
+++ b/gcloud-java-dns/README.md
@@ -5,12 +5,12 @@ Java idiomatic client for [Google Cloud DNS] (https://cloud.google.com/dns/).
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-dns.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-dns.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-dns.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-dns.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/dns/package-summary.html)
+- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/dns/package-summary.html)
> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.
@@ -20,27 +20,27 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-dns
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-dns:0.1.7'
+compile 'com.google.cloud:gcloud-java-dns:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-dns" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-dns" % "0.2.0"
```
Example Application
-------------------
-[`DnsExample`](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java)
+[`DnsExample`](../gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/DnsExample.java)
is a simple command line interface that provides some of Google Cloud DNS's functionality. Read
more about using the application on the
-[`DnsExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/dns/DnsExample.html).
+[`DnsExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/cloud/examples/dns/DnsExample.html).
Authentication
--------------
@@ -83,8 +83,8 @@ These credentials are automatically inferred from your environment, so you only
code to create your service object:
```java
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
Dns dns = DnsOptions.defaultInstance().service();
```
@@ -110,8 +110,8 @@ requires fully qualified domain names which must end with a period.*
Add the following imports at the top of your file:
```java
-import com.google.gcloud.dns.Zone;
-import com.google.gcloud.dns.ZoneInfo;
+import com.google.cloud.dns.Zone;
+import com.google.cloud.dns.ZoneInfo;
```
Then add the following code to create a zone.
@@ -159,8 +159,8 @@ our zone that creates a record set of type A and points URL www.someexampledomai
IP address 12.13.14.15. Start by adding
```java
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.RecordSet;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.RecordSet;
import java.util.concurrent.TimeUnit;
```
@@ -325,11 +325,11 @@ if (result) {
#### Complete Source Code
We composed some of the aforementioned snippets into complete executable code samples. In
-[CreateZones.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateZone.java)
-we create a zone. In [CreateOrUpdateRecordSets.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateOrUpdateRecordSets.java)
+[CreateZones.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java)
+we create a zone. In [CreateOrUpdateRecordSets.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java)
we create a type A record set for a zone, or update an existing type A record set to a new IP address. We
-demonstrate how to delete a zone in [DeleteZone.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/DeleteZone.java).
-Finally, in [ManipulateZonesAndRecordSets.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java)
+demonstrate how to delete a zone in [DeleteZone.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/DeleteZone.java).
+Finally, in [ManipulateZonesAndRecordSets.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java)
we assemble all the code snippets together and create zone, create or update a record set, list zones, list record sets, list changes, and
delete a zone. The applications assume that they are running on Compute Engine or from your own desktop. To run any of these examples on App
Engine, simply move the code from the main method to your application's servlet class and change the
@@ -383,5 +383,5 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-platform]: https://cloud.google.com/
[cloud-dns]: https://cloud.google.com/dns/
-[dns-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/dns/package-summary.html
+[dns-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/dns/package-summary.html
[dns-activate]:https://cloud.google.com/dns/getting-started#prerequisites
diff --git a/gcloud-java-dns/pom.xml b/gcloud-java-dns/pom.xml
index a4928ccf0397..73e949dd5b1e 100644
--- a/gcloud-java-dns/pom.xml
+++ b/gcloud-java-dns/pom.xml
@@ -6,13 +6,14 @@
gcloud-java-dns
jar
GCloud Java DNS
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-dns
Java idiomatic client for Google Cloud DNS.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-dns
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequest.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequest.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequest.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequest.java
index b3a2a2170d8b..61864e968ebb 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequest.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequestInfo.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequestInfo.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
index 4a92512996dd..53bce6cf1380 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequestInfo.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Dns.java
similarity index 98%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/Dns.java
index 2216733ca779..f7c1aef0a02c 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Dns.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.FieldSelector;
-import com.google.gcloud.FieldSelector.Helper;
-import com.google.gcloud.Page;
-import com.google.gcloud.Service;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.FieldSelector;
+import com.google.cloud.FieldSelector.Helper;
+import com.google.cloud.Page;
+import com.google.cloud.Service;
+import com.google.cloud.dns.spi.DnsRpc;
import java.util.List;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsException.java
similarity index 90%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsException.java
index 1ecb98a3fdc6..8da76625cead 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsException.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.RetryHelper.RetryInterruptedException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.RetryHelper.RetryInterruptedException;
import java.io.IOException;
import java.util.Set;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsFactory.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsFactory.java
similarity index 91%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsFactory.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsFactory.java
index 734652afb24d..38c4c68de596 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsFactory.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsFactory.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
-import com.google.gcloud.ServiceFactory;
+import com.google.cloud.ServiceFactory;
/**
* An interface for Dns factories.
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsImpl.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsImpl.java
similarity index 97%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsImpl.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsImpl.java
index 3218daa543b2..785face46173 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsImpl.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsImpl.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.gcloud.RetryHelper.runWithRetries;
+import static com.google.cloud.RetryHelper.runWithRetries;
import com.google.api.services.dns.model.Change;
import com.google.api.services.dns.model.ManagedZone;
@@ -28,11 +28,11 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
-import com.google.gcloud.BaseService;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.RetryHelper;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.BaseService;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
+import com.google.cloud.RetryHelper;
+import com.google.cloud.dns.spi.DnsRpc;
import java.util.Map;
import java.util.concurrent.Callable;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsOptions.java
similarity index 91%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsOptions.java
index 541e7a6c6ea7..059f7b212044 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/DnsOptions.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.dns.spi.DefaultDnsRpc;
-import com.google.gcloud.dns.spi.DnsRpc;
-import com.google.gcloud.dns.spi.DnsRpcFactory;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.dns.spi.DefaultDnsRpc;
+import com.google.cloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.spi.DnsRpcFactory;
import java.util.Set;
@@ -69,13 +69,11 @@ private DnsOptions(Builder builder) {
super(DnsFactory.class, DnsRpcFactory.class, builder);
}
- @SuppressWarnings("unchecked")
@Override
protected DnsFactory defaultServiceFactory() {
return DefaultDnsFactory.INSTANCE;
}
- @SuppressWarnings("unchecked")
@Override
protected DnsRpcFactory defaultRpcFactory() {
return DefaultDnsRpcFactory.INSTANCE;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Option.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Option.java
similarity index 96%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/Option.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/Option.java
index fee99898fb24..b0e23220549c 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Option.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Option.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.spi.DnsRpc;
import java.io.Serializable;
import java.util.Objects;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ProjectInfo.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/ProjectInfo.java
index 52edb25ec902..3d0d4704e6c0 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ProjectInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/RecordSet.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/RecordSet.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/RecordSet.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/RecordSet.java
index 90beedba1d89..a8323041a2fb 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/RecordSet.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/RecordSet.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Zone.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/Zone.java
index c4250bd206eb..8c21d79a992f 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/Zone.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.api.services.dns.model.ManagedZone;
-import com.google.gcloud.Page;
+import com.google.cloud.Page;
import java.io.IOException;
import java.io.ObjectInputStream;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ZoneInfo.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/ZoneInfo.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java
index 03c23a6ce3d3..2b8c79e7fe5c 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ZoneInfo.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/package-info.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/package-info.java
similarity index 68%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/package-info.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/package-info.java
index 36f41852400c..cdcce0d1ef90 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/package-info.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/package-info.java
@@ -17,10 +17,12 @@
/**
* A client to the Google Cloud DNS.
*
- * Here are two simple usage examples from within Compute/App Engine.
+ *
+ * Here are two simple usage examples from within Compute/App Engine.
*
* The first snippet shows how to create a zone resource. The complete source code can be found on
- *
+ *
* CreateAndListZones.java. Note that you need to replace the {@code domainName} with a domain
* name that you own and the ownership of which you verified with Google.
*
@@ -33,8 +35,10 @@
* Zone createdZone = dns.create(zoneInfo);
* }
*
- * The second example shows how to create records inside a zone. The complete code can be found
- * on
+ *
+ * The second example shows how to create records inside a zone. The complete code can be found on
+ *
* CreateAndListDnsRecords.java.
*
*
{@code
@@ -50,11 +54,13 @@
* zone.applyChangeRequest(changeRequest);
* }
*
- * When using gcloud-java from outside of App/Compute Engine, you have to specify a
- * project ID and provide
+ *
+ * When using gcloud-java from outside of App/Compute Engine, you have to
+ * specify a
+ * project ID and
+ * provide
* credentials.
*
* @see Google Cloud DNS
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DefaultDnsRpc.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DefaultDnsRpc.java
similarity index 91%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DefaultDnsRpc.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DefaultDnsRpc.java
index cbebd19d0d73..05b803513acb 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DefaultDnsRpc.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DefaultDnsRpc.java
@@ -1,13 +1,13 @@
-package com.google.gcloud.dns.spi;
-
-import static com.google.gcloud.dns.spi.DnsRpc.ListResult.of;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.DNS_NAME;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.DNS_TYPE;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.FIELDS;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.NAME;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.PAGE_SIZE;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.PAGE_TOKEN;
-import static com.google.gcloud.dns.spi.DnsRpc.Option.SORTING_ORDER;
+package com.google.cloud.dns.spi;
+
+import static com.google.cloud.dns.spi.DnsRpc.ListResult.of;
+import static com.google.cloud.dns.spi.DnsRpc.Option.DNS_NAME;
+import static com.google.cloud.dns.spi.DnsRpc.Option.DNS_TYPE;
+import static com.google.cloud.dns.spi.DnsRpc.Option.FIELDS;
+import static com.google.cloud.dns.spi.DnsRpc.Option.NAME;
+import static com.google.cloud.dns.spi.DnsRpc.Option.PAGE_SIZE;
+import static com.google.cloud.dns.spi.DnsRpc.Option.PAGE_TOKEN;
+import static com.google.cloud.dns.spi.DnsRpc.Option.SORTING_ORDER;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import com.google.api.client.http.HttpRequestInitializer;
@@ -21,8 +21,8 @@
import com.google.api.services.dns.model.Project;
import com.google.api.services.dns.model.ResourceRecordSet;
import com.google.api.services.dns.model.ResourceRecordSetsListResponse;
-import com.google.gcloud.dns.DnsException;
-import com.google.gcloud.dns.DnsOptions;
+import com.google.cloud.dns.DnsException;
+import com.google.cloud.dns.DnsOptions;
import java.io.IOException;
import java.util.Map;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpc.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpc.java
similarity index 98%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpc.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpc.java
index c7478016db27..57d6b45ba3a5 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpc.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpc.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.spi;
+package com.google.cloud.dns.spi;
import com.google.api.services.dns.model.Change;
import com.google.api.services.dns.model.ManagedZone;
import com.google.api.services.dns.model.Project;
import com.google.api.services.dns.model.ResourceRecordSet;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.dns.DnsException;
+import com.google.cloud.dns.DnsException;
import java.util.Map;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpcFactory.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpcFactory.java
similarity index 86%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpcFactory.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpcFactory.java
index ca1b1a0dd018..f54f9d02b41e 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/spi/DnsRpcFactory.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/spi/DnsRpcFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.spi;
+package com.google.cloud.dns.spi;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.spi.ServiceRpcFactory;
/**
* An interface for DnsRpc factory. Implementation will be loaded via {@link
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/LocalDnsHelper.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/LocalDnsHelper.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/LocalDnsHelper.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/LocalDnsHelper.java
index 54edcddb5ade..46d116bdf640 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/LocalDnsHelper.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/LocalDnsHelper.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.testing;
+package com.google.cloud.dns.testing;
import static com.google.common.net.InetAddresses.isInetAddress;
import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
@@ -36,7 +36,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.io.ByteStreams;
-import com.google.gcloud.dns.DnsOptions;
+import com.google.cloud.dns.DnsOptions;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/OptionParsers.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/OptionParsers.java
similarity index 99%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/OptionParsers.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/OptionParsers.java
index bd773a931ef2..0543c6faab52 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/OptionParsers.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/OptionParsers.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.testing;
+package com.google.cloud.dns.testing;
import com.google.api.services.dns.model.Change;
import com.google.api.services.dns.model.ManagedZone;
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/package-info.java b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/package-info.java
similarity index 96%
rename from gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/package-info.java
rename to gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/package-info.java
index a0a0c593c2b7..da431658c712 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/testing/package-info.java
+++ b/gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/package-info.java
@@ -24,8 +24,8 @@
* // request processing synchronous.
* long delay = 0;
* LocalDnsHelper dnsHelper = LocalDnsHelper.create(delay);
- * Dns dns = dnsHelper.options().service();
* dnsHelper.start();
+ * Dns dns = dnsHelper.options().service();
* }
*
* After the test:
@@ -33,4 +33,4 @@
* dnsHelper.stop();
* }
*/
-package com.google.gcloud.dns.testing;
+package com.google.cloud.dns.testing;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestInfoTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestInfoTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestInfoTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestInfoTest.java
index 136a6e0d56ec..2da7ad75c569 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestInfoTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestTest.java
index 2c3be337f033..6daa1a0a8cdd 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ChangeRequestTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ChangeRequestTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expect;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsImplTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsImplTest.java
similarity index 98%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsImplTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsImplTest.java
index c359871b998c..fe3b08f8625b 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsImplTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsImplTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -25,11 +25,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.gcloud.Page;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.dns.spi.DnsRpc;
-import com.google.gcloud.dns.spi.DnsRpcFactory;
+import com.google.cloud.Page;
+import com.google.cloud.RetryParams;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.spi.DnsRpcFactory;
import org.easymock.Capture;
import org.easymock.EasyMock;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsTest.java
similarity index 98%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsTest.java
index df86d6ebd495..91d46e94262d 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/DnsTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.spi.DnsRpc;
import org.junit.Test;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/OptionTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/OptionTest.java
similarity index 96%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/OptionTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/OptionTest.java
index e9906354f963..1e5be1287ceb 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/OptionTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/OptionTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.spi.DnsRpc;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ProjectInfoTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/ProjectInfoTest.java
index d959d44d4351..70086250e6dd 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ProjectInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/RecordSetTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/RecordSetTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/RecordSetTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/RecordSetTest.java
index fc888bf8a697..f5c515b6752d 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/RecordSetTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/RecordSetTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/SerializationTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/SerializationTest.java
similarity index 96%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/SerializationTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/SerializationTest.java
index 7742d4c59a48..32b1bbbd0667 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/SerializationTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/SerializationTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.BaseSerializationTest;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.RetryParams;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.BaseSerializationTest;
+import com.google.cloud.Restorable;
+import com.google.cloud.RetryParams;
import java.io.Serializable;
import java.math.BigInteger;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneInfoTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneInfoTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneInfoTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneInfoTest.java
index b537735c3c4e..215d377f6a67 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneInfoTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneTest.java
index 5407d4f248b7..fc23316a899b 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/ZoneTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns;
+package com.google.cloud.dns;
import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expect;
@@ -31,7 +31,7 @@
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.Page;
+import com.google.cloud.Page;
import org.junit.After;
import org.junit.Before;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/it/ITDnsTest.java
similarity index 98%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/it/ITDnsTest.java
index e6513451e7f6..2d6ce2e45457 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/it/ITDnsTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/it/ITDnsTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.it;
+package com.google.cloud.dns.it;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -24,16 +24,16 @@
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.Page;
-import com.google.gcloud.dns.ChangeRequest;
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsException;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.ProjectInfo;
-import com.google.gcloud.dns.RecordSet;
-import com.google.gcloud.dns.Zone;
-import com.google.gcloud.dns.ZoneInfo;
+import com.google.cloud.Page;
+import com.google.cloud.dns.ChangeRequest;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsException;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.ProjectInfo;
+import com.google.cloud.dns.RecordSet;
+import com.google.cloud.dns.Zone;
+import com.google.cloud.dns.ZoneInfo;
import org.junit.AfterClass;
import org.junit.BeforeClass;
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/testing/LocalDnsHelperTest.java b/gcloud-java-dns/src/test/java/com/google/cloud/dns/testing/LocalDnsHelperTest.java
similarity index 99%
rename from gcloud-java-dns/src/test/java/com/google/gcloud/dns/testing/LocalDnsHelperTest.java
rename to gcloud-java-dns/src/test/java/com/google/cloud/dns/testing/LocalDnsHelperTest.java
index 315a47c5bb7c..2231d2f08974 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/testing/LocalDnsHelperTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/cloud/dns/testing/LocalDnsHelperTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.dns.testing;
+package com.google.cloud.dns.testing;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,9 +31,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.gcloud.dns.DnsException;
-import com.google.gcloud.dns.spi.DefaultDnsRpc;
-import com.google.gcloud.dns.spi.DnsRpc;
+import com.google.cloud.dns.DnsException;
+import com.google.cloud.dns.spi.DefaultDnsRpc;
+import com.google.cloud.dns.spi.DnsRpc;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/gcloud-java-examples/README.md b/gcloud-java-examples/README.md
index fc6b7c28f636..2aab551da6f6 100644
--- a/gcloud-java-examples/README.md
+++ b/gcloud-java-examples/README.md
@@ -5,30 +5,30 @@ Examples for gcloud-java (Java idiomatic client for [Google Cloud Platform][clou
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-examples.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-examples.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-examples.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-examples.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [Examples] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/examples/package-summary.html)
+- [Examples] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/examples/package-summary.html)
Quickstart
----------
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-examples
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-examples:0.1.7'
+compile 'com.google.cloud:gcloud-java-examples:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-examples" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-examples" % "0.2.0"
```
To run examples from your command line:
@@ -55,20 +55,20 @@ To run examples from your command line:
```
Then you are ready to run the following example:
```
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample" -Dexec.args="create dataset new_dataset_id"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample" -Dexec.args="create table new_dataset_id new_table_id field_name:string"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample" -Dexec.args="list tables new_dataset_id"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample" -Dexec.args="load new_dataset_id new_table_id CSV gs://my_bucket/my_csv_file"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample" -Dexec.args="query 'select * from new_dataset_id.new_table_id'"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample" -Dexec.args="create dataset new_dataset_id"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample" -Dexec.args="create table new_dataset_id new_table_id field_name:string"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample" -Dexec.args="list tables new_dataset_id"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample" -Dexec.args="load new_dataset_id new_table_id CSV gs://my_bucket/my_csv_file"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample" -Dexec.args="query 'select * from new_dataset_id.new_table_id'"
```
* Here's an example run of `DatastoreExample`.
Be sure to change the placeholder project ID "your-project-id" with your own project ID. Also note that you have to enable the Google Cloud Datastore API on the [Google Developers Console][developers-console] before running the following commands.
```
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name add my\ comment"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name display"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name delete"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name add my\ comment"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name display"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample" -Dexec.args="your-project-id my_name delete"
```
* Here's an example run of `DnsExample`.
@@ -77,33 +77,33 @@ To run examples from your command line:
You will need to replace the domain name `elaborateexample.com` with your own domain name with [verified ownership] (https://www.google.com/webmasters/verification/home).
Also, note that the example creates and deletes record sets of type A only. Operations with other record types are not implemented in the example.
```
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="create some-sample-zone elaborateexample.com. description"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="list"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="list some-sample-zone records"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="add-record some-sample-zone www.elaborateexample.com. 12.13.14.15 69"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="get some-sample-zone"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="delete-record some-sample-zone www.elaborateexample.com. 12.13.14.15 69"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="list some-sample-zone changes ascending"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample" -Dexec.args="delete some-sample-zone"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="create some-sample-zone elaborateexample.com. description"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="list"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="list some-sample-zone records"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="add-record some-sample-zone www.elaborateexample.com. 12.13.14.15 69"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="get some-sample-zone"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="delete-record some-sample-zone www.elaborateexample.com. 12.13.14.15 69"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="list some-sample-zone changes ascending"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample" -Dexec.args="delete some-sample-zone"
```
* Here's an example run of `ResourceManagerExample`.
Be sure to change the placeholder project ID "your-project-id" with your own globally unique project ID.
```
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="create your-project-id"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="list"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="get your-project-id"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="create your-project-id"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="list"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.resourcemanager.ResourceManagerExample" -Dexec.args="get your-project-id"
```
* Here's an example run of `StorageExample`.
Before running the example, go to the [Google Developers Console][developers-console] to ensure that "Google Cloud Storage" and "Google Cloud Storage JSON API" are enabled and that you have a bucket. Also ensure that you have a test file (`test.txt` is chosen here) to upload to Cloud Storage stored locally on your machine.
```
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.storage.StorageExample" -Dexec.args="upload /path/to/test.txt "
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.storage.StorageExample" -Dexec.args="list "
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.storage.StorageExample" -Dexec.args="download test.txt"
- mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.storage.StorageExample" -Dexec.args="delete test.txt"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.storage.StorageExample" -Dexec.args="upload /path/to/test.txt "
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.storage.StorageExample" -Dexec.args="list "
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.storage.StorageExample" -Dexec.args="download test.txt"
+ mvn exec:java -Dexec.mainClass="com.google.cloud.examples.storage.StorageExample" -Dexec.args="delete test.txt"
```
Troubleshooting
diff --git a/gcloud-java-examples/pom.xml b/gcloud-java-examples/pom.xml
index f5d4cb290118..15b4e456494b 100644
--- a/gcloud-java-examples/pom.xml
+++ b/gcloud-java-examples/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-examples
jar
GCloud Java examples
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-examples
Examples for gcloud-java.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-examples
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/BigQueryExample.java
similarity index 94%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/BigQueryExample.java
index fe27ee3cf63b..b0a7680cf2b9 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/BigQueryExample.java
@@ -14,36 +14,36 @@
* limitations under the License.
*/
-package com.google.gcloud.examples.bigquery;
+package com.google.cloud.examples.bigquery;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQueryError;
-import com.google.gcloud.bigquery.BigQueryOptions;
-import com.google.gcloud.bigquery.CopyJobConfiguration;
-import com.google.gcloud.bigquery.Dataset;
-import com.google.gcloud.bigquery.DatasetId;
-import com.google.gcloud.bigquery.DatasetInfo;
-import com.google.gcloud.bigquery.ExternalTableDefinition;
-import com.google.gcloud.bigquery.ExtractJobConfiguration;
-import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.FieldValue;
-import com.google.gcloud.bigquery.FormatOptions;
-import com.google.gcloud.bigquery.Job;
-import com.google.gcloud.bigquery.JobId;
-import com.google.gcloud.bigquery.JobInfo;
-import com.google.gcloud.bigquery.LoadJobConfiguration;
-import com.google.gcloud.bigquery.QueryRequest;
-import com.google.gcloud.bigquery.QueryResponse;
-import com.google.gcloud.bigquery.Schema;
-import com.google.gcloud.bigquery.StandardTableDefinition;
-import com.google.gcloud.bigquery.Table;
-import com.google.gcloud.bigquery.TableId;
-import com.google.gcloud.bigquery.TableInfo;
-import com.google.gcloud.bigquery.ViewDefinition;
-import com.google.gcloud.bigquery.WriteChannelConfiguration;
-import com.google.gcloud.bigquery.spi.BigQueryRpc.Tuple;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQueryError;
+import com.google.cloud.bigquery.BigQueryOptions;
+import com.google.cloud.bigquery.CopyJobConfiguration;
+import com.google.cloud.bigquery.Dataset;
+import com.google.cloud.bigquery.DatasetId;
+import com.google.cloud.bigquery.DatasetInfo;
+import com.google.cloud.bigquery.ExternalTableDefinition;
+import com.google.cloud.bigquery.ExtractJobConfiguration;
+import com.google.cloud.bigquery.Field;
+import com.google.cloud.bigquery.FieldValue;
+import com.google.cloud.bigquery.FormatOptions;
+import com.google.cloud.bigquery.Job;
+import com.google.cloud.bigquery.JobId;
+import com.google.cloud.bigquery.JobInfo;
+import com.google.cloud.bigquery.LoadJobConfiguration;
+import com.google.cloud.bigquery.QueryRequest;
+import com.google.cloud.bigquery.QueryResponse;
+import com.google.cloud.bigquery.Schema;
+import com.google.cloud.bigquery.StandardTableDefinition;
+import com.google.cloud.bigquery.Table;
+import com.google.cloud.bigquery.TableId;
+import com.google.cloud.bigquery.TableInfo;
+import com.google.cloud.bigquery.ViewDefinition;
+import com.google.cloud.bigquery.WriteChannelConfiguration;
+import com.google.cloud.bigquery.spi.BigQueryRpc.Tuple;
import java.nio.channels.FileChannel;
import java.nio.file.Paths;
@@ -63,7 +63,7 @@
* login using gcloud SDK - {@code gcloud auth login}.
* compile using maven - {@code mvn compile}
* run using maven -
- * {@code mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.bigquery.BigQueryExample"
+ * {@code mvn exec:java -Dexec.mainClass="com.google.cloud.examples.bigquery.BigQueryExample"
* -Dexec.args="[]
* list datasets |
* list tables |
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/CreateTableAndLoadData.java
similarity index 79%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/CreateTableAndLoadData.java
index 857f6b43d013..01290ec8b491 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/CreateTableAndLoadData.java
@@ -20,18 +20,18 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.bigquery.snippets;
+package com.google.cloud.examples.bigquery.snippets;
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQueryOptions;
-import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.FormatOptions;
-import com.google.gcloud.bigquery.Job;
-import com.google.gcloud.bigquery.Schema;
-import com.google.gcloud.bigquery.StandardTableDefinition;
-import com.google.gcloud.bigquery.Table;
-import com.google.gcloud.bigquery.TableId;
-import com.google.gcloud.bigquery.TableInfo;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQueryOptions;
+import com.google.cloud.bigquery.Field;
+import com.google.cloud.bigquery.FormatOptions;
+import com.google.cloud.bigquery.Job;
+import com.google.cloud.bigquery.Schema;
+import com.google.cloud.bigquery.StandardTableDefinition;
+import com.google.cloud.bigquery.Table;
+import com.google.cloud.bigquery.TableId;
+import com.google.cloud.bigquery.TableInfo;
/**
* A snippet for Google Cloud BigQuery showing how to get a BigQuery table or create it if it does
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/InsertDataAndQueryTable.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/InsertDataAndQueryTable.java
similarity index 82%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/InsertDataAndQueryTable.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/InsertDataAndQueryTable.java
index ba2d1291b229..6fb2a7dce997 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/InsertDataAndQueryTable.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/InsertDataAndQueryTable.java
@@ -20,21 +20,21 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.bigquery.snippets;
+package com.google.cloud.examples.bigquery.snippets;
-import com.google.gcloud.bigquery.BigQuery;
-import com.google.gcloud.bigquery.BigQueryOptions;
-import com.google.gcloud.bigquery.DatasetInfo;
-import com.google.gcloud.bigquery.Field;
-import com.google.gcloud.bigquery.FieldValue;
-import com.google.gcloud.bigquery.InsertAllRequest;
-import com.google.gcloud.bigquery.InsertAllResponse;
-import com.google.gcloud.bigquery.QueryRequest;
-import com.google.gcloud.bigquery.QueryResponse;
-import com.google.gcloud.bigquery.Schema;
-import com.google.gcloud.bigquery.StandardTableDefinition;
-import com.google.gcloud.bigquery.TableId;
-import com.google.gcloud.bigquery.TableInfo;
+import com.google.cloud.bigquery.BigQuery;
+import com.google.cloud.bigquery.BigQueryOptions;
+import com.google.cloud.bigquery.DatasetInfo;
+import com.google.cloud.bigquery.Field;
+import com.google.cloud.bigquery.FieldValue;
+import com.google.cloud.bigquery.InsertAllRequest;
+import com.google.cloud.bigquery.InsertAllResponse;
+import com.google.cloud.bigquery.QueryRequest;
+import com.google.cloud.bigquery.QueryResponse;
+import com.google.cloud.bigquery.Schema;
+import com.google.cloud.bigquery.StandardTableDefinition;
+import com.google.cloud.bigquery.TableId;
+import com.google.cloud.bigquery.TableInfo;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/DatastoreExample.java
similarity index 87%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/DatastoreExample.java
index cc4331734200..cf0fee504bf8 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/DatastoreExample.java
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-package com.google.gcloud.examples.datastore;
+package com.google.cloud.examples.datastore;
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.DateTime;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.FullEntity;
-import com.google.gcloud.datastore.IncompleteKey;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
-import com.google.gcloud.datastore.Query;
-import com.google.gcloud.datastore.QueryResults;
-import com.google.gcloud.datastore.StructuredQuery;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
-import com.google.gcloud.datastore.Transaction;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.DateTime;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.FullEntity;
+import com.google.cloud.datastore.IncompleteKey;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Query;
+import com.google.cloud.datastore.QueryResults;
+import com.google.cloud.datastore.StructuredQuery;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.datastore.Transaction;
import java.util.Arrays;
import java.util.HashMap;
@@ -44,7 +44,7 @@
* login using gcloud SDK - {@code gcloud auth login}.
* compile using maven - {@code mvn compile}
* run using maven - {@code mvn exec:java
- * -Dexec.mainClass="com.google.gcloud.examples.datastore.DatastoreExample"
+ * -Dexec.mainClass="com.google.cloud.examples.datastore.DatastoreExample"
* -Dexec.args="[projectId] [user] [delete|display|add comment]"}
*
*/
@@ -182,16 +182,14 @@ public String getRequiredParams() {
public static void main(String... args) {
String projectId = args.length > 0 ? args[0] : null;
- // If you want to access a local Datastore running via the gcd sdk, do
+ // If you want to access a local Datastore running via the Google Cloud SDK, do
// DatastoreOptions options = DatastoreOptions.builder()
// .projectId(projectId)
// .namespace(NAMESPACE)
- // .host("http://localhost:8080")
+ // .host("http://localhost:8080") // change 8080 to the port that the emulator listens to
// .build();
- DatastoreOptions options = DatastoreOptions.builder()
- .projectId(projectId)
- .namespace(NAMESPACE)
- .build();
+ DatastoreOptions options =
+ DatastoreOptions.builder().projectId(projectId).namespace(NAMESPACE).build();
String name = args.length > 1 ? args[1] : System.getProperty("user.name");
Datastore datastore = options.service();
KeyFactory keyFactory = datastore.newKeyFactory().kind(USER_KIND);
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java
similarity index 85%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java
index f1e844c79b24..29b8453ccf28 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/AddEntitiesAndRunQuery.java
@@ -20,16 +20,16 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.datastore.snippets;
+package com.google.cloud.examples.datastore.snippets;
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
-import com.google.gcloud.datastore.Query;
-import com.google.gcloud.datastore.QueryResults;
-import com.google.gcloud.datastore.StructuredQuery.PropertyFilter;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Query;
+import com.google.cloud.datastore.QueryResults;
+import com.google.cloud.datastore.StructuredQuery.PropertyFilter;
/**
* A snippet for Google Cloud Datastore showing how to create and get entities. The snippet also
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/CreateEntity.java
similarity index 80%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/CreateEntity.java
index 3981162a2943..0ed4c5081450 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/CreateEntity.java
@@ -20,14 +20,14 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.datastore.snippets;
+package com.google.cloud.examples.datastore.snippets;
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.DateTime;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.DateTime;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
/**
* A snippet for Google Cloud Datastore showing how to create an entity.
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/UpdateEntity.java
similarity index 81%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/UpdateEntity.java
index cbc97f0784dd..79cb6e8b9a5e 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/snippets/UpdateEntity.java
@@ -20,14 +20,14 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.datastore.snippets;
+package com.google.cloud.examples.datastore.snippets;
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.DateTime;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.DateTime;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
/**
* A snippet for Google Cloud Datastore showing how to get an entity and update it if it exists.
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/DnsExample.java
similarity index 97%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/DnsExample.java
index d0cda485e9f5..44ded7ae0dc0 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/DnsExample.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud.examples.dns;
+package com.google.cloud.examples.dns;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.dns.ChangeRequest;
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.ProjectInfo;
-import com.google.gcloud.dns.RecordSet;
-import com.google.gcloud.dns.Zone;
-import com.google.gcloud.dns.ZoneInfo;
+import com.google.cloud.dns.ChangeRequest;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.ProjectInfo;
+import com.google.cloud.dns.RecordSet;
+import com.google.cloud.dns.Zone;
+import com.google.cloud.dns.ZoneInfo;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
@@ -47,7 +47,7 @@
* login using gcloud SDK - {@code gcloud auth login}.
* compile using maven - {@code mvn compile}
* run using maven - {@code mvn exec:java
- * -Dexec.mainClass="com.google.gcloud.examples.dns.DnsExample"
+ * -Dexec.mainClass="com.google.cloud.examples.dns.DnsExample"
* -Dexec.args="[]
* create |
* get |
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateOrUpdateRecordSets.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java
similarity index 90%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateOrUpdateRecordSets.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java
index e3ddbb10fc0f..b49cdeede5fb 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateOrUpdateRecordSets.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java
@@ -20,13 +20,13 @@
* the project's README's and package-info.java.
*/
-package com.google.gcloud.examples.dns.snippets;
+package com.google.cloud.examples.dns.snippets;
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.RecordSet;
-import com.google.gcloud.dns.Zone;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.RecordSet;
+import com.google.cloud.dns.Zone;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateZone.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java
similarity index 89%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateZone.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java
index dcf8019319c3..d28ad5cbb2c9 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateZone.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java
@@ -20,12 +20,12 @@
* the project's README's and package-info.java.
*/
-package com.google.gcloud.examples.dns.snippets;
+package com.google.cloud.examples.dns.snippets;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.Zone;
-import com.google.gcloud.dns.ZoneInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.Zone;
+import com.google.cloud.dns.ZoneInfo;
/**
* A snippet for Google Cloud DNS showing how to create a zone. You will need to change the {@code
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/DeleteZone.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/DeleteZone.java
similarity index 91%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/DeleteZone.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/DeleteZone.java
index c791ea8c0992..317daf0c2e7d 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/DeleteZone.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/DeleteZone.java
@@ -20,13 +20,13 @@
* the project's README's and package-info.java.
*/
-package com.google.gcloud.examples.dns.snippets;
+package com.google.cloud.examples.dns.snippets;
-import com.google.gcloud.dns.ChangeRequest;
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.RecordSet;
+import com.google.cloud.dns.ChangeRequest;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.RecordSet;
import java.util.Iterator;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java
similarity index 94%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java
index c96c93191c10..53cd77b5ec67 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/dns/snippets/ManipulateZonesAndRecordSets.java
@@ -20,15 +20,15 @@
* the project's README's and package-info.java.
*/
-package com.google.gcloud.examples.dns.snippets;
-
-import com.google.gcloud.dns.ChangeRequest;
-import com.google.gcloud.dns.ChangeRequestInfo;
-import com.google.gcloud.dns.Dns;
-import com.google.gcloud.dns.DnsOptions;
-import com.google.gcloud.dns.RecordSet;
-import com.google.gcloud.dns.Zone;
-import com.google.gcloud.dns.ZoneInfo;
+package com.google.cloud.examples.dns.snippets;
+
+import com.google.cloud.dns.ChangeRequest;
+import com.google.cloud.dns.ChangeRequestInfo;
+import com.google.cloud.dns.Dns;
+import com.google.cloud.dns.DnsOptions;
+import com.google.cloud.dns.RecordSet;
+import com.google.cloud.dns.Zone;
+import com.google.cloud.dns.ZoneInfo;
import java.util.Iterator;
import java.util.List;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/ResourceManagerExample.java
similarity index 95%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/ResourceManagerExample.java
index 349c0eebe73d..9b9e7aaa8ac8 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/ResourceManagerExample.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.examples.resourcemanager;
+package com.google.cloud.examples.resourcemanager;
import com.google.common.base.Joiner;
-import com.google.gcloud.resourcemanager.Project;
-import com.google.gcloud.resourcemanager.ProjectInfo;
-import com.google.gcloud.resourcemanager.ResourceManager;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.ProjectInfo;
+import com.google.cloud.resourcemanager.ResourceManager;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
import java.util.Arrays;
import java.util.HashMap;
@@ -36,7 +36,7 @@
* login using gcloud SDK - {@code gcloud auth login}.
* compile using maven - {@code mvn compile}
* run using maven - {@code mvn exec:java
- * -Dexec.mainClass="com.google.gcloud.examples.resourcemanager.ResourceManagerExample"
+ * -Dexec.mainClass="com.google.cloud.examples.resourcemanager.ResourceManagerExample"
* -Dexec.args="[list | [create | delete | get] projectId]"}
*
*/
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/GetOrCreateProject.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/GetOrCreateProject.java
similarity index 84%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/GetOrCreateProject.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/GetOrCreateProject.java
index 5a298107cc60..796e29bc3b0c 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/GetOrCreateProject.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/GetOrCreateProject.java
@@ -20,12 +20,12 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.resourcemanager.snippets;
+package com.google.cloud.examples.resourcemanager.snippets;
-import com.google.gcloud.resourcemanager.Project;
-import com.google.gcloud.resourcemanager.ProjectInfo;
-import com.google.gcloud.resourcemanager.ResourceManager;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.ProjectInfo;
+import com.google.cloud.resourcemanager.ResourceManager;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
/**
* A snippet for Google Cloud Resource Manager showing how to create a project if it does not exist.
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/ModifyPolicy.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/ModifyPolicy.java
similarity index 83%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/ModifyPolicy.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/ModifyPolicy.java
index f97adf5b0916..3f12dba0f77f 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/ModifyPolicy.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/ModifyPolicy.java
@@ -20,14 +20,14 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.resourcemanager.snippets;
-
-import com.google.gcloud.Identity;
-import com.google.gcloud.resourcemanager.Policy;
-import com.google.gcloud.resourcemanager.Policy.ProjectRole;
-import com.google.gcloud.resourcemanager.Project;
-import com.google.gcloud.resourcemanager.ResourceManager;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+package com.google.cloud.examples.resourcemanager.snippets;
+
+import com.google.cloud.Identity;
+import com.google.cloud.resourcemanager.Policy;
+import com.google.cloud.resourcemanager.Policy.ProjectRole;
+import com.google.cloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.ResourceManager;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
/**
* A snippet for Google Cloud Resource Manager showing how to modify a project's IAM policy.
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/UpdateAndListProjects.java
similarity index 89%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/UpdateAndListProjects.java
index b194de0815d5..2dba787279f2 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/UpdateAndListProjects.java
@@ -20,11 +20,11 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.resourcemanager.snippets;
+package com.google.cloud.examples.resourcemanager.snippets;
-import com.google.gcloud.resourcemanager.Project;
-import com.google.gcloud.resourcemanager.ResourceManager;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.ResourceManager;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
import java.util.Iterator;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java
similarity index 95%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java
index a7260134202d..01b864e7c8b8 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java
@@ -14,23 +14,23 @@
* limitations under the License.
*/
-package com.google.gcloud.examples.storage;
-
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.BlobId;
-import com.google.gcloud.storage.BlobInfo;
-import com.google.gcloud.storage.Bucket;
-import com.google.gcloud.storage.CopyWriter;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.Storage.ComposeRequest;
-import com.google.gcloud.storage.Storage.CopyRequest;
-import com.google.gcloud.storage.Storage.SignUrlOption;
-import com.google.gcloud.storage.StorageOptions;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
+package com.google.cloud.examples.storage;
+
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.AuthCredentials.ServiceAccountAuthCredentials;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.BlobInfo;
+import com.google.cloud.storage.Bucket;
+import com.google.cloud.storage.CopyWriter;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.ComposeRequest;
+import com.google.cloud.storage.Storage.CopyRequest;
+import com.google.cloud.storage.Storage.SignUrlOption;
+import com.google.cloud.storage.StorageOptions;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -65,7 +65,7 @@
* login using gcloud SDK - {@code gcloud auth login}.
* compile using maven - {@code mvn compile}
* run using maven -
- * {@code mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.storage.StorageExample"
+ * {@code mvn exec:java -Dexec.mainClass="com.google.cloud.examples.storage.StorageExample"
* -Dexec.args="[]
* list [] |
* info [ []] |
@@ -489,7 +489,7 @@ public void run(Storage storage, Tuple
private void run(Storage storage, ServiceAccountAuthCredentials cred, BlobInfo blobInfo) {
Blob blob = storage.get(blobInfo.blobId());
System.out.println("Signed URL: "
- + blob.signUrl(1, TimeUnit.DAYS, SignUrlOption.serviceAccount(cred)));
+ + blob.signUrl(1, TimeUnit.DAYS, SignUrlOption.signWith(cred)));
}
@Override
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java
similarity index 89%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java
index 435cc90b03d8..922afd7047c3 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java
@@ -20,15 +20,15 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.storage.snippets;
+package com.google.cloud.examples.storage.snippets;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.Bucket;
-import com.google.gcloud.storage.BucketInfo;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.Bucket;
+import com.google.cloud.storage.BucketInfo;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
import java.util.Iterator;
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java
similarity index 82%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java
index 2c1304a478ab..afe07b0e5206 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateBlob.java
@@ -20,15 +20,15 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.storage.snippets;
+package com.google.cloud.examples.storage.snippets;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.BlobId;
-import com.google.gcloud.storage.BlobInfo;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.BlobInfo;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
/**
* A snippet for Google Cloud Storage showing how to create a blob.
diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java
similarity index 87%
rename from gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java
rename to gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java
index 13290b201787..c645ba1e4a54 100644
--- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java
+++ b/gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/UpdateBlob.java
@@ -20,14 +20,14 @@
* the project's READMEs and package-info.java.
*/
-package com.google.gcloud.examples.storage.snippets;
+package com.google.cloud.examples.storage.snippets;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.BlobId;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
import java.io.IOException;
import java.nio.ByteBuffer;
diff --git a/gcloud-java-resourcemanager/README.md b/gcloud-java-resourcemanager/README.md
index 667e9222a402..906ef82710d7 100644
--- a/gcloud-java-resourcemanager/README.md
+++ b/gcloud-java-resourcemanager/README.md
@@ -5,12 +5,12 @@ Java idiomatic client for [Google Cloud Resource Manager] (https://cloud.google.
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-resourcemanager.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-resourcemanager.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-resourcemanager.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-resourcemanager.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/resourcemanager/package-summary.html)
+- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/resourcemanager/package-summary.html)
> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.
@@ -20,23 +20,23 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-resourcemanager
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-resourcemanager:0.1.7'
+compile 'com.google.cloud:gcloud-java-resourcemanager:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-resourcemanager" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-resourcemanager" % "0.2.0"
```
Example Application
--------------------
-[`ResourceManagerExample`](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java) is a simple command line interface for the Cloud Resource Manager. Read more about using the application on the [`ResourceManagerExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/resourcemanager/ResourceManagerExample.html).
+[`ResourceManagerExample`](../gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/ResourceManagerExample.java) is a simple command line interface for the Cloud Resource Manager. Read more about using the application on the [`ResourceManagerExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/cloud/examples/resourcemanager/ResourceManagerExample.html).
Authentication
--------------
@@ -80,8 +80,8 @@ These credentials are automatically inferred from your environment, so you only
code to create your service object:
```java
-import com.google.gcloud.resourcemanager.ResourceManager;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.resourcemanager.ResourceManager;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
```
@@ -91,7 +91,7 @@ You can load a project if you know it's project ID and have read permissions to
To get a project, add the following import at the top of your file:
```java
-import com.google.gcloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.Project;
```
Then use the following code to get the project:
@@ -108,8 +108,8 @@ names, and labels [here](https://cloud.google.com/resource-manager/reference/res
To create a project, add the following imports at the top of your file:
```java
-import com.google.gcloud.resourcemanager.Project;
-import com.google.gcloud.resourcemanager.ProjectInfo;
+import com.google.cloud.resourcemanager.Project;
+import com.google.cloud.resourcemanager.ProjectInfo;
```
Then add the following code to create a project (be sure to change `projectId` to your own unique
@@ -171,9 +171,9 @@ locally, and then sending the modified policy for writing, as shown in the snipp
add these imports:
```java
-import com.google.gcloud.Identity;
-import com.google.gcloud.resourcemanager.Policy;
-import com.google.gcloud.resourcemanager.Policy.Role;
+import com.google.cloud.Identity;
+import com.google.cloud.resourcemanager.Policy;
+import com.google.cloud.resourcemanager.Policy.Role;
```
Assuming you have completed the steps above to create the `ResourceManager` service object and load
@@ -206,15 +206,15 @@ We put together all the code shown above into three programs. The programs assum
running from your own desktop and used the Google Cloud SDK to authenticate yourself.
The first program creates a project if it does not exist. Complete source code can be found at
-[GetOrCreateProject.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/GetOrCreateProject.java).
+[GetOrCreateProject.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/GetOrCreateProject.java).
The second program updates a project if it exists and lists all projects the user has permission to
view. Complete source code can be found at
-[UpdateAndListProjects.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java).
+[UpdateAndListProjects.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/UpdateAndListProjects.java).
The third program modifies the IAM policy associated with a project using the read-modify-write
pattern. Complete source code can be found at
-[ModifyPolicy.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/ModifyPolicy.java)
+[ModifyPolicy.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/resourcemanager/snippets/ModifyPolicy.java)
Java Versions
-------------
@@ -255,5 +255,5 @@ Apache 2.0 - See [LICENSE] for more information.
[TESTING]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/TESTING.md#testing-code-that-uses-resource-manager
[cloud-platform]: https://cloud.google.com/
[cloud-resourcemanager]: https://cloud.google.com/resource-manager/docs
-[resourcemanager-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/resourcemanager/package-summary.html
+[resourcemanager-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/resourcemanager/package-summary.html
diff --git a/gcloud-java-resourcemanager/pom.xml b/gcloud-java-resourcemanager/pom.xml
index d970bdf883da..272c931326d6 100644
--- a/gcloud-java-resourcemanager/pom.xml
+++ b/gcloud-java-resourcemanager/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-resourcemanager
jar
GCloud Java resource manager
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-resourcemanager
Java idiomatic client for Google Cloud Resource Manager.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-resourcemanager
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Option.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Option.java
similarity index 94%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Option.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Option.java
index 3df68468f69f..fb81d77a88ff 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Option.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Option.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
import java.io.Serializable;
import java.util.Objects;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Policy.java
similarity index 97%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Policy.java
index 219d74262319..6f150086a7e3 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Policy.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Policy.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
-import com.google.gcloud.IamPolicy;
-import com.google.gcloud.Identity;
+import com.google.cloud.IamPolicy;
+import com.google.cloud.Identity;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Project.java
similarity index 99%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Project.java
index bf9cf0e01a6d..25cda85d1c09 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/Project.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Project.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ProjectInfo.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ProjectInfo.java
similarity index 99%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ProjectInfo.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ProjectInfo.java
index 260e8a8e2f26..355236b653f1 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ProjectInfo.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ProjectInfo.java
@@ -12,7 +12,7 @@
* the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManager.java
similarity index 97%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManager.java
index 92494a5152fe..93425464872f 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManager.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManager.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.FieldSelector;
-import com.google.gcloud.FieldSelector.Helper;
-import com.google.gcloud.IamPolicy;
-import com.google.gcloud.Page;
-import com.google.gcloud.Service;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.FieldSelector;
+import com.google.cloud.FieldSelector.Helper;
+import com.google.cloud.IamPolicy;
+import com.google.cloud.Page;
+import com.google.cloud.Service;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
import java.util.List;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerException.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerException.java
similarity index 92%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerException.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerException.java
index 32a2998791c9..026845d0734c 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerException.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerException.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.RetryHelper.RetryInterruptedException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.RetryHelper.RetryInterruptedException;
import java.io.IOException;
import java.util.Set;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerFactory.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerFactory.java
similarity index 90%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerFactory.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerFactory.java
index 256fc321e4e1..7ef607cac23b 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerFactory.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerFactory.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
-import com.google.gcloud.ServiceFactory;
+import com.google.cloud.ServiceFactory;
/**
* An interface for ResourceManager factories.
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerImpl.java
similarity index 95%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerImpl.java
index e4663cb74cb9..2ee4dc4e9e22 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerImpl.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerImpl.java
@@ -14,23 +14,23 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.gcloud.RetryHelper.runWithRetries;
+import static com.google.cloud.RetryHelper.runWithRetries;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
-import com.google.gcloud.BaseService;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.PageImpl.NextPageFetcher;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Tuple;
+import com.google.cloud.BaseService;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
+import com.google.cloud.PageImpl.NextPageFetcher;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Tuple;
import java.util.List;
import java.util.Map;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerOptions.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerOptions.java
similarity index 91%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerOptions.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerOptions.java
index c744864147c2..8f5c79e8bc3f 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/ResourceManagerOptions.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ResourceManagerOptions.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.resourcemanager.spi.DefaultResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpcFactory;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.resourcemanager.spi.DefaultResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpcFactory;
import java.util.Set;
@@ -112,6 +112,7 @@ public int hashCode() {
return baseHashCode();
}
+ @SuppressWarnings("unchecked")
@Override
public Builder toBuilder() {
return new Builder(this);
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/package-info.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/package-info.java
similarity index 90%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/package-info.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/package-info.java
index d1794447e9fb..0329b0a89b4a 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/package-info.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/package-info.java
@@ -19,7 +19,7 @@
*
* Here's a simple usage example for using gcloud-java from App/Compute Engine. This example
* creates a project if it does not exist. For the complete source code see
- *
+ *
* GetOrCreateProject.java.
*
{@code
* ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
@@ -33,7 +33,7 @@
*
* This second example shows how to update a project if it exists and list all projects the user has
* permission to view. For the complete source code see
- *
+ *
* UpdateAndListProjects.java.
*
{@code
* ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
@@ -58,4 +58,4 @@
* @see Google Cloud Resource Manager
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/DefaultResourceManagerRpc.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/DefaultResourceManagerRpc.java
similarity index 91%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/DefaultResourceManagerRpc.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/DefaultResourceManagerRpc.java
index 9f92ff545874..536328b5aa60 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/DefaultResourceManagerRpc.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/DefaultResourceManagerRpc.java
@@ -1,10 +1,10 @@
-package com.google.gcloud.resourcemanager.spi;
+package com.google.cloud.resourcemanager.spi;
import static com.google.common.base.MoreObjects.firstNonNull;
-import static com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Option.FIELDS;
-import static com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Option.FILTER;
-import static com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Option.PAGE_SIZE;
-import static com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Option.PAGE_TOKEN;
+import static com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Option.FIELDS;
+import static com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Option.FILTER;
+import static com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Option.PAGE_SIZE;
+import static com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Option.PAGE_TOKEN;
import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
@@ -21,8 +21,8 @@
import com.google.api.services.cloudresourcemanager.model.TestIamPermissionsResponse;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.resourcemanager.ResourceManagerException;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.resourcemanager.ResourceManagerException;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
import java.io.IOException;
import java.util.List;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpc.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpc.java
similarity index 97%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpc.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpc.java
index d6ec068a92a3..11e028be93a3 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpc.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpc.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager.spi;
+package com.google.cloud.resourcemanager.spi;
import com.google.api.services.cloudresourcemanager.model.Policy;
import com.google.api.services.cloudresourcemanager.model.Project;
-import com.google.gcloud.resourcemanager.ResourceManagerException;
+import com.google.cloud.resourcemanager.ResourceManagerException;
import java.util.List;
import java.util.Map;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpcFactory.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpcFactory.java
similarity index 84%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpcFactory.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpcFactory.java
index 4dbd1a00d4c7..ef6a96ac4b5e 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/spi/ResourceManagerRpcFactory.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/spi/ResourceManagerRpcFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager.spi;
+package com.google.cloud.resourcemanager.spi;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
-import com.google.gcloud.spi.ServiceRpcFactory;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.spi.ServiceRpcFactory;
/**
* An interface for Resource Manager RPC factory.
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/LocalResourceManagerHelper.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelper.java
similarity index 99%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/LocalResourceManagerHelper.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelper.java
index 4d466e55a897..614a7ec63ecf 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/LocalResourceManagerHelper.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelper.java
@@ -1,4 +1,4 @@
-package com.google.gcloud.resourcemanager.testing;
+package com.google.cloud.resourcemanager.testing;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -17,8 +17,8 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.ByteStreams;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.resourcemanager.ResourceManagerOptions;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.resourcemanager.ResourceManagerOptions;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
diff --git a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/package-info.java b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/package-info.java
similarity index 95%
rename from gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/package-info.java
rename to gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/package-info.java
index b0165c1ddd9d..d007d00eaeab 100644
--- a/gcloud-java-resourcemanager/src/main/java/com/google/gcloud/resourcemanager/testing/package-info.java
+++ b/gcloud-java-resourcemanager/src/main/java/com/google/cloud/resourcemanager/testing/package-info.java
@@ -21,8 +21,8 @@
* Before the test:
* {@code
* LocalResourceManagerHelper resourceManagerHelper = LocalResourceManagerHelper.create();
- * ResourceManager resourceManager = resourceManagerHelper.options().service();
* resourceManagerHelper.start();
+ * ResourceManager resourceManager = resourceManagerHelper.options().service();
* }
*
* After the test:
@@ -30,4 +30,4 @@
* resourceManagerHelper.stop();
* }
*/
-package com.google.gcloud.resourcemanager.testing;
+package com.google.cloud.resourcemanager.testing;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/OptionTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/OptionTest.java
similarity index 95%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/OptionTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/OptionTest.java
index 729c7a4b8911..097a5c61c13d 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/OptionTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/OptionTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/PolicyTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/PolicyTest.java
similarity index 94%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/PolicyTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/PolicyTest.java
index 04826dd9540f..a99286b119ba 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/PolicyTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/PolicyTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import com.google.gcloud.Identity;
-import com.google.gcloud.resourcemanager.Policy.ProjectRole;
+import com.google.cloud.Identity;
+import com.google.cloud.resourcemanager.Policy.ProjectRole;
import org.junit.Test;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectInfoTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectInfoTest.java
similarity index 99%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectInfoTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectInfoTest.java
index 3aaef8047322..2b276f485a72 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectInfoTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectInfoTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectTest.java
similarity index 97%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectTest.java
index 0f4c205dde17..58920e5fec12 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ProjectTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ProjectTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
@@ -27,9 +27,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.Identity;
-import com.google.gcloud.resourcemanager.Policy.ProjectRole;
-import com.google.gcloud.resourcemanager.ProjectInfo.ResourceId;
+import com.google.cloud.Identity;
+import com.google.cloud.resourcemanager.Policy.ProjectRole;
+import com.google.cloud.resourcemanager.ProjectInfo.ResourceId;
import org.junit.After;
import org.junit.Before;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerExceptionTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerExceptionTest.java
similarity index 95%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerExceptionTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerExceptionTest.java
index 388f38f31c35..2ac8d1acba7f 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerExceptionTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerExceptionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@@ -25,8 +25,8 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
import org.junit.Test;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerImplTest.java
similarity index 96%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerImplTest.java
index 7d52901aa372..910478af0888 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/ResourceManagerImplTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,16 +27,16 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.Identity;
-import com.google.gcloud.Page;
-import com.google.gcloud.resourcemanager.Policy.ProjectRole;
-import com.google.gcloud.resourcemanager.ProjectInfo.ResourceId;
-import com.google.gcloud.resourcemanager.ResourceManager.ProjectField;
-import com.google.gcloud.resourcemanager.ResourceManager.ProjectGetOption;
-import com.google.gcloud.resourcemanager.ResourceManager.ProjectListOption;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpcFactory;
-import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
+import com.google.cloud.Identity;
+import com.google.cloud.Page;
+import com.google.cloud.resourcemanager.Policy.ProjectRole;
+import com.google.cloud.resourcemanager.ProjectInfo.ResourceId;
+import com.google.cloud.resourcemanager.ResourceManager.ProjectField;
+import com.google.cloud.resourcemanager.ResourceManager.ProjectGetOption;
+import com.google.cloud.resourcemanager.ResourceManager.ProjectListOption;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpcFactory;
+import com.google.cloud.resourcemanager.testing.LocalResourceManagerHelper;
import org.easymock.EasyMock;
import org.junit.AfterClass;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/SerializationTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/SerializationTest.java
similarity index 91%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/SerializationTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/SerializationTest.java
index 4bc1bcede195..b09f81b60997 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/SerializationTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/SerializationTest.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.BaseSerializationTest;
-import com.google.gcloud.Identity;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.resourcemanager.Policy.ProjectRole;
+import com.google.cloud.BaseSerializationTest;
+import com.google.cloud.Identity;
+import com.google.cloud.PageImpl;
+import com.google.cloud.Restorable;
+import com.google.cloud.resourcemanager.Policy.ProjectRole;
import java.io.Serializable;
import java.util.Collections;
diff --git a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/LocalResourceManagerHelperTest.java b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelperTest.java
similarity index 98%
rename from gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/LocalResourceManagerHelperTest.java
rename to gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelperTest.java
index 75df0ef9e3ae..7a23383b3d89 100644
--- a/gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/LocalResourceManagerHelperTest.java
+++ b/gcloud-java-resourcemanager/src/test/java/com/google/cloud/resourcemanager/testing/LocalResourceManagerHelperTest.java
@@ -1,4 +1,4 @@
-package com.google.gcloud.resourcemanager;
+package com.google.cloud.resourcemanager.testing;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -11,10 +11,10 @@
import com.google.api.services.cloudresourcemanager.model.Binding;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.resourcemanager.spi.DefaultResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc;
-import com.google.gcloud.resourcemanager.spi.ResourceManagerRpc.Tuple;
-import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
+import com.google.cloud.resourcemanager.ResourceManagerException;
+import com.google.cloud.resourcemanager.spi.DefaultResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc;
+import com.google.cloud.resourcemanager.spi.ResourceManagerRpc.Tuple;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/gcloud-java-storage/README.md b/gcloud-java-storage/README.md
index 5a8897356db8..bcf7c7068774 100644
--- a/gcloud-java-storage/README.md
+++ b/gcloud-java-storage/README.md
@@ -5,12 +5,12 @@ Java idiomatic client for [Google Cloud Storage] (https://cloud.google.com/stora
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-storage.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-storage.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-storage.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java-storage.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
-- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/storage/package-summary.html)
+- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/storage/package-summary.html)
> Note: This client is a work-in-progress, and may occasionally
> make backwards-incompatible changes.
@@ -20,24 +20,24 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java-storage
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java-storage:0.1.7'
+compile 'com.google.cloud:gcloud-java-storage:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java-storage" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java-storage" % "0.2.0"
```
Example Application
-------------------
-[`StorageExample`](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java) is a simple command line interface that provides some of Cloud Storage's functionality. Read more about using the application on the [`StorageExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/storage/StorageExample.html).
+[`StorageExample`](../gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java) is a simple command line interface that provides some of Cloud Storage's functionality. Read more about using the application on the [`StorageExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/cloud/examples/storage/StorageExample.html).
Authentication
--------------
@@ -70,8 +70,8 @@ You'll need to obtain the `gcloud-java-storage` library. See the [Quickstart](#
To make authenticated requests to Google Cloud Storage, you must create a service object with credentials. You can then make API calls by calling methods on the Storage service object. The simplest way to authenticate is to use [Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials). These credentials are automatically inferred from your environment, so you only need the following code to create your service object:
```java
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.StorageOptions;
Storage storage = StorageOptions.defaultInstance().service();
```
@@ -86,9 +86,9 @@ Add the following imports at the top of your file:
```java
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.Bucket;
-import com.google.gcloud.storage.BucketInfo;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.Bucket;
+import com.google.cloud.storage.BucketInfo;
```
Then add the following code to create a bucket and upload a simple blob.
@@ -143,7 +143,7 @@ while (blobIterator.hasNext()) {
#### Complete source code
In
-[CreateAndListBucketsAndBlobs.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java)
+[CreateAndListBucketsAndBlobs.java](../gcloud-java-examples/src/main/java/com/google/cloud/examples/storage/snippets/CreateAndListBucketsAndBlobs.java)
we put together all the code shown above into one program. The program assumes that you are
running on Compute Engine or from your own desktop. To run the example on App Engine, simply move
the code from the main method to your application's servlet class and change the print statements to
@@ -199,5 +199,5 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-storage]: https://cloud.google.com/storage/
[cloud-storage-docs]: https://cloud.google.com/storage/docs/overview
[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
-[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/storage/package-summary.html
+[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/storage/package-summary.html
[cloud-storage-activation]:https://cloud.google.com/storage/docs/signup?hl=en
diff --git a/gcloud-java-storage/pom.xml b/gcloud-java-storage/pom.xml
index 2316706850d3..1106c7479be7 100644
--- a/gcloud-java-storage/pom.xml
+++ b/gcloud-java-storage/pom.xml
@@ -4,13 +4,14 @@
gcloud-java-storage
jar
GCloud Java storage
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-storage
Java idiomatic client for Google Cloud Storage.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
gcloud-java-storage
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Acl.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Acl.java
index 4203d79351b7..1063b24580b8 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Acl.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Acl.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.api.services.storage.model.BucketAccessControl;
import com.google.api.services.storage.model.ObjectAccessControl;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchRequest.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchRequest.java
similarity index 94%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchRequest.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchRequest.java
index bf77c731754e..f98160b91b18 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchRequest.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchRequest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import com.google.gcloud.storage.Storage.BlobGetOption;
-import com.google.gcloud.storage.Storage.BlobSourceOption;
-import com.google.gcloud.storage.Storage.BlobTargetOption;
+import com.google.cloud.storage.Storage.BlobGetOption;
+import com.google.cloud.storage.Storage.BlobSourceOption;
+import com.google.cloud.storage.Storage.BlobTargetOption;
import java.io.Serializable;
import java.util.LinkedHashMap;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchResponse.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchResponse.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchResponse.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchResponse.java
index fe5f6f5743c8..d07d9dc26c2d 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BatchResponse.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BatchResponse.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Blob.java
similarity index 84%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Blob.java
index 9bd9902fee56..df5ab959ad30 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Blob.java
@@ -14,23 +14,27 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.gcloud.storage.Blob.BlobSourceOption.toGetOptions;
-import static com.google.gcloud.storage.Blob.BlobSourceOption.toSourceOptions;
+import static com.google.cloud.storage.Blob.BlobSourceOption.toGetOptions;
+import static com.google.cloud.storage.Blob.BlobSourceOption.toSourceOptions;
import com.google.api.services.storage.model.StorageObject;
import com.google.common.base.Function;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.Storage.BlobTargetOption;
-import com.google.gcloud.storage.Storage.BlobWriteOption;
-import com.google.gcloud.storage.Storage.CopyRequest;
-import com.google.gcloud.storage.Storage.SignUrlOption;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.AuthCredentials.AppEngineAuthCredentials;
+import com.google.cloud.AuthCredentials.ServiceAccountAuthCredentials;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.ServiceAccountSigner;
+import com.google.cloud.ServiceAccountSigner.SigningException;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.Storage.BlobTargetOption;
+import com.google.cloud.storage.Storage.BlobWriteOption;
+import com.google.cloud.storage.Storage.CopyRequest;
+import com.google.cloud.storage.Storage.SignUrlOption;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -457,28 +461,35 @@ public WriteChannel writer(BlobWriteOption... options) {
* Generates a signed URL for this blob. If you want to allow access for a fixed amount of time to
* this blob, you can use this method to generate a URL that is only valid within a certain time
* period. This is particularly useful if you don't want publicly accessible blobs, but also don't
- * want to require users to explicitly log in. Signing a URL requires a service account and its
- * associated private key. If a {@link AuthCredentials.ServiceAccountAuthCredentials} was passed
- * to {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials
- * are being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
- * {@code signUrl} will use that service account and associated key to sign the URL. If the
- * credentials passed to {@link StorageOptions} do not expose a private key (this is the case for
- * App Engine credentials, Compute Engine credentials and Google Cloud SDK credentials) then
- * {@code signUrl} will throw an {@link IllegalArgumentException} unless a service account with
- * associated key is passed using the {@code SignUrlOption.serviceAccount()} option. The service
- * account and private key passed with {@code SignUrlOption.serviceAccount()} have priority over
- * any credentials set with {@link StorageOptions.Builder#authCredentials(AuthCredentials)}.
+ * want to require users to explicitly log in. Signing a URL requires
+ * a service account signer. If a {@link ServiceAccountAuthCredentials} or an
+ * {@link AppEngineAuthCredentials} was passed to
+ * {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials are
+ * being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
+ * {@code signUrl} will use that credentials to sign the URL. If the credentials passed to
+ * {@link StorageOptions} do not implement {@link ServiceAccountSigner} (this is the case for
+ * Compute Engine credentials and Google Cloud SDK credentials) then {@code signUrl} will throw an
+ * {@link IllegalStateException} unless an implementation of {@link ServiceAccountSigner} is
+ * passed using the {@link SignUrlOption#signWith(ServiceAccountSigner)} option.
+ *
+ * A service account signer is looked for in the following order:
+ *
+ * - The signer passed with the option {@link SignUrlOption#signWith(ServiceAccountSigner)}
+ *
- The credentials passed to {@link StorageOptions.Builder#authCredentials(AuthCredentials)}
+ *
- The default credentials, if no credentials were passed to {@link StorageOptions}
+ *
*
* Example usage of creating a signed URL that is valid for 2 weeks, using the default
- * credentials for signing the URL:
+ * credentials for signing the URL:
*
{@code
* blob.signUrl(14, TimeUnit.DAYS);
* }
*
- * Example usage of creating a signed URL passing the {@code SignUrlOption.serviceAccount()}
- * option, that will be used for signing the URL:
+ *
Example usage of creating a signed URL passing the
+ * {@link SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used for signing the
+ * URL:
*
{@code
- * blob.signUrl(14, TimeUnit.DAYS, SignUrlOption.serviceAccount(
+ * blob.signUrl(14, TimeUnit.DAYS, SignUrlOption.signWith(
* AuthCredentials.createForJson(new FileInputStream("/path/to/key.json"))));
* }
*
@@ -486,16 +497,15 @@ public WriteChannel writer(BlobWriteOption... options) {
* granularity supported is 1 second, finer granularities will be truncated
* @param unit time unit of the {@code duration} parameter
* @param options optional URL signing options
- * @return a signed URL for this bucket and the specified options
- * @throws IllegalArgumentException if
- * {@link SignUrlOption#serviceAccount(AuthCredentials.ServiceAccountAuthCredentials)} was not
- * used and no service account was provided to {@link StorageOptions}
- * @throws IllegalArgumentException if the key associated to the provided service account is
- * invalid
- * @throws IllegalArgumentException if {@link SignUrlOption#withMd5()} option is used and
- * {@link #md5()} is {@code null}
- * @throws IllegalArgumentException if {@link SignUrlOption#withContentType()} option is used and
- * {@link #contentType()} is {@code null}
+ * @return a signed URL for this blob and the specified options
+ * @throws IllegalStateException if {@link SignUrlOption#signWith(ServiceAccountSigner)} was not
+ * used and no implementation of {@link ServiceAccountSigner} was provided to
+ * {@link StorageOptions}
+ * @throws IllegalArgumentException if {@code SignUrlOption.withMd5()} option is used and
+ * {@code blobInfo.md5()} is {@code null}
+ * @throws IllegalArgumentException if {@code SignUrlOption.withContentType()} option is used and
+ * {@code blobInfo.contentType()} is {@code null}
+ * @throws SigningException if the attempt to sign the URL failed
* @see Signed-URLs
*/
public URL signUrl(long duration, TimeUnit unit, SignUrlOption... options) {
@@ -516,7 +526,9 @@ public Builder toBuilder() {
@Override
public final boolean equals(Object obj) {
- return obj instanceof Blob && Objects.equals(toPb(), ((Blob) obj).toPb())
+ return this == obj
+ || obj instanceof Blob
+ && Objects.equals(toPb(), ((Blob) obj).toPb())
&& Objects.equals(options, ((Blob) obj).options);
}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobId.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobId.java
index d30003d632db..52e7fc5f331e 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobId.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobId.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
index 42a2e282b002..dd264fa7f92b 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobInfo.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobReadChannel.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobReadChannel.java
similarity index 96%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobReadChannel.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobReadChannel.java
index f9c6f912563d..1c15a9cd4e54 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobReadChannel.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobReadChannel.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.RetryHelper.runWithRetries;
+import static com.google.cloud.RetryHelper.runWithRetries;
import com.google.api.services.storage.model.StorageObject;
import com.google.common.base.MoreObjects;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryHelper;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryHelper;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
import java.io.IOException;
import java.io.Serializable;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobWriteChannel.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobWriteChannel.java
similarity index 89%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobWriteChannel.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobWriteChannel.java
index 30b0ec870f51..0076b3cbaac4 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobWriteChannel.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BlobWriteChannel.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.RetryHelper.runWithRetries;
+import static com.google.cloud.RetryHelper.runWithRetries;
import static java.util.concurrent.Executors.callable;
-import com.google.gcloud.BaseWriteChannel;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryHelper;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.spi.StorageRpc;
+import com.google.cloud.BaseWriteChannel;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryHelper;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.spi.StorageRpc;
import java.util.Map;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Bucket.java
similarity index 97%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Bucket.java
index cb2058a9e7ab..04337e6a77b1 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Bucket.java
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.gcloud.storage.Bucket.BucketSourceOption.toGetOptions;
-import static com.google.gcloud.storage.Bucket.BucketSourceOption.toSourceOptions;
+import static com.google.cloud.storage.Bucket.BucketSourceOption.toGetOptions;
+import static com.google.cloud.storage.Bucket.BucketSourceOption.toSourceOptions;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import com.google.gcloud.Page;
-import com.google.gcloud.storage.Storage.BlobGetOption;
-import com.google.gcloud.storage.Storage.BucketTargetOption;
-import com.google.gcloud.storage.spi.StorageRpc;
+import com.google.cloud.Page;
+import com.google.cloud.storage.Storage.BlobGetOption;
+import com.google.cloud.storage.Storage.BucketTargetOption;
+import com.google.cloud.storage.spi.StorageRpc;
import java.io.IOException;
import java.io.InputStream;
@@ -626,7 +626,7 @@ public List get(String blobName1, String blobName2, String... blobNames) {
/**
* Creates a new blob in this bucket. Direct upload is used to upload {@code content}.
- * For large content, {@link Blob#writer(com.google.gcloud.storage.Storage.BlobWriteOption...)}
+ * For large content, {@link Blob#writer(com.google.cloud.storage.Storage.BlobWriteOption...)}
* is recommended as it uses resumable upload. MD5 and CRC32C hashes of {@code content} are
* computed and used for validating transferred data.
*
@@ -646,7 +646,7 @@ public Blob create(String blob, byte[] content, String contentType, BlobTargetOp
/**
* Creates a new blob in this bucket. Direct upload is used to upload {@code content}.
- * For large content, {@link Blob#writer(com.google.gcloud.storage.Storage.BlobWriteOption...)}
+ * For large content, {@link Blob#writer(com.google.cloud.storage.Storage.BlobWriteOption...)}
* is recommended as it uses resumable upload.
*
* @param blob a blob name
@@ -666,7 +666,7 @@ public Blob create(String blob, InputStream content, String contentType,
/**
* Creates a new blob in this bucket. Direct upload is used to upload {@code content}.
- * For large content, {@link Blob#writer(com.google.gcloud.storage.Storage.BlobWriteOption...)}
+ * For large content, {@link Blob#writer(com.google.cloud.storage.Storage.BlobWriteOption...)}
* is recommended as it uses resumable upload. MD5 and CRC32C hashes of {@code content} are
* computed and used for validating transferred data.
*
@@ -685,7 +685,7 @@ public Blob create(String blob, byte[] content, BlobTargetOption... options) {
/**
* Creates a new blob in this bucket. Direct upload is used to upload {@code content}.
- * For large content, {@link Blob#writer(com.google.gcloud.storage.Storage.BlobWriteOption...)}
+ * For large content, {@link Blob#writer(com.google.cloud.storage.Storage.BlobWriteOption...)}
* is recommended as it uses resumable upload.
*
* @param blob a blob name
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BucketInfo.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BucketInfo.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/BucketInfo.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/BucketInfo.java
index a893e45c5c86..88ff6095f762 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BucketInfo.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/BucketInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -33,7 +33,7 @@
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.storage.Acl.Entity;
+import com.google.cloud.storage.Acl.Entity;
import java.io.IOException;
import java.io.ObjectInputStream;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/CopyWriter.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/CopyWriter.java
similarity index 96%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/CopyWriter.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/CopyWriter.java
index 743630b6c4c2..5d3289e71861 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/CopyWriter.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/CopyWriter.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.RetryHelper.runWithRetries;
+import static com.google.cloud.RetryHelper.runWithRetries;
import com.google.common.base.MoreObjects;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryHelper;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.RewriteRequest;
-import com.google.gcloud.storage.spi.StorageRpc.RewriteResponse;
+import com.google.cloud.Restorable;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryHelper;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.RewriteRequest;
+import com.google.cloud.storage.spi.StorageRpc.RewriteResponse;
import java.io.Serializable;
import java.util.Map;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Cors.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Cors.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Cors.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Cors.java
index bcbbd1030dbc..27ff44156712 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Cors.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Cors.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/HttpMethod.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/HttpMethod.java
similarity index 95%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/HttpMethod.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/HttpMethod.java
index e2a4563316d3..0d4953b9f316 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/HttpMethod.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/HttpMethod.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
/**
* Http method supported by Storage service.
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Option.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Option.java
similarity index 95%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Option.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Option.java
index 774023eff78b..ca1077d7c595 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Option.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Option.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects;
-import com.google.gcloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc;
import java.io.Serializable;
import java.util.Objects;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Storage.java
similarity index 95%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/Storage.java
index 72d89348f5fa..e59e465095d6 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/Storage.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -22,16 +22,19 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
-import com.google.gcloud.FieldSelector;
-import com.google.gcloud.FieldSelector.Helper;
-import com.google.gcloud.Page;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.Service;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.AuthCredentials.AppEngineAuthCredentials;
+import com.google.cloud.AuthCredentials.ServiceAccountAuthCredentials;
+import com.google.cloud.FieldSelector;
+import com.google.cloud.FieldSelector.Helper;
+import com.google.cloud.Page;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.Service;
+import com.google.cloud.ServiceAccountSigner;
+import com.google.cloud.ServiceAccountSigner.SigningException;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
import java.io.InputStream;
import java.io.Serializable;
@@ -765,14 +768,14 @@ public static SignUrlOption withMd5() {
}
/**
- * Service account credentials which are used for signing the URL.
- * If not provided an attempt will be made to get it from the environment.
+ * Provides a service account signer to sign the URL. If not provided an attempt will be made to
+ * get it from the environment.
*
* @see Service
* account
*/
- public static SignUrlOption serviceAccount(ServiceAccountAuthCredentials credentials) {
- return new SignUrlOption(Option.SERVICE_ACCOUNT_CRED, credentials);
+ public static SignUrlOption signWith(ServiceAccountSigner signer) {
+ return new SignUrlOption(Option.SERVICE_ACCOUNT_CRED, signer);
}
}
@@ -1470,29 +1473,36 @@ public static Builder builder() {
* Generates a signed URL for a blob. If you have a blob that you want to allow access to for a
* fixed amount of time, you can use this method to generate a URL that is only valid within a
* certain time period. This is particularly useful if you don't want publicly accessible blobs,
- * but also don't want to require users to explicitly log in. Signing a URL requires a service
- * account and its associated private key. If a {@link ServiceAccountAuthCredentials} was passed
- * to {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials
- * are being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
- * {@code signUrl} will use that service account and associated key to sign the URL. If the
- * credentials passed to {@link StorageOptions} do not expose a private key (this is the case for
- * App Engine credentials, Compute Engine credentials and Google Cloud SDK credentials) then
- * {@code signUrl} will throw an {@link IllegalArgumentException} unless a service account with
- * associated key is passed using the {@code SignUrlOption.serviceAccount()} option. The service
- * account and private key passed with {@code SignUrlOption.serviceAccount()} have priority over
- * any credentials set with {@link StorageOptions.Builder#authCredentials(AuthCredentials)}.
+ * but also don't want to require users to explicitly log in. Signing a URL requires
+ * a service account signer. If a {@link ServiceAccountAuthCredentials} or an
+ * {@link AppEngineAuthCredentials} was passed to
+ * {@link StorageOptions.Builder#authCredentials(AuthCredentials)} or the default credentials are
+ * being used and the environment variable {@code GOOGLE_APPLICATION_CREDENTIALS} is set, then
+ * {@code signUrl} will use that credentials to sign the URL. If the credentials passed to
+ * {@link StorageOptions} do not implement {@link ServiceAccountSigner} (this is the case for
+ * Compute Engine credentials and Google Cloud SDK credentials) then {@code signUrl} will throw an
+ * {@link IllegalStateException} unless an implementation of {@link ServiceAccountSigner} is
+ * passed using the {@link SignUrlOption#signWith(ServiceAccountSigner)} option.
+ *
+ * A service account signer is looked for in the following order:
+ *
+ * - The signer passed with the option {@link SignUrlOption#signWith(ServiceAccountSigner)}
+ *
- The credentials passed to {@link StorageOptions.Builder#authCredentials(AuthCredentials)}
+ *
- The default credentials, if no credentials were passed to {@link StorageOptions}
+ *
*
* Example usage of creating a signed URL that is valid for 2 weeks, using the default
- * credentials for signing the URL:
+ * credentials for signing the URL:
*
{@code
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
* }
*
- * Example usage of creating a signed URL passing the {@code SignUrlOption.serviceAccount()}
- * option, that will be used for signing the URL:
+ *
Example usage of creating a signed URL passing the
+ * {@link SignUrlOption#signWith(ServiceAccountSigner)} option, that will be used for signing the
+ * URL:
*
{@code
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS,
- * SignUrlOption.serviceAccount(
+ * SignUrlOption.signWith(
* AuthCredentials.createForJson(new FileInputStream("/path/to/key.json"))));
* }
*
@@ -1501,14 +1511,14 @@ public static Builder builder() {
* granularity supported is 1 second, finer granularities will be truncated
* @param unit time unit of the {@code duration} parameter
* @param options optional URL signing options
- * @throws IllegalArgumentException if {@code SignUrlOption.serviceAccount()} was not used and no
- * service account was provided to {@link StorageOptions}
- * @throws IllegalArgumentException if the key associated to the provided service account is
- * invalid
+ * @throws IllegalStateException if {@link SignUrlOption#signWith(ServiceAccountSigner)} was not
+ * used and no implementation of {@link ServiceAccountSigner} was provided to
+ * {@link StorageOptions}
* @throws IllegalArgumentException if {@code SignUrlOption.withMd5()} option is used and
* {@code blobInfo.md5()} is {@code null}
* @throws IllegalArgumentException if {@code SignUrlOption.withContentType()} option is used and
* {@code blobInfo.contentType()} is {@code null}
+ * @throws SigningException if the attempt to sign the URL failed
* @see Signed-URLs
*/
URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOption... options);
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageException.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageException.java
similarity index 91%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageException.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageException.java
index ee85b80d6e13..2b1aa24e13af 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageException.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageException.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.RetryHelper.RetryInterruptedException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.RetryHelper.RetryInterruptedException;
import java.io.IOException;
import java.util.Set;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageFactory.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageFactory.java
similarity index 90%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageFactory.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageFactory.java
index fbce5559464c..0afaa05bcc7c 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageFactory.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import com.google.gcloud.ServiceFactory;
+import com.google.cloud.ServiceFactory;
/**
* An interface for Storage factories.
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
similarity index 90%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
index cf709ba5e293..6d0be9ed01fc 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageImpl.java
@@ -14,24 +14,24 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.gcloud.RetryHelper.runWithRetries;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.DELIMITER;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_GENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_GENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_NOT_MATCH;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.cloud.RetryHelper.runWithRetries;
+import static com.google.cloud.storage.spi.StorageRpc.Option.DELIMITER;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_GENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_GENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_NOT_MATCH;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.api.services.storage.model.StorageObject;
-import com.google.auth.oauth2.ServiceAccountCredentials;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -41,16 +41,16 @@
import com.google.common.hash.Hashing;
import com.google.common.io.BaseEncoding;
import com.google.common.primitives.Ints;
-import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
-import com.google.gcloud.BaseService;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.PageImpl.NextPageFetcher;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.RetryHelper.RetryHelperException;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.RewriteResponse;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
+import com.google.cloud.BaseService;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
+import com.google.cloud.PageImpl.NextPageFetcher;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.RetryHelper.RetryHelperException;
+import com.google.cloud.ServiceAccountSigner;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.RewriteResponse;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -59,10 +59,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.Signature;
-import java.security.SignatureException;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
@@ -538,15 +534,12 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio
for (SignUrlOption option : options) {
optionMap.put(option.option(), option.value());
}
- ServiceAccountAuthCredentials authCred =
- (ServiceAccountAuthCredentials) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED);
- ServiceAccountCredentials cred = authCred != null ? authCred.credentials() : null;
- if (authCred == null) {
- checkArgument(
- this.options().authCredentials() != null
- && this.options().authCredentials().credentials() instanceof ServiceAccountCredentials,
+ ServiceAccountSigner authCredentials =
+ (ServiceAccountSigner) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED);
+ if (authCredentials == null) {
+ checkState(this.options().authCredentials() instanceof ServiceAccountSigner,
"Signing key was not provided and could not be derived");
- cred = (ServiceAccountCredentials) this.options().authCredentials().credentials();
+ authCredentials = (ServiceAccountSigner) this.options().authCredentials();
}
// construct signature - see https://cloud.google.com/storage/docs/access-control#Signed-URLs
StringBuilder stBuilder = new StringBuilder();
@@ -583,20 +576,16 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio
path.append(blobInfo.name());
stBuilder.append(path);
try {
- Signature signer = Signature.getInstance("SHA256withRSA");
- signer.initSign(cred.getPrivateKey());
- signer.update(stBuilder.toString().getBytes(UTF_8));
+ byte[] signatureBytes = authCredentials.sign(stBuilder.toString().getBytes(UTF_8));
stBuilder = new StringBuilder("https://storage.googleapis.com").append(path);
String signature =
- URLEncoder.encode(BaseEncoding.base64().encode(signer.sign()), UTF_8.name());
- stBuilder.append("?GoogleAccessId=").append(cred.getClientEmail());
+ URLEncoder.encode(BaseEncoding.base64().encode(signatureBytes), UTF_8.name());
+ stBuilder.append("?GoogleAccessId=").append(authCredentials.account());
stBuilder.append("&Expires=").append(expiration);
stBuilder.append("&Signature=").append(signature);
return new URL(stBuilder.toString());
- } catch (MalformedURLException | NoSuchAlgorithmException | UnsupportedEncodingException e) {
- throw new IllegalStateException(e);
- } catch (SignatureException | InvalidKeyException e) {
- throw new IllegalArgumentException("Invalid service account private key");
+ } catch (MalformedURLException | UnsupportedEncodingException ex) {
+ throw new IllegalStateException(ex);
}
}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageOptions.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageOptions.java
similarity index 90%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageOptions.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageOptions.java
index e7e1c2778fa9..15e5791a6b91 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageOptions.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/StorageOptions.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.common.collect.ImmutableSet;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.storage.spi.DefaultStorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpcFactory;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.storage.spi.DefaultStorageRpc;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpcFactory;
import java.util.Set;
@@ -69,13 +69,11 @@ private StorageOptions(Builder builder) {
super(StorageFactory.class, StorageRpcFactory.class, builder);
}
- @SuppressWarnings("unchecked")
@Override
protected StorageFactory defaultServiceFactory() {
return DefaultStorageFactory.INSTANCE;
}
- @SuppressWarnings("unchecked")
@Override
protected StorageRpcFactory defaultRpcFactory() {
return DefaultStorageRpcFactory.INSTANCE;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/package-info.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/package-info.java
similarity index 89%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/package-info.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/package-info.java
index 181e63b08d0b..11ab4465f33c 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/package-info.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/package-info.java
@@ -19,7 +19,7 @@
*
* Here's a simple usage example for using gcloud-java from App/Compute Engine. This example
* shows how to create a Storage blob. For the complete source code see
- *
+ *
* CreateBlob.java.
*
{@code
* Storage storage = StorageOptions.defaultInstance().service();
@@ -30,7 +30,7 @@
*
* This second example shows how to update the blob's content if the blob exists. For the complete
* source code see
- *
+ *
* UpdateBlob.java.
*
{@code
* Storage storage = StorageOptions.defaultInstance().service();
@@ -50,5 +50,5 @@
* credentials.
* @see Google Cloud Storage
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/DefaultStorageRpc.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java
similarity index 94%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/DefaultStorageRpc.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java
index 8d06832534e2..37c81ff6ff0b 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/DefaultStorageRpc.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java
@@ -12,25 +12,25 @@
* the License.
*/
-package com.google.gcloud.storage.spi;
+package com.google.cloud.storage.spi;
import static com.google.common.base.MoreObjects.firstNonNull;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.DELIMITER;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.FIELDS;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_GENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_GENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_NOT_MATCH;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.MAX_RESULTS;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.PAGE_TOKEN;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.PREDEFINED_ACL;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.PREDEFINED_DEFAULT_OBJECT_ACL;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.PREFIX;
-import static com.google.gcloud.storage.spi.StorageRpc.Option.VERSIONS;
+import static com.google.cloud.storage.spi.StorageRpc.Option.DELIMITER;
+import static com.google.cloud.storage.spi.StorageRpc.Option.FIELDS;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_GENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_GENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_METAGENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_GENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.IF_SOURCE_METAGENERATION_NOT_MATCH;
+import static com.google.cloud.storage.spi.StorageRpc.Option.MAX_RESULTS;
+import static com.google.cloud.storage.spi.StorageRpc.Option.PAGE_TOKEN;
+import static com.google.cloud.storage.spi.StorageRpc.Option.PREDEFINED_ACL;
+import static com.google.cloud.storage.spi.StorageRpc.Option.PREDEFINED_DEFAULT_OBJECT_ACL;
+import static com.google.cloud.storage.spi.StorageRpc.Option.PREFIX;
+import static com.google.cloud.storage.spi.StorageRpc.Option.VERSIONS;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static javax.servlet.http.HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE;
@@ -63,8 +63,8 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.gcloud.storage.StorageException;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.storage.StorageException;
+import com.google.cloud.storage.StorageOptions;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpc.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpc.java
similarity index 99%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpc.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpc.java
index 74f8171de87f..2f84f221e13d 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpc.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpc.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage.spi;
+package com.google.cloud.storage.spi;
import static com.google.common.base.MoreObjects.firstNonNull;
@@ -22,7 +22,7 @@
import com.google.api.services.storage.model.StorageObject;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.storage.StorageException;
+import com.google.cloud.storage.StorageException;
import java.io.InputStream;
import java.util.List;
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpcFactory.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpcFactory.java
similarity index 85%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpcFactory.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpcFactory.java
index 19b98e6273db..f765d3fea98b 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/spi/StorageRpcFactory.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/spi/StorageRpcFactory.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.google.gcloud.storage.spi;
+package com.google.cloud.storage.spi;
-import com.google.gcloud.spi.ServiceRpcFactory;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.spi.ServiceRpcFactory;
+import com.google.cloud.storage.StorageOptions;
/**
* An interface for Storage RPC factory.
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/RemoteGcsHelper.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/RemoteStorageHelper.java
similarity index 79%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/RemoteGcsHelper.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/RemoteStorageHelper.java
index 1287ede746d5..675c892fcc22 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/RemoteGcsHelper.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/RemoteStorageHelper.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.google.gcloud.storage.testing;
+package com.google.cloud.storage.testing;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.storage.BlobInfo;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.Storage.BlobListOption;
-import com.google.gcloud.storage.StorageException;
-import com.google.gcloud.storage.StorageOptions;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.RetryParams;
+import com.google.cloud.storage.BlobInfo;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.BlobListOption;
+import com.google.cloud.storage.StorageException;
+import com.google.cloud.storage.StorageOptions;
import java.io.IOException;
import java.io.InputStream;
@@ -47,13 +47,13 @@
* {@link StorageOptions#connectTimeout()} and {@link StorageOptions#readTimeout()} are both set
* to {@code 60000}.
*/
-public class RemoteGcsHelper {
+public class RemoteStorageHelper {
- private static final Logger log = Logger.getLogger(RemoteGcsHelper.class.getName());
+ private static final Logger log = Logger.getLogger(RemoteStorageHelper.class.getName());
private static final String BUCKET_NAME_PREFIX = "gcloud-test-bucket-temp-";
private final StorageOptions options;
- private RemoteGcsHelper(StorageOptions options) {
+ private RemoteStorageHelper(StorageOptions options) {
this.options = options;
}
@@ -111,16 +111,17 @@ public static String generateBucketName() {
}
/**
- * Creates a {@code RemoteGcsHelper} object for the given project id and JSON key input stream.
+ * Creates a {@code RemoteStorageHelper} object for the given project id and JSON key input
+ * stream.
*
* @param projectId id of the project to be used for running the tests
* @param keyStream input stream for a JSON key
- * @return A {@code RemoteGcsHelper} object for the provided options
- * @throws com.google.gcloud.storage.testing.RemoteGcsHelper.GcsHelperException if
+ * @return A {@code RemoteStorageHelper} object for the provided options
+ * @throws com.google.cloud.storage.testing.RemoteStorageHelper.StorageHelperException if
* {@code keyStream} is not a valid JSON key stream
*/
- public static RemoteGcsHelper create(String projectId, InputStream keyStream)
- throws GcsHelperException {
+ public static RemoteStorageHelper create(String projectId, InputStream keyStream)
+ throws StorageHelperException {
try {
StorageOptions storageOptions = StorageOptions.builder()
.authCredentials(AuthCredentials.createForJson(keyStream))
@@ -129,26 +130,26 @@ public static RemoteGcsHelper create(String projectId, InputStream keyStream)
.connectTimeout(60000)
.readTimeout(60000)
.build();
- return new RemoteGcsHelper(storageOptions);
+ return new RemoteStorageHelper(storageOptions);
} catch (IOException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage());
}
- throw GcsHelperException.translate(ex);
+ throw StorageHelperException.translate(ex);
}
}
/**
- * Creates a {@code RemoteGcsHelper} object using default project id and authentication
+ * Creates a {@code RemoteStorageHelper} object using default project id and authentication
* credentials.
*/
- public static RemoteGcsHelper create() throws GcsHelperException {
+ public static RemoteStorageHelper create() throws StorageHelperException {
StorageOptions storageOptions = StorageOptions.builder()
.retryParams(retryParams())
.connectTimeout(60000)
.readTimeout(60000)
.build();
- return new RemoteGcsHelper(storageOptions);
+ return new RemoteStorageHelper(storageOptions);
}
private static RetryParams retryParams() {
@@ -196,20 +197,20 @@ public Boolean call() {
}
}
- public static class GcsHelperException extends RuntimeException {
+ public static class StorageHelperException extends RuntimeException {
private static final long serialVersionUID = -7756074894502258736L;
- public GcsHelperException(String message) {
+ public StorageHelperException(String message) {
super(message);
}
- public GcsHelperException(String message, Throwable cause) {
+ public StorageHelperException(String message, Throwable cause) {
super(message, cause);
}
- public static GcsHelperException translate(Exception ex) {
- return new GcsHelperException(ex.getMessage(), ex);
+ public static StorageHelperException translate(Exception ex) {
+ return new StorageHelperException(ex.getMessage(), ex);
}
}
}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java b/gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/package-info.java
similarity index 78%
rename from gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java
rename to gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/package-info.java
index 8afdd8a9660d..a8732b029900 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java
+++ b/gcloud-java-storage/src/main/java/com/google/cloud/storage/testing/package-info.java
@@ -21,18 +21,18 @@
*
* Before the test:
*
{@code
- * RemoteGcsHelper gcsHelper = RemoteGcsHelper.create();
- * Storage storage = gcsHelper.options().service();
- * String bucket = RemoteGcsHelper.generateBucketName();
+ * RemoteStorageHelper helper = RemoteStorageHelper.create();
+ * Storage storage = helper.options().service();
+ * String bucket = RemoteStorageHelper.generateBucketName();
* storage.create(BucketInfo.of(bucket));
* }
*
* After the test:
*
{@code
- * RemoteGcsHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
+ * RemoteStorageHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
* }
*
* @see
* gcloud-java tools for testing
*/
-package com.google.gcloud.storage.testing;
+package com.google.cloud.storage.testing;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/AclTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/AclTest.java
similarity index 84%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/AclTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/AclTest.java
index 1c62805b2a1b..26c37f53ba48 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/AclTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/AclTest.java
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.junit.Assert.assertEquals;
import com.google.api.services.storage.model.BucketAccessControl;
import com.google.api.services.storage.model.ObjectAccessControl;
-import com.google.gcloud.storage.Acl.Domain;
-import com.google.gcloud.storage.Acl.Entity;
-import com.google.gcloud.storage.Acl.Entity.Type;
-import com.google.gcloud.storage.Acl.Group;
-import com.google.gcloud.storage.Acl.Project;
-import com.google.gcloud.storage.Acl.Project.ProjectRole;
-import com.google.gcloud.storage.Acl.RawEntity;
-import com.google.gcloud.storage.Acl.Role;
-import com.google.gcloud.storage.Acl.User;
+import com.google.cloud.storage.Acl.Domain;
+import com.google.cloud.storage.Acl.Entity;
+import com.google.cloud.storage.Acl.Entity.Type;
+import com.google.cloud.storage.Acl.Group;
+import com.google.cloud.storage.Acl.Project;
+import com.google.cloud.storage.Acl.Project.ProjectRole;
+import com.google.cloud.storage.Acl.RawEntity;
+import com.google.cloud.storage.Acl.Role;
+import com.google.cloud.storage.Acl.User;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchRequestTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchRequestTest.java
similarity index 95%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchRequestTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchRequestTest.java
index 63972ff85dfd..fbea9283ed50 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchRequestTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchRequestTest.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Storage.PredefinedAcl.PUBLIC_READ;
+import static com.google.cloud.storage.Storage.PredefinedAcl.PUBLIC_READ;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.Iterables;
-import com.google.gcloud.storage.Storage.BlobGetOption;
-import com.google.gcloud.storage.Storage.BlobSourceOption;
-import com.google.gcloud.storage.Storage.BlobTargetOption;
+import com.google.cloud.storage.Storage.BlobGetOption;
+import com.google.cloud.storage.Storage.BlobSourceOption;
+import com.google.cloud.storage.Storage.BlobTargetOption;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchResponseTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchResponseTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchResponseTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchResponseTest.java
index eb45b8b51271..6344d4649fab 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BatchResponseTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BatchResponseTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.storage.BatchResponse.Result;
+import com.google.cloud.storage.BatchResponse.Result;
import org.easymock.EasyMock;
import org.junit.Before;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobIdTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobIdTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java
index acc1885b9194..989d6ff82f40 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobIdTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.junit.Assert.assertEquals;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobInfoTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java
similarity index 96%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobInfoTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java
index db9dddaa864e..4e2f27265ef9 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobInfoTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Acl.Project.ProjectRole.VIEWERS;
-import static com.google.gcloud.storage.Acl.Role.READER;
-import static com.google.gcloud.storage.Acl.Role.WRITER;
+import static com.google.cloud.storage.Acl.Project.ProjectRole.VIEWERS;
+import static com.google.cloud.storage.Acl.Role.READER;
+import static com.google.cloud.storage.Acl.Role.WRITER;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -27,8 +27,8 @@
import com.google.api.services.storage.model.StorageObject;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.storage.Acl.Project;
-import com.google.gcloud.storage.Acl.User;
+import com.google.cloud.storage.Acl.Project;
+import com.google.cloud.storage.Acl.User;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobReadChannelTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobReadChannelTest.java
index 1b0f36a864a2..89f888ec4147 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobReadChannelTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobReadChannelTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
@@ -27,11 +27,11 @@
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpcFactory;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryParams;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpcFactory;
import org.junit.After;
import org.junit.Before;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobTest.java
index c8c5fb5d763c..5af12e8d411d 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Acl.Project.ProjectRole.VIEWERS;
-import static com.google.gcloud.storage.Acl.Role.READER;
-import static com.google.gcloud.storage.Acl.Role.WRITER;
+import static com.google.cloud.storage.Acl.Project.ProjectRole.VIEWERS;
+import static com.google.cloud.storage.Acl.Role.READER;
+import static com.google.cloud.storage.Acl.Role.WRITER;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
@@ -35,10 +35,10 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.storage.Acl.Project;
-import com.google.gcloud.storage.Acl.User;
-import com.google.gcloud.storage.Storage.CopyRequest;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.storage.Acl.Project;
+import com.google.cloud.storage.Acl.User;
+import com.google.cloud.storage.Storage.CopyRequest;
import org.easymock.Capture;
import org.junit.After;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobWriteChannelTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobWriteChannelTest.java
index 18ec64a9575f..549211930e3e 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobWriteChannelTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BlobWriteChannelTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.capture;
@@ -31,11 +31,11 @@
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpcFactory;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryParams;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpcFactory;
import org.easymock.Capture;
import org.easymock.CaptureType;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketInfoTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java
similarity index 90%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketInfoTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java
index 6f9fadfdf7cd..59dd2ea632bc 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketInfoTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java
@@ -14,24 +14,24 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Acl.Project.ProjectRole.VIEWERS;
+import static com.google.cloud.storage.Acl.Project.ProjectRole.VIEWERS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.google.api.services.storage.model.Bucket.Lifecycle.Rule;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.storage.Acl.Project;
-import com.google.gcloud.storage.Acl.Role;
-import com.google.gcloud.storage.Acl.User;
-import com.google.gcloud.storage.BucketInfo.AgeDeleteRule;
-import com.google.gcloud.storage.BucketInfo.CreatedBeforeDeleteRule;
-import com.google.gcloud.storage.BucketInfo.DeleteRule;
-import com.google.gcloud.storage.BucketInfo.DeleteRule.Type;
-import com.google.gcloud.storage.BucketInfo.IsLiveDeleteRule;
-import com.google.gcloud.storage.BucketInfo.NumNewerVersionsDeleteRule;
-import com.google.gcloud.storage.BucketInfo.RawDeleteRule;
+import com.google.cloud.storage.Acl.Project;
+import com.google.cloud.storage.Acl.Role;
+import com.google.cloud.storage.Acl.User;
+import com.google.cloud.storage.BucketInfo.AgeDeleteRule;
+import com.google.cloud.storage.BucketInfo.CreatedBeforeDeleteRule;
+import com.google.cloud.storage.BucketInfo.DeleteRule;
+import com.google.cloud.storage.BucketInfo.DeleteRule.Type;
+import com.google.cloud.storage.BucketInfo.IsLiveDeleteRule;
+import com.google.cloud.storage.BucketInfo.NumNewerVersionsDeleteRule;
+import com.google.cloud.storage.BucketInfo.RawDeleteRule;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketTest.java
index 30b7416531f3..b0f3f7ac9d0c 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/BucketTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Acl.Project.ProjectRole.VIEWERS;
-import static com.google.gcloud.storage.Acl.Role.READER;
-import static com.google.gcloud.storage.Acl.Role.WRITER;
+import static com.google.cloud.storage.Acl.Project.ProjectRole.VIEWERS;
+import static com.google.cloud.storage.Acl.Role.READER;
+import static com.google.cloud.storage.Acl.Role.WRITER;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createStrictMock;
@@ -31,13 +31,13 @@
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.Page;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.storage.Acl.Project;
-import com.google.gcloud.storage.Acl.User;
-import com.google.gcloud.storage.BatchResponse.Result;
-import com.google.gcloud.storage.BucketInfo.AgeDeleteRule;
-import com.google.gcloud.storage.BucketInfo.DeleteRule;
+import com.google.cloud.Page;
+import com.google.cloud.PageImpl;
+import com.google.cloud.storage.Acl.Project;
+import com.google.cloud.storage.Acl.User;
+import com.google.cloud.storage.BatchResponse.Result;
+import com.google.cloud.storage.BucketInfo.AgeDeleteRule;
+import com.google.cloud.storage.BucketInfo.DeleteRule;
import org.easymock.Capture;
import org.junit.After;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyRequestTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyRequestTest.java
similarity index 95%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyRequestTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyRequestTest.java
index 9f8edfb84162..d3e93d9b8f66 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyRequestTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyRequestTest.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
-import static com.google.gcloud.storage.Storage.PredefinedAcl.PUBLIC_READ;
+import static com.google.cloud.storage.Storage.PredefinedAcl.PUBLIC_READ;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.storage.Storage.BlobSourceOption;
-import com.google.gcloud.storage.Storage.BlobTargetOption;
+import com.google.cloud.storage.Storage.BlobSourceOption;
+import com.google.cloud.storage.Storage.BlobTargetOption;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyWriterTest.java
similarity index 96%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyWriterTest.java
index 8ccb81688b65..13467283c013 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CopyWriterTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CopyWriterTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
@@ -25,12 +25,12 @@
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.RewriteRequest;
-import com.google.gcloud.storage.spi.StorageRpc.RewriteResponse;
-import com.google.gcloud.storage.spi.StorageRpcFactory;
+import com.google.cloud.RestorableState;
+import com.google.cloud.RetryParams;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.RewriteRequest;
+import com.google.cloud.storage.spi.StorageRpc.RewriteResponse;
+import com.google.cloud.storage.spi.StorageRpcFactory;
import org.easymock.EasyMock;
import org.junit.After;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CorsTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CorsTest.java
similarity index 95%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/CorsTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/CorsTest.java
index f978cb87f3d1..e16ea98b30b0 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/CorsTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/CorsTest.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.storage.Cors.Origin;
+import com.google.cloud.storage.Cors.Origin;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/OptionTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/OptionTest.java
similarity index 96%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/OptionTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/OptionTest.java
index 08a8e79b2c3b..6856745c0c4d 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/OptionTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/OptionTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
-import com.google.gcloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc;
import org.junit.Rule;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/SerializationTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/SerializationTest.java
similarity index 93%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/SerializationTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/SerializationTest.java
index 613cb81c3549..581a517a1ee6 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/SerializationTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/SerializationTest.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import com.google.common.collect.ImmutableMap;
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.BaseSerializationTest;
-import com.google.gcloud.PageImpl;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.Restorable;
-import com.google.gcloud.storage.Acl.Project.ProjectRole;
-import com.google.gcloud.storage.spi.StorageRpc;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.BaseSerializationTest;
+import com.google.cloud.PageImpl;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.Restorable;
+import com.google.cloud.storage.Acl.Project.ProjectRole;
+import com.google.cloud.storage.spi.StorageRpc;
import java.io.Serializable;
import java.util.Collections;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageExceptionTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageExceptionTest.java
similarity index 96%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageExceptionTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageExceptionTest.java
index cf1d4b394e57..a562ec1194c9 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageExceptionTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageExceptionTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@@ -26,8 +26,8 @@
import static org.junit.Assert.assertTrue;
import com.google.api.client.googleapis.json.GoogleJsonError;
-import com.google.gcloud.BaseServiceException;
-import com.google.gcloud.RetryHelper.RetryHelperException;
+import com.google.cloud.BaseServiceException;
+import com.google.cloud.RetryHelper.RetryHelperException;
import org.junit.Test;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
similarity index 99%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
index 3cc99e3bf884..a122383080b8 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
@@ -31,16 +31,16 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.io.BaseEncoding;
-import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
-import com.google.gcloud.Page;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.RetryParams;
-import com.google.gcloud.ServiceOptions;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.Storage.CopyRequest;
-import com.google.gcloud.storage.spi.StorageRpc;
-import com.google.gcloud.storage.spi.StorageRpc.Tuple;
-import com.google.gcloud.storage.spi.StorageRpcFactory;
+import com.google.cloud.AuthCredentials.ServiceAccountAuthCredentials;
+import com.google.cloud.Page;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.RetryParams;
+import com.google.cloud.ServiceOptions;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.Storage.CopyRequest;
+import com.google.cloud.storage.spi.StorageRpc;
+import com.google.cloud.storage.spi.StorageRpc.Tuple;
+import com.google.cloud.storage.spi.StorageRpcFactory;
import org.easymock.Capture;
import org.easymock.EasyMock;
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/it/ITStorageTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
similarity index 97%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/it/ITStorageTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
index 542cf966d269..a505597b7b21 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/it/ITStorageTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.gcloud.storage.it;
+package com.google.cloud.storage.it;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
@@ -30,24 +30,24 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
-import com.google.gcloud.Page;
-import com.google.gcloud.ReadChannel;
-import com.google.gcloud.RestorableState;
-import com.google.gcloud.WriteChannel;
-import com.google.gcloud.storage.BatchRequest;
-import com.google.gcloud.storage.BatchResponse;
-import com.google.gcloud.storage.Blob;
-import com.google.gcloud.storage.BlobId;
-import com.google.gcloud.storage.BlobInfo;
-import com.google.gcloud.storage.Bucket;
-import com.google.gcloud.storage.BucketInfo;
-import com.google.gcloud.storage.CopyWriter;
-import com.google.gcloud.storage.HttpMethod;
-import com.google.gcloud.storage.Storage;
-import com.google.gcloud.storage.Storage.BlobField;
-import com.google.gcloud.storage.Storage.BucketField;
-import com.google.gcloud.storage.StorageException;
-import com.google.gcloud.storage.testing.RemoteGcsHelper;
+import com.google.cloud.Page;
+import com.google.cloud.ReadChannel;
+import com.google.cloud.RestorableState;
+import com.google.cloud.WriteChannel;
+import com.google.cloud.storage.BatchRequest;
+import com.google.cloud.storage.BatchResponse;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.BlobInfo;
+import com.google.cloud.storage.Bucket;
+import com.google.cloud.storage.BucketInfo;
+import com.google.cloud.storage.CopyWriter;
+import com.google.cloud.storage.HttpMethod;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.BlobField;
+import com.google.cloud.storage.Storage.BucketField;
+import com.google.cloud.storage.StorageException;
+import com.google.cloud.storage.testing.RemoteStorageHelper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -77,7 +77,7 @@ public class ITStorageTest {
private static Storage storage;
private static final Logger log = Logger.getLogger(ITStorageTest.class.getName());
- private static final String BUCKET = RemoteGcsHelper.generateBucketName();
+ private static final String BUCKET = RemoteStorageHelper.generateBucketName();
private static final String CONTENT_TYPE = "text/plain";
private static final byte[] BLOB_BYTE_CONTENT = {0xD, 0xE, 0xA, 0xD};
private static final String BLOB_STRING_CONTENT = "Hello Google Cloud Storage!";
@@ -85,15 +85,15 @@ public class ITStorageTest {
@BeforeClass
public static void beforeClass() {
- RemoteGcsHelper gcsHelper = RemoteGcsHelper.create();
- storage = gcsHelper.options().service();
+ RemoteStorageHelper helper = RemoteStorageHelper.create();
+ storage = helper.options().service();
storage.create(BucketInfo.of(BUCKET));
}
@AfterClass
public static void afterClass() throws ExecutionException, InterruptedException {
if (storage != null) {
- boolean wasDeleted = RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS);
+ boolean wasDeleted = RemoteStorageHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS);
if (!wasDeleted && log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
@@ -368,7 +368,7 @@ public void testListBlobsEmptySelectedFields() throws InterruptedException {
@Test(timeout = 15000)
public void testListBlobsVersioned() throws ExecutionException, InterruptedException {
- String bucketName = RemoteGcsHelper.generateBucketName();
+ String bucketName = RemoteStorageHelper.generateBucketName();
Bucket bucket = storage.create(BucketInfo.builder(bucketName).versioningEnabled(true).build());
try {
String[] blobNames = {"test-list-blobs-versioned-blob1", "test-list-blobs-versioned-blob2"};
@@ -407,7 +407,7 @@ public void testListBlobsVersioned() throws ExecutionException, InterruptedExcep
assertTrue(remoteBlob2.delete());
assertTrue(remoteBlob3.delete());
} finally {
- RemoteGcsHelper.forceDelete(storage, bucketName, 5, TimeUnit.SECONDS);
+ RemoteStorageHelper.forceDelete(storage, bucketName, 5, TimeUnit.SECONDS);
}
}
diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/RemoteGcsHelperTest.java b/gcloud-java-storage/src/test/java/com/google/cloud/storage/testing/RemoteStorageHelperTest.java
similarity index 71%
rename from gcloud-java-storage/src/test/java/com/google/gcloud/storage/RemoteGcsHelperTest.java
rename to gcloud-java-storage/src/test/java/com/google/cloud/storage/testing/RemoteStorageHelperTest.java
index 146922a9dae9..b817ac2fc101 100644
--- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/RemoteGcsHelperTest.java
+++ b/gcloud-java-storage/src/test/java/com/google/cloud/storage/testing/RemoteStorageHelperTest.java
@@ -14,15 +14,20 @@
* limitations under the License.
*/
-package com.google.gcloud.storage;
+package com.google.cloud.storage.testing;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
-import com.google.gcloud.Page;
-import com.google.gcloud.storage.Storage.BlobListOption;
-import com.google.gcloud.storage.testing.RemoteGcsHelper;
+import com.google.cloud.Page;
+import com.google.cloud.storage.Blob;
+import com.google.cloud.storage.BlobId;
+import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.BlobListOption;
+import com.google.cloud.storage.StorageException;
+import com.google.cloud.storage.StorageOptions;
import org.easymock.EasyMock;
import org.junit.Before;
@@ -37,7 +42,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
-public class RemoteGcsHelperTest {
+public class RemoteStorageHelperTest {
private static final String BUCKET_NAME = "bucket-name";
private static final String PROJECT_ID = "project-id";
@@ -70,8 +75,11 @@ public class RemoteGcsHelperTest {
private static final InputStream JSON_KEY_STREAM = new ByteArrayInputStream(JSON_KEY.getBytes());
private static final StorageException RETRYABLE_EXCEPTION = new StorageException(409, "");
private static final StorageException FATAL_EXCEPTION = new StorageException(500, "");
+ private static final BlobId BLOB_ID1 = BlobId.of(BUCKET_NAME, "n1");
+ private static final BlobId BLOB_ID2 = BlobId.of(BUCKET_NAME, "n2");
- private static Storage serviceMockReturnsOptions;
+ private Blob blob1;
+ private Blob blob2;
private List blobList;
private Page blobPage;
@@ -80,18 +88,9 @@ public class RemoteGcsHelperTest {
@Before
public void setUp() {
- serviceMockReturnsOptions = EasyMock.createMock(Storage.class);
- EasyMock.expect(serviceMockReturnsOptions.options())
- .andReturn(EasyMock.createMock(StorageOptions.class))
- .times(2);
- EasyMock.replay(serviceMockReturnsOptions);
- blobList = ImmutableList.of(
- new Blob(
- serviceMockReturnsOptions,
- new BlobInfo.BuilderImpl(BlobInfo.builder(BUCKET_NAME, "n1").build())),
- new Blob(
- serviceMockReturnsOptions,
- new BlobInfo.BuilderImpl(BlobInfo.builder(BUCKET_NAME, "n2").build())));
+ blob1 = EasyMock.createMock(Blob.class);
+ blob2 = EasyMock.createMock(Blob.class);
+ blobList = ImmutableList.of(blob1, blob2);
blobPage = new Page() {
@Override
public String nextPageCursor() {
@@ -118,44 +117,48 @@ public Iterator iterateAll() {
@Test
public void testForceDelete() throws InterruptedException, ExecutionException {
Storage storageMock = EasyMock.createMock(Storage.class);
+ EasyMock.expect(blob1.blobId()).andReturn(BLOB_ID1);
+ EasyMock.expect(storageMock.delete(BLOB_ID1)).andReturn(true);
+ EasyMock.expect(blob2.blobId()).andReturn(BLOB_ID2);
+ EasyMock.expect(storageMock.delete(BLOB_ID2)).andReturn(true);
EasyMock.expect(storageMock.list(BUCKET_NAME, BlobListOption.versions(true)))
.andReturn(blobPage);
- for (BlobInfo info : blobList) {
- EasyMock.expect(storageMock.delete(info.blobId())).andReturn(true);
- }
EasyMock.expect(storageMock.delete(BUCKET_NAME)).andReturn(true);
- EasyMock.replay(storageMock);
- assertTrue(RemoteGcsHelper.forceDelete(storageMock, BUCKET_NAME, 5, TimeUnit.SECONDS));
- EasyMock.verify(storageMock);
+ EasyMock.replay(storageMock, blob1, blob2);
+ assertTrue(RemoteStorageHelper.forceDelete(storageMock, BUCKET_NAME, 5, TimeUnit.SECONDS));
+ EasyMock.verify(storageMock, blob1, blob2);
}
@Test
public void testForceDeleteTimeout() throws InterruptedException, ExecutionException {
Storage storageMock = EasyMock.createMock(Storage.class);
+ EasyMock.expect(blob1.blobId()).andReturn(BLOB_ID1).anyTimes();
+ EasyMock.expect(storageMock.delete(BLOB_ID1)).andReturn(true).anyTimes();
+ EasyMock.expect(blob2.blobId()).andReturn(BLOB_ID2).anyTimes();
+ EasyMock.expect(storageMock.delete(BLOB_ID2)).andReturn(true).anyTimes();
EasyMock.expect(storageMock.list(BUCKET_NAME, BlobListOption.versions(true)))
.andReturn(blobPage).anyTimes();
- for (BlobInfo info : blobList) {
- EasyMock.expect(storageMock.delete(info.blobId())).andReturn(true).anyTimes();
- }
EasyMock.expect(storageMock.delete(BUCKET_NAME)).andThrow(RETRYABLE_EXCEPTION).anyTimes();
- EasyMock.replay(storageMock);
- assertTrue(!RemoteGcsHelper.forceDelete(storageMock, BUCKET_NAME, 50, TimeUnit.MICROSECONDS));
+ EasyMock.replay(storageMock, blob1, blob2);
+ assertFalse(
+ RemoteStorageHelper.forceDelete(storageMock, BUCKET_NAME, 50, TimeUnit.MICROSECONDS));
EasyMock.verify(storageMock);
}
@Test
public void testForceDeleteFail() throws InterruptedException, ExecutionException {
Storage storageMock = EasyMock.createMock(Storage.class);
+ EasyMock.expect(blob1.blobId()).andReturn(BLOB_ID1);
+ EasyMock.expect(storageMock.delete(BLOB_ID1)).andReturn(true);
+ EasyMock.expect(blob2.blobId()).andReturn(BLOB_ID2);
+ EasyMock.expect(storageMock.delete(BLOB_ID2)).andReturn(true);
EasyMock.expect(storageMock.list(BUCKET_NAME, BlobListOption.versions(true)))
.andReturn(blobPage);
- for (BlobInfo info : blobList) {
- EasyMock.expect(storageMock.delete(info.blobId())).andReturn(true);
- }
EasyMock.expect(storageMock.delete(BUCKET_NAME)).andThrow(FATAL_EXCEPTION);
- EasyMock.replay(storageMock);
+ EasyMock.replay(storageMock, blob1, blob2);
thrown.expect(ExecutionException.class);
try {
- RemoteGcsHelper.forceDelete(storageMock, BUCKET_NAME, 5, TimeUnit.SECONDS);
+ RemoteStorageHelper.forceDelete(storageMock, BUCKET_NAME, 5, TimeUnit.SECONDS);
} finally {
EasyMock.verify(storageMock);
}
@@ -164,30 +167,32 @@ public void testForceDeleteFail() throws InterruptedException, ExecutionExceptio
@Test
public void testForceDeleteNoTimeout() {
Storage storageMock = EasyMock.createMock(Storage.class);
+ EasyMock.expect(blob1.blobId()).andReturn(BLOB_ID1);
+ EasyMock.expect(storageMock.delete(BLOB_ID1)).andReturn(true);
+ EasyMock.expect(blob2.blobId()).andReturn(BLOB_ID2);
+ EasyMock.expect(storageMock.delete(BLOB_ID2)).andReturn(true);
EasyMock.expect(storageMock.list(BUCKET_NAME, BlobListOption.versions(true)))
.andReturn(blobPage);
- for (BlobInfo info : blobList) {
- EasyMock.expect(storageMock.delete(info.blobId())).andReturn(true);
- }
EasyMock.expect(storageMock.delete(BUCKET_NAME)).andReturn(true);
- EasyMock.replay(storageMock);
- RemoteGcsHelper.forceDelete(storageMock, BUCKET_NAME);
+ EasyMock.replay(storageMock, blob1, blob2);
+ RemoteStorageHelper.forceDelete(storageMock, BUCKET_NAME);
EasyMock.verify(storageMock);
}
@Test
public void testForceDeleteNoTimeoutFail() {
Storage storageMock = EasyMock.createMock(Storage.class);
+ EasyMock.expect(blob1.blobId()).andReturn(BLOB_ID1);
+ EasyMock.expect(storageMock.delete(BLOB_ID1)).andReturn(true);
+ EasyMock.expect(blob2.blobId()).andReturn(BLOB_ID2);
+ EasyMock.expect(storageMock.delete(BLOB_ID2)).andReturn(true);
EasyMock.expect(storageMock.list(BUCKET_NAME, BlobListOption.versions(true)))
.andReturn(blobPage);
- for (BlobInfo info : blobList) {
- EasyMock.expect(storageMock.delete(info.blobId())).andReturn(true);
- }
EasyMock.expect(storageMock.delete(BUCKET_NAME)).andThrow(FATAL_EXCEPTION);
- EasyMock.replay(storageMock);
+ EasyMock.replay(storageMock, blob1, blob2);
thrown.expect(StorageException.class);
try {
- RemoteGcsHelper.forceDelete(storageMock, BUCKET_NAME);
+ RemoteStorageHelper.forceDelete(storageMock, BUCKET_NAME);
} finally {
EasyMock.verify(storageMock);
}
@@ -195,7 +200,7 @@ public void testForceDeleteNoTimeoutFail() {
@Test
public void testCreateFromStream() {
- RemoteGcsHelper helper = RemoteGcsHelper.create(PROJECT_ID, JSON_KEY_STREAM);
+ RemoteStorageHelper helper = RemoteStorageHelper.create(PROJECT_ID, JSON_KEY_STREAM);
StorageOptions options = helper.options();
assertEquals(PROJECT_ID, options.projectId());
assertEquals(60000, options.connectTimeout());
diff --git a/gcloud-java/README.md b/gcloud-java/README.md
index 36e82fb23a74..a01f794be966 100644
--- a/gcloud-java/README.md
+++ b/gcloud-java/README.md
@@ -5,7 +5,7 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
-[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)
+[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java.svg)]( https://img.shields.io/maven-central/v/com.google.cloud/gcloud-java.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
@@ -25,18 +25,18 @@ Quickstart
If you are using Maven, add this to your pom.xml file
```xml
- com.google.gcloud
+ com.google.cloud
gcloud-java
- 0.1.7
+ 0.2.0
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.gcloud:gcloud-java:0.1.7'
+compile 'com.google.cloud:gcloud-java:0.2.0'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.7"
+libraryDependencies += "com.google.cloud" % "gcloud-java" % "0.2.0"
```
Troubleshooting
@@ -80,7 +80,7 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-datastore]: https://cloud.google.com/datastore/docs
[cloud-datastore-docs]: https://cloud.google.com/datastore/docs
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
-[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html
+[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/datastore/package-summary.html
[cloud-pubsub]: https://cloud.google.com/pubsub/
[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs
@@ -88,4 +88,4 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-storage]: https://cloud.google.com/storage/
[cloud-storage-docs]: https://cloud.google.com/storage/docs/overview
[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
-[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/storage/package-summary.html
+[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/cloud/storage/package-summary.html
diff --git a/gcloud-java/pom.xml b/gcloud-java/pom.xml
index 9b765db419d7..7dbd14e591cc 100644
--- a/gcloud-java/pom.xml
+++ b/gcloud-java/pom.xml
@@ -4,13 +4,14 @@
gcloud-java
jar
GCloud Java
+ https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java
Java idiomatic client for Google Cloud Platform services.
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index 42f9bd73cdfb..421ee0a49540 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,10 +1,10 @@
4.0.0
- com.google.gcloud
+ com.google.cloud
gcloud-java-pom
pom
- 0.1.8-SNAPSHOT
+ 0.2.1-SNAPSHOT
GCloud Java
https://github.com/GoogleCloudPlatform/gcloud-java
@@ -234,32 +234,6 @@
-Xlint:unchecked
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.0.0
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.3
-
-
- attach-javadocs
-
- jar
-
-
-
-
org.apache.maven.plugins
maven-gpg-plugin
@@ -309,10 +283,10 @@
true
- com/google/gcloud/**/*.class
+ com/google/cloud/**/*.class
- com/google/gcloud/examples/**/*.class
+ com/google/cloud/examples/**/*.class
256m
@@ -400,19 +374,19 @@
API packages
- com.google.gcloud*
+ com.google.cloud*
Test helpers packages
- com.google.gcloud.bigquery.testing:com.google.gcloud.datastore.testing:com.google.gcloud.dns.testing:com.google.gcloud.resourcemanager.testing:com.google.gcloud.storage.testing
+ com.google.cloud.bigquery.testing:com.google.cloud.datastore.testing:com.google.cloud.dns.testing:com.google.cloud.resourcemanager.testing:com.google.cloud.storage.testing
Example packages
- com.google.gcloud.examples*
+ com.google.cloud.examples*
SPI packages
- com.google.gcloud.spi:com.google.gcloud.bigquery.spi:com.google.gcloud.datastore.spi:com.google.gcloud.dns.spi:com.google.gcloud.resourcemanager.spi:com.google.gcloud.storage.spi
+ com.google.cloud.spi:com.google.cloud.bigquery.spi:com.google.cloud.datastore.spi:com.google.cloud.dns.spi:com.google.cloud.resourcemanager.spi:com.google.cloud.storage.spi
@@ -444,4 +418,39 @@
+
+
+ release
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.0
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
diff --git a/src/site/apt/gcloud-java-core/index.apt b/src/site/apt/gcloud-java-core/index.apt
deleted file mode 100644
index 1dbbe002bd1b..000000000000
--- a/src/site/apt/gcloud-java-core/index.apt
+++ /dev/null
@@ -1,12 +0,0 @@
-GCloud Java Core: Common functionality for GCloud Java services.
-
- This module provides common functionality required by service-specific modules of this library.
- This library is in a early stage of its development and may occasionally make backwards-incompatible changes,
- but it is already usable.
-
-* Links
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-core}GitHub repository}}
-
- * {{{./apidocs/index.html?com/google/gcloud/package-summary.html}Javadocs}}
-
diff --git a/src/site/apt/gcloud-java-datastore/index.apt b/src/site/apt/gcloud-java-datastore/index.apt
deleted file mode 100644
index 193fd958fda1..000000000000
--- a/src/site/apt/gcloud-java-datastore/index.apt
+++ /dev/null
@@ -1,16 +0,0 @@
-GCloud Java Datastore: Idiomatic Java Client for Google Cloud Datastore.
-
- This is a Java Client for accessing Google Cloud Datastore.
- This library is in a early stage of its development and may occasionally make backwards-incompatible changes,
- but it is already usable.
-
-* Features
-
- * {{{https://cloud.google.com/datastore/}Google Cloud Datastore}}
-
-* Links
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-datastore}GitHub repository}}
-
- * {{{./apidocs/index.html?com/google/gcloud/datastore/package-summary.html}Javadocs}}
-
diff --git a/src/site/apt/gcloud-java-examples/index.apt b/src/site/apt/gcloud-java-examples/index.apt
deleted file mode 100644
index 349b06016d39..000000000000
--- a/src/site/apt/gcloud-java-examples/index.apt
+++ /dev/null
@@ -1,11 +0,0 @@
-GCloud Java Examples: Examples using GCloud Java services
-
- This library is in a early stage of its development and may occasionally make backwards-incompatible changes,
- but it is already usable.
-
-* Links
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-examples}GitHub repository}}
-
- * {{{./apidocs/index.html?com/google/gcloud/examples/package-summary.html}Javadocs}}
-
diff --git a/src/site/apt/gcloud-java-storage/index.apt b/src/site/apt/gcloud-java-storage/index.apt
deleted file mode 100644
index 5af2eb07133e..000000000000
--- a/src/site/apt/gcloud-java-storage/index.apt
+++ /dev/null
@@ -1,16 +0,0 @@
-GCloud Java Storage: Idiomatic Java Client for Google Cloud Storage.
-
- This is a Java Client for accessing Google Cloud Storage.
- This library is in a early stage of its development and may occasionally make backwards-incompatible changes,
- but it is already usable.
-
-* Features
-
- * {{{https://cloud.google.com/storage/}Google Cloud Storage}}
-
-* Links
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-storage}GitHub repository}}
-
- * {{{./apidocs/index.html?com/google/gcloud/storage/package-summary.html}Javadocs}}
-
diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt
deleted file mode 100644
index 395bfe7a65e0..000000000000
--- a/src/site/apt/index.apt
+++ /dev/null
@@ -1,21 +0,0 @@
-GCloud Java: Idiomatic Java Client for Google Cloud Platform services.
-
- This is a Java Client for accessing Google Cloud Platorm services such as Datastore, Storage, PubSub and others.
- This library is in a early stage of its development and may occasionally make backwards-incompatible changes,
- but it is already usable.
-
-* Features
-
- * {{{https://cloud.google.com/datastore/}Google Cloud Datastore}}
-
-* Links
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java}GitHub repository}}
-
- * {{{./apidocs/index.html}Javadocs}}
-
- * {{{https://travis-ci.org/GoogleCloudPlatform/gcloud-java} Continous Integration System (Travis-CI)}}
-
- * {{{https://github.com/GoogleCloudPlatform/gcloud-java/issues?page=1&state=open}Issues}}
-
- * {{{https://coveralls.io/r/GoogleCloudPlatform/gcloud-java/}Coverage}}
diff --git a/src/site/resources/index.html b/src/site/resources/index.html
index 0e0933e7b68c..cba3e64a0962 100644
--- a/src/site/resources/index.html
+++ b/src/site/resources/index.html
@@ -60,10 +60,11 @@ gcloud
Quickstart with Maven: Add gcloud to your pom.xml
<dependency>
- <groupId>com.google.gcloud</groupId>
+ <groupId>com.google.cloud</groupId>
<artifactId>gcloud-java</artifactId>
<version>{{SITE_VERSION}}</version>
</dependency>
+ As of April 12th, 2016, gcloud-java's group ID and base package were renamed to "com.google.cloud". If you haven't already, please update your dependencies.
@@ -135,11 +136,11 @@ Example: Retrieve Datastore Entries
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
// Authentication is automatic inside Google Compute Engine
// and Google App Engine.
@@ -152,12 +153,12 @@ Example: Retrieve Datastore Entries
-import com.google.gcloud.AuthCredentials;
-import com.google.gcloud.datastore.Datastore;
-import com.google.gcloud.datastore.DatastoreOptions;
-import com.google.gcloud.datastore.Entity;
-import com.google.gcloud.datastore.Key;
-import com.google.gcloud.datastore.KeyFactory;
+import com.google.cloud.AuthCredentials;
+import com.google.cloud.datastore.Datastore;
+import com.google.cloud.datastore.DatastoreOptions;
+import com.google.cloud.datastore.Entity;
+import com.google.cloud.datastore.Key;
+import com.google.cloud.datastore.KeyFactory;
DatastoreOptions options = DatastoreOptions.builder()
.projectId(PROJECT_ID)
@@ -178,10 +179,21 @@ Examples
-
-
SparkJava demo
- Uses gcloud-java with App Engine Managed VMs, Datastore, and SparkJava.
+ Bookshelf
- An App Engine app that manages a virtual bookshelf using gcloud-java libraries for Datastore and Storage.
+
+
+ -
+
Flexible Environment/Datastore example
- A simple app that uses Cloud Datastore to list the last 10 IP addresses that visited your site. Read about how to run the application here.
+
+ -
+
Flexible Environment/Storage example
- An app that uploads files to a public Cloud Storage bucket on the App Engine Flexible Environment runtime.
+
+ -
+
SparkJava demo
- Uses gcloud-java with App Engine Flexible Environment, Datastore, and SparkJava.
-
-
Bookshelf
- An App Engine app that manages a virtual bookshelf using gcloud-java libraries for Datastore and Storage.
+ TaskList
- An command line app that manages a to-do list using Cloud Datastore.
+
diff --git a/utilities/after_success.sh b/utilities/after_success.sh
index be7484806c46..7aeecd2f6bbd 100755
--- a/utilities/after_success.sh
+++ b/utilities/after_success.sh
@@ -12,8 +12,23 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" ]; then
if [ "${TRAVIS_PULL_REQUEST}" == "false" -a "${TRAVIS_BRANCH}" == "master" ]; then
source ./utilities/integration_test_env.sh
SITE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
+ echo "Used the maven-help-plugin to determine that the version is $SITE_VERSION"
+ if [ "$SITE_VERSION" == "" ]; then
+ echo "Could not determine the version, so we're exiting."
+ exit 1
+ fi
if [ "${SITE_VERSION##*-}" != "SNAPSHOT" ]; then
- # Deploy site if not a SNAPSHOT
+ # Deploy Maven artifacts (if they don't exist yet) and update artifact version in READMEs.
+ URL=https://oss.sonatype.org/content/repositories/releases/com/google/cloud/gcloud-java/$SITE_VERSION/
+ if curl --output /dev/null --silent --head --fail "$URL"; then
+ echo "Not deploying artifacts because it seems like they already exist."
+ echo "Existence was checked using the url $URL"
+ else
+ mvn clean deploy -DskipITs --settings ~/.m2/settings.xml -P sign-deploy,release
+ fi
+ utilities/update_docs_version.sh
+
+ # Create website
git config --global user.name "travis-ci"
git config --global user.email "travis@travis-ci.org"
git clone --branch gh-pages --single-branch https://github.com/GoogleCloudPlatform/gcloud-java/ tmp_gh-pages
@@ -28,15 +43,11 @@ if [ "${TRAVIS_JDK_VERSION}" == "oraclejdk7" ]; then
git add index.html
echo "" > apidocs/index.html
git add apidocs/index.html
- git commit -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect."
+ git commit -m "Added a new site for version $SITE_VERSION and updated the root directory's redirect. [ci skip]"
git config --global push.default simple
git push --quiet "https://${CI_DEPLOY_USERNAME}:${CI_DEPLOY_PASSWORD}@github.com/GoogleCloudPlatform/gcloud-java.git" > /dev/null 2>&1
-
- cd ..
- utilities/update_docs_version.sh # Update version in READMEs
- mvn clean deploy --settings ~/.m2/settings.xml -P sign-deploy
else
- mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml
+ mvn clean deploy -DskipTests=true -Dgpg.skip=true --settings ~/.m2/settings.xml -P release
fi
else
echo "Not deploying artifacts. This is only done with non-pull-request commits to master branch with Oracle Java 7 builds."
diff --git a/utilities/update_docs_version.sh b/utilities/update_docs_version.sh
index 4fc0aa772963..c7d39c4a5c4e 100755
--- a/utilities/update_docs_version.sh
+++ b/utilities/update_docs_version.sh
@@ -10,7 +10,7 @@ RELEASED_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate
if [ "${RELEASED_VERSION##*-}" != "SNAPSHOT" ]; then
echo "Changing version to $RELEASED_VERSION in README files"
# Get list of directories for which README.md must be updated
- module_folders=($(find . -maxdepth 1 -name 'gcloud-java*' -type d) .)
+ module_folders=($(find . -maxdepth 2 -type d | sed -E -n "/^\.\/(gcloud-java-contrib\/)?gcloud-java(-[a-z]+)+$/p") . ./gcloud-java)
for item in ${module_folders[*]}
do
sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+<\/version>/${RELEASED_VERSION}<\/version>/g" ${item}/README.md
diff --git a/utilities/update_pom_version.sh b/utilities/update_pom_version.sh
index d750ee4e9650..d4251bf053cf 100755
--- a/utilities/update_pom_version.sh
+++ b/utilities/update_pom_version.sh
@@ -11,8 +11,7 @@
# Get the previous maven project version.
CURRENT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
# Get list of directories for which pom.xml must be updated
-module_folders=($(find . -maxdepth 1 -name 'gcloud-java*' -type d) .)
-
+module_folders=($(find . -maxdepth 2 -type d | sed -E -n "/^\.\/(gcloud-java-contrib\/)?gcloud-java(-[a-z]+)+$/p") . ./gcloud-java)
if [ $# -eq 1 ]; then
NEW_VERSION=$1
elif [ "${CURRENT_VERSION##*-}" != "SNAPSHOT" ]; then
diff --git a/utilities/verify.sh b/utilities/verify.sh
index b29ab8d8f747..26c490a55806 100755
--- a/utilities/verify.sh
+++ b/utilities/verify.sh
@@ -10,7 +10,7 @@ if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
chmod 700 $TRAVIS_BUILD_DIR/signing-tools
tar xvf $TRAVIS_BUILD_DIR/signing-tools.tar -C $TRAVIS_BUILD_DIR/signing-tools
# Run verify
- mvn verify
+ mvn verify -P release
else
- mvn verify -DskipITs
+ mvn verify -DskipITs -P release
fi