forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIdentifierTest.java
More file actions
42 lines (30 loc) · 1.48 KB
/
Copy pathIdentifierTest.java
File metadata and controls
42 lines (30 loc) · 1.48 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
package com.github.dockerjava.api.model;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
public class IdentifierTest {
@Test
public void testFromCompoundString() throws Exception {
Identifier i1 = Identifier.fromCompoundString("10.0.0.1/jim");
Identifier i2 = Identifier.fromCompoundString("10.0.0.1/jim:123");
Identifier i3 = Identifier.fromCompoundString("10.0.0.1:123/jim:124");
Identifier i3A = Identifier.fromCompoundString("10.0.0.1:123/jim:latest");
assertTrue(!i1.tag.isPresent());
assertEquals(i1.repository.name, "10.0.0.1/jim");
assertTrue(i2.tag.isPresent());
assertEquals(i2.tag.get(), "123");
assertEquals(i2.repository.name, "10.0.0.1/jim");
assertTrue(i3.tag.isPresent());
assertEquals(i3.tag.get(), "124");
assertEquals(i3.repository.name, "10.0.0.1:123/jim");
assertEquals(i3.repository.getURL().getPort(), 123);
assertEquals(i3A.tag.get(), "latest");
Identifier i4 = Identifier.fromCompoundString("centos:latest");
assertTrue(i4.tag.isPresent());
assertEquals(i4.tag.get(), "latest");
Identifier i5 = Identifier.fromCompoundString("busybox");
assertTrue(!i5.tag.isPresent());
Identifier i6 = Identifier.fromCompoundString("10.0.0.1:5000/my-test-image:1234");
assertEquals(i6.repository.getPath(), "my-test-image");
}
}