1
1
package com .redhat .labs .omp ;
2
2
3
- import javax .inject .Inject ;
4
-
5
- import org .infinispan .server .hotrod .HotRodServer ;
6
- import org .junit .jupiter .api .AfterAll ;
7
- import org .junit .jupiter .api .Assertions ;
8
- import org .junit .jupiter .api .BeforeAll ;
9
- import org .junit .jupiter .api .Test ;
10
-
11
- import com .redhat .labs .omp .mocks .MockHotRodServer ;
12
- import com .redhat .labs .omp .models .Engagement ;
13
- import com .redhat .labs .omp .models .gitlab .response .GetMultipleFilesResponse ;
14
- import com .redhat .labs .omp .utils .TemplateCombobulator ;
15
-
16
3
import io .quarkus .test .junit .QuarkusTest ;
17
4
18
5
@ QuarkusTest
19
6
public class TemplateCombobulatorTest {
20
- private static HotRodServer hs ;
21
-
22
- @ Inject
23
- TemplateCombobulator templateCombobulator ;
24
-
25
- @ BeforeAll
26
- public static void init () {
27
- hs = MockHotRodServer .getHotRod ();
28
- }
29
-
30
- @ AfterAll
31
- public static void stop () {
32
- hs .stop ();
33
- }
34
-
35
- @ Test
36
- void processTemplate () {
37
- Engagement eng = new Engagement ();
38
- eng .id = 1 ;
39
- eng .archiveDate = "20201225" ;
40
- eng .startDate = "20200101" ;
41
- eng .endDate = "20200404" ;
42
- eng .
customerContactEmail =
"[email protected] " ;
43
- eng .customerContactName = "mickey-mouse" ;
44
- eng .customerName = "Santa" ;
45
- eng .description = "North Pole Inventroy" ;
46
- eng .
engagementLeadEmail =
"[email protected] " ;
47
- eng .
engagementLeadEmail =
"[email protected] " ;
48
- eng .location = "Magic Kingdom" ;
49
- eng .ocpCloudProviderName = "GCP" ;
50
- eng .ocpCloudProviderRegion = "west" ;
51
- eng .ocpClusterSize = "medium" ;
52
- eng .ocpPersistentStorageSize = "50TB" ;
53
- eng .ocpSubDomain = "claws" ;
54
- eng .ocpVersion = "1.0.0" ;
55
- eng .projectName = "Gift gifts" ;
56
- eng .
technicalLeadEmail =
"[email protected] " ;
57
- eng .technicalLeadName = "Mitch" ;
58
- GetMultipleFilesResponse processedFiles = templateCombobulator .process (eng );
59
-
60
- String expected = "---\n " +
61
- "\n " +
62
- "residency:\n " +
63
- " id: \" 1\" \n " +
64
- " customer_name: \" Santa\" \n " +
65
- " project_name: \" Gift gifts\" \n " +
66
- " description: \" North Pole Inventroy\" \n " +
67
- " location: \" Magic Kingdom\" \n " +
68
- " start_date: \" 20200101\" \n " +
69
- " end_date: \" 20200404\" \n " +
70
- " archive_date: \" 20201225\" \n " +
71
- " contacts:\n " +
72
- " engagement_lead:\n " +
73
- " name: \" \" \n " +
74
- " email: \" [email protected] \" \n " +
75
- " technical_lead:\n " +
76
- " name: \" Mitch\" \n " +
77
- " email: \" [email protected] \" \n " +
78
- " customer_contact:\n " +
79
- " name: \" mickey-mouse\" \n " +
80
- " email: \" [email protected] \" \n " +
81
- " openshift_cluster:\n " +
82
- " cloud_provider:\n " +
83
- " name: \" GCP\" \n " +
84
- " region: \" west\" \n " +
85
- " version: \" 1.0.0\" \n " +
86
- " sub_domain: \" claws\" \n " +
87
- " persistent_storage_size: \" 50TB\" \n " +
88
- " cluster_size: \" medium\" \n " ;
89
-
90
- String content = processedFiles .files .get (0 ).getFileContent ();
91
-
92
- Assertions .assertEquals (expected , content );
93
- // 🤠 Dirty hack to get the first index of the files array 🤠
94
- Assertions .assertTrue (content .contains ("mickey-mouse" ));
95
- Assertions .
assertTrue (
content .
contains (
"[email protected] " ));
96
- Assertions .assertTrue (content .contains ("Magic Kingdom" ));
97
- }
7
+ // private static HotRodServer hs;
8
+ //
9
+ // @Inject
10
+ // TemplateCombobulator templateCombobulator;
11
+ //
12
+ // @BeforeAll
13
+ // public static void init() {
14
+ // hs = MockHotRodServer.getHotRod();
15
+ // }
16
+ //
17
+ // @AfterAll
18
+ // public static void stop() {
19
+ // hs.stop();
20
+ // }
21
+ //
22
+ // @Test
23
+ // void processTemplate() {
24
+ // Engagement eng = new Engagement();
25
+ // eng.id = 1;
26
+ // eng.archiveDate = "20201225";
27
+ // eng.startDate = "20200101";
28
+ // eng.endDate = "20200404";
29
+ // eng.customerContactEmail = "[email protected] ";
30
+ // eng.customerContactName = "mickey-mouse";
31
+ // eng.customerName = "Santa";
32
+ // eng.description = "North Pole Inventroy";
33
+ // eng.engagementLeadEmail = "[email protected] ";
34
+ // eng.engagementLeadEmail = "[email protected] ";
35
+ // eng.location = "Magic Kingdom";
36
+ // eng.ocpCloudProviderName = "GCP";
37
+ // eng.ocpCloudProviderRegion = "west";
38
+ // eng.ocpClusterSize = "medium";
39
+ // eng.ocpPersistentStorageSize = "50TB";
40
+ // eng.ocpSubDomain = "claws";
41
+ // eng.ocpVersion = "1.0.0";
42
+ // eng.projectName = "Gift gifts";
43
+ // eng.technicalLeadEmail = "[email protected] ";
44
+ // eng.technicalLeadName = "Mitch";
45
+ // GetMultipleFilesResponse processedFiles = templateCombobulator.process(eng);
46
+ //
47
+ // String expected = "---\n" +
48
+ // "\n" +
49
+ // "residency:\n" +
50
+ // " id: \"1\"\n" +
51
+ // " customer_name: \"Santa\"\n" +
52
+ // " project_name: \"Gift gifts\"\n" +
53
+ // " description: \"North Pole Inventroy\"\n" +
54
+ // " location: \"Magic Kingdom\"\n" +
55
+ // " start_date: \"20200101\"\n" +
56
+ // " end_date: \"20200404\"\n" +
57
+ // " archive_date: \"20201225\"\n" +
58
+ // " contacts:\n" +
59
+ // " engagement_lead:\n" +
60
+ // " name: \"\"\n" +
61
+ // " email: \"[email protected] \"\n" +
62
+ // " technical_lead:\n" +
63
+ // " name: \"Mitch\"\n" +
64
+ // " email: \"[email protected] \"\n" +
65
+ // " customer_contact:\n" +
66
+ // " name: \"mickey-mouse\"\n" +
67
+ // " email: \"[email protected] \"\n" +
68
+ // " openshift_cluster:\n" +
69
+ // " cloud_provider:\n" +
70
+ // " name: \"GCP\"\n" +
71
+ // " region: \"west\"\n" +
72
+ // " version: \"1.0.0\"\n" +
73
+ // " sub_domain: \"claws\"\n" +
74
+ // " persistent_storage_size: \"50TB\"\n" +
75
+ // " cluster_size: \"medium\"\n";
76
+ //
77
+ // String content = processedFiles.files.get(0).getFileContent();
78
+ //
79
+ // Assertions.assertEquals(expected, content);
80
+ // // 🤠 Dirty hack to get the first index of the files array 🤠
81
+ // Assertions.assertTrue(content.contains("mickey-mouse"));
82
+ // Assertions.assertTrue(content.contains("[email protected] "));
83
+ // Assertions.assertTrue(content.contains("Magic Kingdom"));
84
+ // }
98
85
}
0 commit comments