forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestUtils.java
More file actions
26 lines (21 loc) · 747 Bytes
/
Copy pathTestUtils.java
File metadata and controls
26 lines (21 loc) · 747 Bytes
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
package com.github.dockerjava.utils;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.core.RemoteApiVersion;
/**
* @author Kanstantsin Shautsou
*/
public class TestUtils {
private TestUtils() {
}
public static RemoteApiVersion getVersion(DockerClient client) {
final String serverVersion = client.versionCmd().exec().getApiVersion();
return RemoteApiVersion.parseConfig(serverVersion);
}
public static boolean isSwarm(DockerClient client) {
final String serverVersion = client.versionCmd().exec().getVersion();
return serverVersion.startsWith("swarm/");
}
public static boolean isNotSwarm(DockerClient client) {
return !isSwarm(client);
}
}