Skip to content

Commit de9f326

Browse files
Hendrik-HKostyaSha
authored andcommitted
Mirrors is list and not a single String.
1 parent 253f6d2 commit de9f326

File tree

3 files changed

+326
-3
lines changed

3 files changed

+326
-3
lines changed

src/main/java/com/github/dockerjava/api/model/InfoRegistryConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public int hashCode() {
9696
@JsonIgnoreProperties(ignoreUnknown = true)
9797
public static final class IndexConfig {
9898
@JsonProperty("Mirrors")
99-
private String mirrors;
99+
private List<String> mirrors;
100100

101101
@JsonProperty("Name")
102102
private String name;
@@ -111,14 +111,14 @@ public static final class IndexConfig {
111111
* @see #mirrors
112112
*/
113113
@CheckForNull
114-
public String getMirrors() {
114+
public List<String> getMirrors() {
115115
return mirrors;
116116
}
117117

118118
/**
119119
* @see #mirrors
120120
*/
121-
public IndexConfig withMirrors(String mirrors) {
121+
public IndexConfig withMirrors(List<String> mirrors) {
122122
this.mirrors = mirrors;
123123
return this;
124124
}

src/test/java/com/github/dockerjava/api/model/InfoTest.java

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.testng.annotations.Test;
88

99
import java.io.IOException;
10+
import java.util.Collections;
1011
import java.util.LinkedHashMap;
1112
import java.util.List;
1213
import java.util.Map;
@@ -169,4 +170,161 @@ public void serder1Json() throws IOException {
169170

170171
assertThat(info, is(withInfo));
171172
}
173+
174+
@Test
175+
public void serder2Json() throws IOException {
176+
final ObjectMapper mapper = new ObjectMapper();
177+
final JavaType type = mapper.getTypeFactory().constructType(Info.class);
178+
179+
final Info info = testRoundTrip(VERSION_1_22,
180+
"info/2.json",
181+
type
182+
);
183+
184+
final List<List<String>> driverStatus = asList(
185+
asList("Pool Name", "docker-253:2-17567992-pool"),
186+
asList("Pool Blocksize", "65.54 kB"),
187+
asList("Base Device Size", "107.4 GB"),
188+
asList("Backing Filesystem", "ext4"),
189+
asList("Data file", "/dev/loop0"),
190+
asList("Metadata file", "/dev/loop1"),
191+
asList("Data Space Used", "3.89 GB"),
192+
asList("Data Space Total", "107.4 GB"),
193+
asList("Data Space Available", "103.5 GB"),
194+
asList("Metadata Space Used", "5.46 MB"),
195+
asList("Metadata Space Total", "2.147 GB"),
196+
asList("Metadata Space Available", "2.142 GB"),
197+
asList("Udev Sync Supported", "true"),
198+
asList("Deferred Removal Enabled", "false"),
199+
asList("Deferred Deletion Enabled", "false"),
200+
asList("Deferred Deleted Device Count", "0"),
201+
asList("Data loop file", "/var/lib/docker/devicemapper/devicemapper/data"),
202+
asList("Metadata loop file", "/var/lib/docker/devicemapper/devicemapper/metadata"),
203+
asList("Library Version", "1.02.107-RHEL7 (2015-12-01)")
204+
);
205+
206+
final Map<String, List<String>> plugins = new LinkedHashMap<>();
207+
plugins.put("Volume", singletonList("local"));
208+
plugins.put("Network", asList("null", "host", "bridge"));
209+
plugins.put("Authorization", null);
210+
211+
assertThat(info, notNullValue());
212+
assertThat(info.getArchitecture(), equalTo("x86_64"));
213+
assertThat(info.getContainersStopped(), is(2));
214+
assertThat(info.getContainersPaused(), is(0));
215+
assertThat(info.getContainersRunning(), is(0));
216+
assertThat(info.getCpuCfsPeriod(), is(true));
217+
218+
// not available in this dump
219+
assertThat(info.getCpuCfsQuota(), is(true));
220+
assertThat(info.getDiscoveryBackend(), nullValue());
221+
assertThat(info.getOomScoreAdj(), nullValue());
222+
223+
assertThat(info.getDriverStatuses(), notNullValue());
224+
assertThat(info.getDriverStatuses(), hasSize(19));
225+
assertThat(info.getDriverStatuses(), equalTo(driverStatus));
226+
227+
assertThat(info.getNGoroutines(), is(30));
228+
229+
assertThat(info.getSystemStatus(), CoreMatchers.nullValue());
230+
231+
assertThat(info.getPlugins(), equalTo(plugins));
232+
assertThat(info.getPlugins(), hasEntry("Volume", singletonList("local")));
233+
assertThat(info.getPlugins(), hasEntry("Authorization", null));
234+
235+
assertThat(info.getExperimentalBuild(), is(false));
236+
237+
assertThat(info.getHttpProxy(), isEmptyString());
238+
assertThat(info.getHttpsProxy(), isEmptyString());
239+
assertThat(info.getNoProxy(), isEmptyString());
240+
assertThat(info.getOomKillDisable(), is(true));
241+
assertThat(info.getOsType(), equalTo("linux"));
242+
243+
final InfoRegistryConfig registryConfig = info.getRegistryConfig();
244+
assertThat(registryConfig, notNullValue());
245+
final List<String> cidRs = registryConfig.getInsecureRegistryCIDRs();
246+
assertThat(cidRs, notNullValue());
247+
assertThat(cidRs, contains("127.0.0.0/8"));
248+
249+
final Map<String, IndexConfig> indexConfigs = registryConfig.getIndexConfigs();
250+
assertThat(indexConfigs, notNullValue());
251+
final IndexConfig indexConfig = new IndexConfig().withMirrors(null).withName("docker.io")
252+
.withSecure(true).withOfficial(true);
253+
assertThat(indexConfigs, hasEntry("docker.io", indexConfig));
254+
final IndexConfig indexConfig2 = new IndexConfig().withMirrors(Collections.<String>emptyList()).withName("somehost:80")
255+
.withSecure(false).withOfficial(false);
256+
assertThat(indexConfigs, hasEntry("somehost:80", indexConfig2));
257+
assertThat(registryConfig.getMirrors(), nullValue());
258+
259+
assertThat(info.getSystemTime(), is("2016-03-20T17:32:06.598846244+01:00"));
260+
assertThat(info.getServerVersion(), is("1.10.2"));
261+
262+
assertThat(info.getCpuSet(), is(true));
263+
assertThat(info.getCpuShares(), is(true));
264+
assertThat(info.getIPv4Forwarding(), is(true));
265+
assertThat(info.getBridgeNfIptables(), is(false));
266+
assertThat(info.getBridgeNfIp6tables(), is(false));
267+
assertThat(info.getDebug(), is(false));
268+
assertThat(info.getNFd(), is(13));
269+
assertThat(info.getOomKillDisable(), is(true));
270+
assertThat(info.getLoggingDriver(), is("json-file"));
271+
assertThat(info.getOperatingSystem(), is("Red Hat Enterprise Linux Workstation 7.2 (Maipo)"));
272+
assertThat(info.getClusterStore(), is(""));
273+
274+
275+
final Info withInfo = new Info().withArchitecture("x86_64")
276+
.withContainers(2)
277+
.withContainersRunning(0)
278+
.withContainersPaused(0)
279+
.withContainersStopped(2)
280+
.withImages(55)
281+
.withId("H52J:52LG:YP4W:EHKY:SRK5:RYG6:ETWR:7AR3:MTFJ:PC6C:4YF2:NTN2")
282+
.withDriver("devicemapper")
283+
.withDriverStatuses(driverStatus)
284+
.withSystemStatus(null)
285+
.withPlugins(plugins)
286+
.withMemoryLimit(true)
287+
.withSwapLimit(true)
288+
.withCpuCfsPeriod(true)
289+
.withCpuCfsQuota(true)
290+
.withCpuShares(true)
291+
.withCpuSet(true)
292+
.withIPv4Forwarding(true)
293+
.withBridgeNfIptables(false)
294+
.withBridgeNfIp6tables(false)
295+
.withDebug(false)
296+
.withNFd(13)
297+
.withOomKillDisable(true)
298+
.withNGoroutines(30)
299+
.withSystemTime("2016-03-20T17:32:06.598846244+01:00")
300+
.withExecutionDriver("native-0.2")
301+
.withLoggingDriver("json-file")
302+
.withNEventsListener(0)
303+
.withKernelVersion("3.10.0-327.10.1.el7.x86_64")
304+
.withOperatingSystem("Red Hat Enterprise Linux Workstation 7.2 (Maipo)")
305+
.withOsType("linux")
306+
.withIndexServerAddress("https://index.docker.io/v1/")
307+
.withRegistryConfig(registryConfig)
308+
.withInitSha1("672d65f3cf8816fbda421afeed7e52c0ca17d5e7")
309+
.withInitPath("/usr/libexec/docker/dockerinit")
310+
.withNCPU(8)
311+
.withMemTotal(33350918144L)
312+
.withDockerRootDir("/var/lib/docker")
313+
.withHttpProxy("")
314+
.withHttpsProxy("")
315+
.withNoProxy("")
316+
.withName("somename")
317+
.withLabels(null)
318+
.withExperimentalBuild(false)
319+
.withServerVersion("1.10.2")
320+
.withClusterStore("")
321+
.withClusterAdvertise("")
322+
//shredinger-fields
323+
.withDiscoveryBackend(null)
324+
.withOomScoreAdj(null)
325+
.withSockets(null)
326+
;
327+
328+
assertThat(info, is(withInfo));
329+
}
172330
}
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"ID":"H52J:52LG:YP4W:EHKY:SRK5:RYG6:ETWR:7AR3:MTFJ:PC6C:4YF2:NTN2",
3+
"Containers":2,
4+
"ContainersRunning":0,
5+
"ContainersPaused":0,
6+
"ContainersStopped":2,
7+
"Images":55,
8+
"Driver":"devicemapper",
9+
"DriverStatus":[
10+
[
11+
"Pool Name",
12+
"docker-253:2-17567992-pool"
13+
],
14+
[
15+
"Pool Blocksize",
16+
"65.54 kB"
17+
],
18+
[
19+
"Base Device Size",
20+
"107.4 GB"
21+
],
22+
[
23+
"Backing Filesystem",
24+
"ext4"
25+
],
26+
[
27+
"Data file",
28+
"/dev/loop0"
29+
],
30+
[
31+
"Metadata file",
32+
"/dev/loop1"
33+
],
34+
[
35+
"Data Space Used",
36+
"3.89 GB"
37+
],
38+
[
39+
"Data Space Total",
40+
"107.4 GB"
41+
],
42+
[
43+
"Data Space Available",
44+
"103.5 GB"
45+
],
46+
[
47+
"Metadata Space Used",
48+
"5.46 MB"
49+
],
50+
[
51+
"Metadata Space Total",
52+
"2.147 GB"
53+
],
54+
[
55+
"Metadata Space Available",
56+
"2.142 GB"
57+
],
58+
[
59+
"Udev Sync Supported",
60+
"true"
61+
],
62+
[
63+
"Deferred Removal Enabled",
64+
"false"
65+
],
66+
[
67+
"Deferred Deletion Enabled",
68+
"false"
69+
],
70+
[
71+
"Deferred Deleted Device Count",
72+
"0"
73+
],
74+
[
75+
"Data loop file",
76+
"/var/lib/docker/devicemapper/devicemapper/data"
77+
],
78+
[
79+
"Metadata loop file",
80+
"/var/lib/docker/devicemapper/devicemapper/metadata"
81+
],
82+
[
83+
"Library Version",
84+
"1.02.107-RHEL7 (2015-12-01)"
85+
]
86+
],
87+
"SystemStatus":null,
88+
"Plugins":{
89+
"Volume":[
90+
"local"
91+
],
92+
"Network":[
93+
"null",
94+
"host",
95+
"bridge"
96+
],
97+
"Authorization":null
98+
},
99+
"MemoryLimit":true,
100+
"SwapLimit":true,
101+
"CpuCfsPeriod":true,
102+
"CpuCfsQuota":true,
103+
"CPUShares":true,
104+
"CPUSet":true,
105+
"IPv4Forwarding":true,
106+
"BridgeNfIptables":false,
107+
"BridgeNfIp6tables":false,
108+
"Debug":false,
109+
"NFd":13,
110+
"OomKillDisable":true,
111+
"NGoroutines":30,
112+
"SystemTime":"2016-03-20T17:32:06.598846244+01:00",
113+
"ExecutionDriver":"native-0.2",
114+
"LoggingDriver":"json-file",
115+
"NEventsListener":0,
116+
"KernelVersion":"3.10.0-327.10.1.el7.x86_64",
117+
"PkgVersion":"docker-1.10.2-6.git0f5ac89.el7.x86_64",
118+
"OperatingSystem":"Red Hat Enterprise Linux Workstation 7.2 (Maipo)",
119+
"OSType":"linux",
120+
"Architecture":"x86_64",
121+
"IndexServerAddress":"https://index.docker.io/v1/",
122+
"IndexServerName":"docker.io",
123+
"RegistryConfig":{
124+
"InsecureRegistryCIDRs":[
125+
"127.0.0.0/8"
126+
],
127+
"IndexConfigs":{
128+
"docker.io":{
129+
"Name":"docker.io",
130+
"Mirrors":null,
131+
"Secure":true,
132+
"Official":true
133+
},
134+
"somehost:80":{
135+
"Name":"somehost:80",
136+
"Mirrors":[
137+
138+
],
139+
"Secure":false,
140+
"Official":false
141+
}
142+
},
143+
"Mirrors":null
144+
},
145+
"InitSha1":"672d65f3cf8816fbda421afeed7e52c0ca17d5e7",
146+
"InitPath":"/usr/libexec/docker/dockerinit",
147+
"NCPU":8,
148+
"MemTotal":33350918144,
149+
"DockerRootDir":"/var/lib/docker",
150+
"HttpProxy":"",
151+
"HttpsProxy":"",
152+
"NoProxy":"",
153+
"Name":"somename",
154+
"Labels":null,
155+
"ExperimentalBuild":false,
156+
"ServerVersion":"1.10.2",
157+
"ClusterStore":"",
158+
"ClusterAdvertise":"",
159+
"Registries":[
160+
{
161+
"Name":"docker.io",
162+
"Secure":true
163+
}
164+
]
165+
}

0 commit comments

Comments
 (0)