forked from googleapis/google-cloud-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerializationTest.java
More file actions
102 lines (95 loc) · 4.4 KB
/
SerializationTest.java
File metadata and controls
102 lines (95 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* 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.gcloud.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 java.io.Serializable;
import java.math.BigInteger;
import java.util.concurrent.TimeUnit;
public class SerializationTest extends BaseSerializationTest {
private static final ZoneInfo FULL_ZONE_INFO = Zone.of("some zone name", "www.example.com",
"some descriptions").toBuilder()
.creationTimeMillis(132L)
.id("123333")
.nameServers(ImmutableList.of("server 1", "server 2"))
.nameServerSet("specificationstring")
.build();
private static final ZoneInfo PARTIAL_ZONE_INFO = Zone.of("some zone name", "www.example.com",
"some descriptions").toBuilder().build();
private static final ProjectInfo PARTIAL_PROJECT_INFO = ProjectInfo.builder().id("13").build();
private static final ProjectInfo FULL_PROJECT_INFO = ProjectInfo.builder()
.id("342")
.number(new BigInteger("2343245"))
.quota(new ProjectInfo.Quota(12, 13, 14, 15, 16, 17))
.build();
private static final Dns.ZoneListOption ZONE_LIST_OPTION =
Dns.ZoneListOption.dnsName("www.example.com.");
private static final Dns.DnsRecordListOption DNS_REOCRD_LIST_OPTION =
Dns.DnsRecordListOption.fields(Dns.DnsRecordField.TTL);
private static final Dns.ChangeRequestListOption CHANGE_REQUEST_LIST_OPTION =
Dns.ChangeRequestListOption.fields(Dns.ChangeRequestField.STATUS);
private static final Dns.ZoneOption ZONE_OPTION =
Dns.ZoneOption.fields(Dns.ZoneField.CREATION_TIME);
private static final Dns.ChangeRequestOption CHANGE_REQUEST_OPTION =
Dns.ChangeRequestOption.fields(Dns.ChangeRequestField.STATUS);
private static final Dns.ProjectOption PROJECT_OPTION =
Dns.ProjectOption.fields(Dns.ProjectField.QUOTA);
private static final DnsOptions OPTIONS = DnsOptions.builder()
.projectId("some-unnecessary-project-ID")
.retryParams(RetryParams.defaultInstance())
.build();
private static final Dns DNS = OPTIONS.service();
private static final Zone FULL_ZONE = new Zone(DNS, new ZoneInfo.BuilderImpl(FULL_ZONE_INFO));
private static final Zone PARTIAL_ZONE =
new Zone(DNS, new ZoneInfo.BuilderImpl(PARTIAL_ZONE_INFO));
private static final ChangeRequest CHANGE_REQUEST_PARTIAL = ChangeRequest.builder().build();
private static final DnsRecord DNS_RECORD_PARTIAL =
DnsRecord.builder("www.www.com", DnsRecord.Type.AAAA).build();
private static final DnsRecord DNS_RECORD_COMPLETE =
DnsRecord.builder("www.sadfa.com", DnsRecord.Type.A)
.ttl(12, TimeUnit.HOURS)
.addRecord("record")
.build();
private static final ChangeRequest CHANGE_REQUEST_COMPLETE = ChangeRequest.builder()
.add(DNS_RECORD_COMPLETE)
.delete(DNS_RECORD_PARTIAL)
.status(ChangeRequest.Status.PENDING)
.id("some id")
.startTimeMillis(132L)
.build();
@Override
protected Serializable[] serializableObjects() {
DnsOptions options = DnsOptions.builder()
.authCredentials(AuthCredentials.createForAppEngine())
.projectId("id1")
.build();
DnsOptions otherOptions = options.toBuilder()
.authCredentials(null)
.build();
return new Serializable[]{FULL_ZONE_INFO, PARTIAL_ZONE_INFO, ZONE_LIST_OPTION,
DNS_REOCRD_LIST_OPTION, CHANGE_REQUEST_LIST_OPTION, ZONE_OPTION, CHANGE_REQUEST_OPTION,
PROJECT_OPTION, PARTIAL_PROJECT_INFO, FULL_PROJECT_INFO, OPTIONS, FULL_ZONE, PARTIAL_ZONE,
OPTIONS, CHANGE_REQUEST_PARTIAL, DNS_RECORD_PARTIAL, DNS_RECORD_COMPLETE,
CHANGE_REQUEST_COMPLETE, options, otherOptions};
}
@Override
protected Restorable<?>[] restorableObjects() {
return new Restorable<?>[0];
}
}