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