Skip to content

Commit b1a5fe5

Browse files
committed
add test
1 parent bef27de commit b1a5fe5

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.cloudfoundry.operations.applications;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
5+
import java.io.IOException;
6+
import java.nio.file.Files;
7+
import java.nio.file.Path;
8+
import org.junit.jupiter.api.Test;
9+
10+
class ApplicationManifestUtilsV3Test {
11+
@Test
12+
void testGenericApplication() throws IOException {
13+
ManifestV3 manifest =
14+
ManifestV3.builder()
15+
.application(
16+
ManifestV3Application.builder()
17+
.name("test-app")
18+
.buildpack("test-buildpack")
19+
.command("test-command")
20+
.disk(512)
21+
.healthCheckHttpEndpoint("test-health-check-http-endpoint")
22+
.instances(2)
23+
.memory(512)
24+
.randomRoute(true)
25+
.stack("test-stack")
26+
.timeout(120)
27+
.environmentVariable("TEST_KEY_1", "test-value-1")
28+
.service(
29+
ManifestV3Service.builder()
30+
.name("test-service-1")
31+
.build())
32+
.build())
33+
.build();
34+
35+
assertSerializeDeserialize(manifest);
36+
}
37+
38+
@Test
39+
void testWithDockerApp() throws IOException {
40+
ManifestV3 manifest =
41+
ManifestV3.builder()
42+
.application(
43+
ManifestV3Application.builder()
44+
.name("test-app")
45+
.docker(Docker.builder().image("test-image").build())
46+
.build())
47+
.build();
48+
49+
assertSerializeDeserialize(manifest);
50+
}
51+
52+
private void assertSerializeDeserialize(ManifestV3 manifest) throws IOException {
53+
Path file = Files.createTempFile("test-manifest-", ".yml");
54+
ApplicationManifestUtilsV3.write(file, manifest);
55+
ManifestV3 read = ApplicationManifestUtilsV3.read(file);
56+
57+
assertEquals(manifest, read);
58+
}
59+
}

0 commit comments

Comments
 (0)