Skip to content

Commit

Permalink
Add SnapshotInfo and related classes to SerializationTest, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Mar 23, 2016
1 parent 741b804 commit f968d38
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ DiskId setProjectId(String projectId) {
}

/**
* Returns a disk identity given the zone identity and the disk name. The address name must be
* 1-63 characters long and comply with RFC1035. Specifically, the name must match the regular
* Returns a disk identity given the zone identity and the disk name. The disk name must be 1-63
* characters long and comply with RFC1035. Specifically, the name must match the regular
* expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a
* lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
* except the last character, which cannot be a dash.
Expand All @@ -119,7 +119,7 @@ public static DiskId of(ZoneId zoneId, String disk) {
}

/**
* Returns a disk identity given the zone and disk names. The address name must be 1-63 characters
* Returns a disk identity given the zone and disk names. The disk name must be 1-63 characters
* long and comply with RFC1035. Specifically, the name must match the regular expression
* {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
* and all following characters must be a dash, lowercase letter, or digit, except the last
Expand All @@ -132,7 +132,7 @@ public static DiskId of(String zone, String disk) {
}

/**
* Returns a disk identity given project, zone and disks names. The address name must be 1-63
* Returns a disk identity given project, zone and disks names. The disk name must be 1-63
* characters long and comply with RFC1035. Specifically, the name must match the regular
* expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a
* lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ public Snapshot apply(SnapshotInfo snapshot) {
private final StorageBytesStatus storageBytesStatus;

/**
* The status of a Google Compute Engine snapshot. A snapshot can be used to create other
* resources, such as disks, only after the snapshot has been successfully created and the status
* is set to {@code READY}.
* The status of a Google Compute Engine snapshot. A snapshot can be used to create a disk only
* after the snapshot has been successfully created and the status is set to {@code READY}.
*/
public enum Status {
/**
Expand Down Expand Up @@ -106,7 +105,7 @@ public enum Status {
}

/**
* An indicator whether {@link SnapshotInfo#storageBytes()} is in a stable state or it is being
* An indicator of whether {@link SnapshotInfo#storageBytes()} is in a stable state or it is being
* adjusted as a result of shared storage reallocation.
*/
public enum StorageBytesStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public class SerializationTest {
.usage(INSTANCE_USAGE)
.build();
private static final Address ADDRESS = new Address.Builder(COMPUTE, REGION_ADDRESS_ID).build();
private static final DiskId DISK_ID = DiskId.of("project", "zone", "disk");
private static final SnapshotId SNAPSHOT_ID = SnapshotId.of("project", "snapshot");
private static final SnapshotInfo SNAPSHOT_INFO = SnapshotInfo.of(SNAPSHOT_ID, DISK_ID);
private static final Compute.DiskTypeOption DISK_TYPE_OPTION =
Compute.DiskTypeOption.fields();
private static final Compute.DiskTypeFilter DISK_TYPE_FILTER =
Expand Down Expand Up @@ -212,11 +215,12 @@ public void testModelAndRequests() throws Exception {
REGION_OPERATION_ID, ZONE_OPERATION_ID, GLOBAL_OPERATION, REGION_OPERATION, ZONE_OPERATION,
INSTANCE_ID, REGION_FORWARDING_RULE_ID, GLOBAL_FORWARDING_RULE_ID, GLOBAL_ADDRESS_ID,
REGION_ADDRESS_ID, INSTANCE_USAGE, GLOBAL_FORWARDING_USAGE, REGION_FORWARDING_USAGE,
ADDRESS_INFO, ADDRESS, DISK_TYPE_OPTION, DISK_TYPE_FILTER, DISK_TYPE_LIST_OPTION,
DISK_TYPE_AGGREGATED_LIST_OPTION, MACHINE_TYPE_OPTION, MACHINE_TYPE_FILTER,
MACHINE_TYPE_LIST_OPTION, MACHINE_TYPE_AGGREGATED_LIST_OPTION, REGION_OPTION, REGION_FILTER,
REGION_LIST_OPTION, ZONE_OPTION, ZONE_FILTER, ZONE_LIST_OPTION, LICENSE_OPTION,
OPERATION_OPTION, OPERATION_FILTER, OPERATION_LIST_OPTION, ADDRESS_OPTION, ADDRESS_FILTER,
ADDRESS_INFO, ADDRESS, DISK_ID, SNAPSHOT_ID, SNAPSHOT_INFO, DISK_TYPE_OPTION,
DISK_TYPE_FILTER, DISK_TYPE_LIST_OPTION, DISK_TYPE_AGGREGATED_LIST_OPTION,
MACHINE_TYPE_OPTION, MACHINE_TYPE_FILTER, MACHINE_TYPE_LIST_OPTION,
MACHINE_TYPE_AGGREGATED_LIST_OPTION, REGION_OPTION, REGION_FILTER, REGION_LIST_OPTION,
ZONE_OPTION, ZONE_FILTER, ZONE_LIST_OPTION, LICENSE_OPTION, OPERATION_OPTION,
OPERATION_FILTER, OPERATION_LIST_OPTION, ADDRESS_OPTION, ADDRESS_FILTER,
ADDRESS_LIST_OPTION, ADDRESS_AGGREGATED_LIST_OPTION};
for (Serializable obj : objects) {
Object copy = serializeAndDeserialize(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void testSetProjectId() {

@Test
public void testMatchesUrl() {
assertTrue(GlobalOperationId.matchesUrl(GlobalOperationId.of(PROJECT, NAME).selfLink()));
assertFalse(GlobalOperationId.matchesUrl("notMatchingUrl"));
assertTrue(SnapshotId.matchesUrl(SnapshotId.of(PROJECT, NAME).selfLink()));
assertFalse(SnapshotId.matchesUrl("notMatchingUrl"));
}

private void compareSnapshotId(SnapshotId expected, SnapshotId value) {
Expand Down

0 comments on commit f968d38

Please sign in to comment.