From 246e5a7138e38c04e867b61dae28106be8569684 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Wed, 13 Apr 2016 09:56:37 +0200 Subject: [PATCH] Remove Compute Operation's creation timestamp field --- .../com/google/gcloud/compute/Compute.java | 1 - .../com/google/gcloud/compute/Operation.java | 22 ------------------- .../gcloud/compute/ComputeImplTest.java | 3 --- .../google/gcloud/compute/OperationTest.java | 7 ------ .../gcloud/compute/it/ITComputeTest.java | 3 --- 5 files changed, 36 deletions(-) diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java index 5cdb7eb0e85e..dbc2f0d49366 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java @@ -232,7 +232,6 @@ static String selector(LicenseField... fields) { */ enum OperationField { CLIENT_OPERATION_ID("clientOperationId"), - CREATION_TIMESTAMP("creationTimestamp"), DESCRIPTION("description"), END_TIME("endTime"), ERROR("error"), diff --git a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Operation.java b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Operation.java index 78afc170f671..4270147777a6 100644 --- a/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Operation.java +++ b/gcloud-java-compute/src/main/java/com/google/gcloud/compute/Operation.java @@ -52,7 +52,6 @@ public class Operation implements Serializable { private final ComputeOptions options; private final String id; private final OperationId operationId; - private final Long creationTimestamp; private final String clientOperationId; private final String operationType; private final String targetLink; @@ -296,7 +295,6 @@ static final class Builder { private Compute compute; private String id; - private Long creationTimestamp; private OperationId operationId; private String clientOperationId; private String operationType; @@ -324,9 +322,6 @@ static final class Builder { if (operationPb.getId() != null) { id = operationPb.getId().toString(); } - if (operationPb.getCreationTimestamp() != null) { - creationTimestamp = TIMESTAMP_FORMATTER.parseMillis(operationPb.getCreationTimestamp()); - } if (RegionOperationId.matchesUrl(operationPb.getSelfLink())) { operationId = RegionOperationId.fromUrl(operationPb.getSelfLink()); } else if (ZoneOperationId.matchesUrl(operationPb.getSelfLink())) { @@ -372,11 +367,6 @@ Builder id(String id) { return this; } - Builder creationTimestamp(Long creationTimestamp) { - this.creationTimestamp = creationTimestamp; - return this; - } - Builder operationId(OperationId operationId) { this.operationId = checkNotNull(operationId); return this; @@ -471,7 +461,6 @@ private Operation(Builder builder) { this.compute = checkNotNull(builder.compute); this.options = compute.options(); this.id = builder.id; - this.creationTimestamp = builder.creationTimestamp; this.operationId = checkNotNull(builder.operationId); this.clientOperationId = builder.clientOperationId; this.operationType = builder.operationType; @@ -505,13 +494,6 @@ public String id() { return id; } - /** - * Returns the creation timestamp in milliseconds since epoch. - */ - public Long creationTimestamp() { - return creationTimestamp; - } - /** * Returns the operation's identity. This method returns an {@link GlobalOperationId} for global * operations, a {@link RegionOperationId} for region operations and a {@link ZoneOperationId} for @@ -705,7 +687,6 @@ public String toString() { return MoreObjects.toStringHelper(this) .add("id", id) .add("operationsId", operationId) - .add("creationTimestamp", creationTimestamp) .add("clientOperationId", clientOperationId) .add("operationType", operationType) .add("targetLink", targetLink) @@ -743,9 +724,6 @@ com.google.api.services.compute.model.Operation toPb() { if (id != null) { operationPb.setId(new BigInteger(id)); } - if (creationTimestamp != null) { - operationPb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp)); - } operationPb.setName(operationId.operation()); operationPb.setClientOperationId(clientOperationId); switch (operationId.type()) { diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java index e193be1d8da5..edd8b2bd0cef 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/ComputeImplTest.java @@ -427,7 +427,6 @@ public void setUp() { Compute otherService = options.toBuilder().build().service(); globalOperation = new Operation.Builder(otherService) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(GLOBAL_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) @@ -448,7 +447,6 @@ public void setUp() { .build(); zoneOperation = new Operation.Builder(otherService) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(ZONE_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) @@ -469,7 +467,6 @@ public void setUp() { .build(); regionOperation = new Operation.Builder(otherService) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(REGION_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/OperationTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/OperationTest.java index 62899071ce32..bc756bdbfe6a 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/OperationTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/OperationTest.java @@ -89,7 +89,6 @@ private void initializeExpectedOperation(int optionsCalls) { replay(serviceMockReturnsOptions); globalOperation = new Operation.Builder(serviceMockReturnsOptions) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(GLOBAL_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) @@ -110,7 +109,6 @@ private void initializeExpectedOperation(int optionsCalls) { .build(); zoneOperation = new Operation.Builder(serviceMockReturnsOptions) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(ZONE_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) @@ -131,7 +129,6 @@ private void initializeExpectedOperation(int optionsCalls) { .build(); regionOperation = new Operation.Builder(serviceMockReturnsOptions) .id(ID) - .creationTimestamp(CREATION_TIMESTAMP) .operationId(REGION_OPERATION_ID) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) @@ -157,7 +154,6 @@ private void initializeOperation() { operation = new Operation.Builder(compute) .id(ID) .operationId(GLOBAL_OPERATION_ID) - .creationTimestamp(CREATION_TIMESTAMP) .clientOperationId(CLIENT_OPERATION_ID) .operationType(OPERATION_TYPE) .targetLink(TARGET_LINK) @@ -183,7 +179,6 @@ public void tearDown() throws Exception { } private void assertEqualsCommonFields(Operation operation) { - assertEquals(CREATION_TIMESTAMP, operation.creationTimestamp()); assertEquals(ID, operation.id()); assertEquals(CLIENT_OPERATION_ID, operation.clientOperationId()); assertEquals(OPERATION_TYPE, operation.operationType()); @@ -205,7 +200,6 @@ private void assertEqualsCommonFields(Operation operation) { } private void assertNullCommonFields(Operation operation) { - assertNull(operation.creationTimestamp()); assertNull(operation.id()); assertNull(operation.clientOperationId()); assertNull(operation.operationType()); @@ -401,7 +395,6 @@ public void testReloadWithOptions() throws Exception { private void compareOperation(Operation expected, Operation value) { assertEquals(expected, value); assertEquals(expected.compute().options(), value.compute().options()); - assertEquals(expected.creationTimestamp(), value.creationTimestamp()); assertEquals(expected.operationId(), value.operationId()); assertEquals(expected.clientOperationId(), value.clientOperationId()); assertEquals(expected.operationType(), value.operationType()); diff --git a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java index a2f472cdcbb8..39fdb622a59d 100644 --- a/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java +++ b/gcloud-java-compute/src/test/java/com/google/gcloud/compute/it/ITComputeTest.java @@ -502,7 +502,6 @@ public void testListGlobalOperationsWithSelectedFields() { assertNull(operation.operationType()); assertNull(operation.targetLink()); assertNull(operation.targetId()); - assertNull(operation.creationTimestamp()); assertNull(operation.operationType()); assertNull(operation.status()); assertNull(operation.statusMessage()); @@ -564,7 +563,6 @@ public void testListRegionOperationsWithSelectedFields() { assertNull(operation.operationType()); assertNull(operation.targetLink()); assertNull(operation.targetId()); - assertNull(operation.creationTimestamp()); assertNull(operation.operationType()); assertNull(operation.status()); assertNull(operation.statusMessage()); @@ -628,7 +626,6 @@ public void testListZoneOperationsWithSelectedFields() { assertNull(operation.operationType()); assertNull(operation.targetLink()); assertNull(operation.targetId()); - assertNull(operation.creationTimestamp()); assertNull(operation.operationType()); assertNull(operation.status()); assertNull(operation.statusMessage());