Skip to content

Commit 9b75542

Browse files
committed
conga-aem-maven-plugin: Generate unique package names for all packages depending on run modes.
1 parent 7f3a6a0 commit 9b75542

1 file changed

Lines changed: 33 additions & 23 deletions

File tree

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/AllPackageBuilderTest.java

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ void testBuild(Set<String> cloudManagerTarget, List<String> runmodeSuffixes) thr
9393
for (String runmodeSuffix : runmodeSuffixes) {
9494
File applicationInstallDir = new File(applicationDir, "install" + runmodeSuffix);
9595
assertFiles(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip");
96-
assertPackageName(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
97-
"aem-cms-system-config" + runmodeSuffix);
98-
assertDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
96+
assertNameDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
97+
"aem-cms-system-config" + runmodeSuffix,
9998
"day/cq60/product:cq-ui-wcm-editor-content:1.1.224",
10099
"adobe/cq/product:cq-remotedam-client-ui-components:1.1.6");
101100
}
@@ -107,8 +106,10 @@ void testBuild(Set<String> cloudManagerTarget, List<String> runmodeSuffixes) thr
107106
File contentInstallDir = new File(contentDir, "install" + runmodeSuffix);
108107
assertFiles(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
109108
"wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
110-
assertDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip");
111-
assertDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
109+
assertNameDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
110+
"aem-cms-author-replicationagents" + runmodeSuffix);
111+
assertNameDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
112+
"wcm-io-samples-sample-content" + runmodeSuffix);
112113
}
113114

114115
File containerDir = new File(appsDir, "container");
@@ -118,8 +119,10 @@ void testBuild(Set<String> cloudManagerTarget, List<String> runmodeSuffixes) thr
118119
File containerInstallDir = new File(containerDir, "install" + runmodeSuffix);
119120
assertFiles(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
120121
"wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
121-
assertDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip");
122-
assertDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
122+
assertNameDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
123+
"wcm-io-samples-aem-cms-config" + runmodeSuffix);
124+
assertNameDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
125+
"wcm-io-samples-complete" + runmodeSuffix);
123126
}
124127
}
125128

@@ -144,7 +147,8 @@ void testBuildWithAutoDependencies(Set<String> cloudManagerTarget, List<String>
144147
for (String runmodeSuffix : runmodeSuffixes) {
145148
File applicationInstallDir = new File(applicationDir, "install" + runmodeSuffix);
146149
assertFiles(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip");
147-
assertDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
150+
assertNameDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
151+
"aem-cms-system-config" + runmodeSuffix,
148152
"day/cq60/product:cq-ui-wcm-editor-content:1.1.224",
149153
"adobe/cq/product:cq-remotedam-client-ui-components:1.1.6",
150154
"wcm-io-samples:aem-cms-author-replicationagents" + runmodeSuffix + ":1.3.1-SNAPSHOT");
@@ -157,8 +161,10 @@ void testBuildWithAutoDependencies(Set<String> cloudManagerTarget, List<String>
157161
File contentInstallDir = new File(contentDir, "install" + runmodeSuffix);
158162
assertFiles(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
159163
"wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
160-
assertDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip");
161-
assertDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
164+
assertNameDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
165+
"aem-cms-author-replicationagents" + runmodeSuffix);
166+
assertNameDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
167+
"wcm-io-samples-sample-content" + runmodeSuffix,
162168
"wcm-io-samples:wcm-io-samples-complete" + runmodeSuffix + ":1.3.1-SNAPSHOT");
163169
}
164170

@@ -169,9 +175,11 @@ void testBuildWithAutoDependencies(Set<String> cloudManagerTarget, List<String>
169175
File containerInstallDir = new File(containerDir, "install" + runmodeSuffix);
170176
assertFiles(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
171177
"wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
172-
assertDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
178+
assertNameDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
179+
"wcm-io-samples-aem-cms-config" + runmodeSuffix,
173180
"wcm-io-samples:aem-cms-system-config" + runmodeSuffix + ":1.3.1-SNAPSHOT");
174-
assertDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
181+
assertNameDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
182+
"wcm-io-samples-complete" + runmodeSuffix,
175183
"wcm-io-samples:wcm-io-samples-aem-cms-config" + runmodeSuffix + ":1.3.1-SNAPSHOT");
176184
}
177185
}
@@ -198,7 +206,8 @@ void testBuildWithAutoDependenciesSeparateMutable(Set<String> cloudManagerTarget
198206
for (String runmodeSuffix : runmodeSuffixes) {
199207
File applicationInstallDir = new File(applicationDir, "install" + runmodeSuffix);
200208
assertFiles(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip");
201-
assertDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
209+
assertNameDependencies(applicationInstallDir, "aem-cms-system-config" + runmodeSuffix + ".zip",
210+
"aem-cms-system-config" + runmodeSuffix,
202211
"day/cq60/product:cq-ui-wcm-editor-content:1.1.224",
203212
"adobe/cq/product:cq-remotedam-client-ui-components:1.1.6");
204213
}
@@ -210,8 +219,10 @@ void testBuildWithAutoDependenciesSeparateMutable(Set<String> cloudManagerTarget
210219
File contentInstallDir = new File(contentDir, "install" + runmodeSuffix);
211220
assertFiles(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
212221
"wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
213-
assertDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip");
214-
assertDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
222+
assertNameDependencies(contentInstallDir, "aem-cms-author-replicationagents" + runmodeSuffix + ".zip",
223+
"aem-cms-author-replicationagents" + runmodeSuffix);
224+
assertNameDependencies(contentInstallDir, "wcm-io-samples-sample-content" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
225+
"wcm-io-samples-sample-content" + runmodeSuffix,
215226
"wcm-io-samples:aem-cms-author-replicationagents" + runmodeSuffix + ":1.3.1-SNAPSHOT");
216227
}
217228

@@ -222,9 +233,11 @@ void testBuildWithAutoDependenciesSeparateMutable(Set<String> cloudManagerTarget
222233
File containerInstallDir = new File(containerDir, "install" + runmodeSuffix);
223234
assertFiles(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
224235
"wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip");
225-
assertDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
236+
assertNameDependencies(containerInstallDir, "wcm-io-samples-aem-cms-config" + runmodeSuffix + ".zip",
237+
"wcm-io-samples-aem-cms-config" + runmodeSuffix,
226238
"wcm-io-samples:aem-cms-system-config" + runmodeSuffix + ":1.3.1-SNAPSHOT");
227-
assertDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
239+
assertNameDependencies(containerInstallDir, "wcm-io-samples-complete" + runmodeSuffix + "-1.3.1-SNAPSHOT.zip",
240+
"wcm-io-samples-complete" + runmodeSuffix,
228241
"wcm-io-samples:wcm-io-samples-aem-cms-config" + runmodeSuffix + ":1.3.1-SNAPSHOT");
229242
}
230243
}
@@ -238,15 +251,12 @@ private void assertFiles(File dir, String... fileNames) {
238251
assertEquals(expectedFileNames, actualFileNames, "files in " + dir.getPath());
239252
}
240253

241-
private void assertPackageName(File dir, String fileName, String name) throws Exception {
254+
private void assertNameDependencies(File dir, String fileName, String packageName,
255+
String... dependencies) throws Exception {
242256
File zipFile = new File(dir, fileName);
243257
Document filterXml = getXmlFromZip(zipFile, "META-INF/vault/properties.xml");
244-
assertXpathEvaluatesTo(name, "/properties/entry[@key='name']", filterXml);
245-
}
246258

247-
private void assertDependencies(File dir, String fileName, String... dependencies) throws Exception {
248-
File zipFile = new File(dir, fileName);
249-
Document filterXml = getXmlFromZip(zipFile, "META-INF/vault/properties.xml");
259+
assertXpathEvaluatesTo(packageName, "/properties/entry[@key='name']", filterXml);
250260

251261
String expecedDependencies = "";
252262
if (dependencies.length > 0) {

0 commit comments

Comments
 (0)