Skip to content

Commit df359b6

Browse files
committed
SDK-372 - Fix failing unit tests
1 parent 2ce138a commit df359b6

File tree

5 files changed

+42
-33
lines changed

5 files changed

+42
-33
lines changed

integration-tests/src/test/java/org/openmrs/maven/plugins/BuildDistroIT.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,32 +193,31 @@ public void testBuildDistroWithSpaArtifacts() throws Exception {
193193

194194
@Test
195195
public void testBuildDistroWithContentPackage() throws Exception {
196+
setupContentPackage("testpackage2");
196197
includeDistroPropertiesFile("openmrs-distro-content-package.properties");
197198
addTaskParam("dir", "target");
198199
addTaskParam("ignorePeerDependencies", "false");
199200
executeTask("build-distro");
200201
assertFilePresent( "target", "web", "openmrs_core", "openmrs.war");
201-
assertFilePresent("target", "web", "openmrs_config", "conceptclasses", "hiv", "conceptclasses.csv");
202-
assertFilePresent("target", "web", "openmrs_config", "conceptsources", "hiv", "conceptsources.csv");
203-
assertFilePresent("target", "web", "openmrs_config", "encountertypes", "hiv", "encountertypes.csv");
202+
assertFilePresent("target", "web", "openmrs_config", "globalproperties", "testpackage2", "gp.xml");
203+
assertFilePresent("target", "web", "openmrs_config", "patientidentifiertypes", "testpackage2", "patientidentifiertypes.csv");
204204
}
205205

206206
@Test
207207
public void testBuildDistroWithWithContentPackageWithNoNamespace() throws Exception {
208+
setupContentPackage("testpackage2");
208209
includeDistroPropertiesFile("openmrs-distro-content-package-no-namespace.properties");
209210
addTaskParam("dir", "target");
210211
addTaskParam("ignorePeerDependencies", "false");
211212
executeTask("build-distro");
212213
assertFilePresent( "target", "web", "openmrs_core", "openmrs.war");
213-
assertFilePresent("target", "web", "openmrs_config", "conceptclasses", "conceptclasses.csv");
214-
assertFilePresent("target", "web", "openmrs_config", "conceptsources", "conceptsources.csv");
215-
assertFilePresent("target", "web", "openmrs_config", "encountertypes", "encountertypes.csv");
214+
assertFilePresent("target", "web", "openmrs_config", "globalproperties", "gp.xml");
215+
assertFilePresent("target", "web", "openmrs_config", "patientidentifiertypes", "patientidentifiertypes.csv");
216216
}
217217

218218
@Test
219219
public void testBuildDistroWithMissingContentDependencies() throws Exception {
220220
setupContentPackage("testpackage1");
221-
222221
includeDistroPropertiesFile("openmrs-distro-content-package-missing-dependencies.properties");
223222
addTaskParam("dir", "distro");
224223
addTaskParam("ignorePeerDependencies", "false");

integration-tests/src/test/java/org/openmrs/maven/plugins/DeployIT.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,32 +172,32 @@ public void deploy_shouldUpgradeDistroWithConfigPackage() throws Exception {
172172

173173
@Test
174174
public void deploy_shouldUpgradeDistroWithContentPackage() throws Exception {
175+
setupContentPackage("testpackage2");
175176
testServerId = setupTestServer("referenceapplication:2.2");
176177
includeDistroPropertiesFile("openmrs-distro-content-package.properties");
177178
addAnswer(testServerId);
178179
addAnswer("y");
179180
addAnswer("y");
180181
executeTask("deploy");
181182
assertSuccess();
182-
assertFilePresent(testServerId, "configuration", "conceptclasses", "hiv", "conceptclasses.csv");
183-
assertFilePresent(testServerId, "configuration", "conceptsources", "hiv", "conceptsources.csv");
184-
assertFilePresent(testServerId, "configuration", "encountertypes", "hiv", "encountertypes.csv");
185-
assertLogContains("+ Adds content package hiv 1.0.0");
183+
assertFilePresent(testServerId, "configuration", "globalproperties", "testpackage2", "gp.xml");
184+
assertFilePresent(testServerId, "configuration", "patientidentifiertypes", "testpackage2", "patientidentifiertypes.csv");
185+
assertLogContains("+ Adds content package testpackage2 1.0.0");
186186
}
187187

188188
@Test
189189
public void deploy_shouldUpgradeDistroWithContentPackageWithoutNamespace() throws Exception {
190+
setupContentPackage("testpackage2");
190191
testServerId = setupTestServer("referenceapplication:2.2");
191192
includeDistroPropertiesFile("openmrs-distro-content-package-no-namespace.properties");
192193
addAnswer(testServerId);
193194
addAnswer("y");
194195
addAnswer("y");
195196
executeTask("deploy");
196197
assertSuccess();
197-
assertFilePresent(testServerId, "configuration", "conceptclasses", "conceptclasses.csv");
198-
assertFilePresent(testServerId, "configuration", "conceptsources", "conceptsources.csv");
199-
assertFilePresent(testServerId, "configuration", "encountertypes", "encountertypes.csv");
200-
assertLogContains("+ Adds content package hiv 1.0.0");
198+
assertFilePresent(testServerId, "configuration", "globalproperties", "gp.xml");
199+
assertFilePresent(testServerId, "configuration", "patientidentifiertypes", "patientidentifiertypes.csv");
200+
assertLogContains("+ Adds content package testpackage2 1.0.0");
201201
}
202202

203203
@Test
@@ -232,17 +232,17 @@ public void deploy_shouldReplaceConfigurationAndContentIfChanged() throws Except
232232
assertFileNotPresent(testServerId, "configuration", "addresshierarchy", "addresshierarchy-core_demo.csv");
233233
assertFileNotPresent(testServerId, "configuration", "conceptclasses", "conceptclasses-core_data.csv");
234234
assertFileNotPresent(testServerId, "configuration", "encountertypes", "encountertypes_core-demo.csv");
235-
assertFilePresent(testServerId, "configuration", "conceptclasses", "hiv", "conceptclasses.csv");
236-
assertFilePresent(testServerId, "configuration", "conceptsources", "hiv", "conceptsources.csv");
237-
assertFilePresent(testServerId, "configuration", "encountertypes", "hiv", "encountertypes.csv");
235+
assertFilePresent(testServerId, "configuration", "globalproperties", "testpackage2", "gp.xml");
236+
assertFilePresent(testServerId, "configuration", "patientidentifiertypes", "testpackage2", "patientidentifiertypes.csv");
237+
238238
assertLogContains("- Removes existing configuration");
239-
assertLogContains("+ Adds content package hiv 1.0.0");
239+
assertLogContains("+ Adds content package testpackage2 1.0.0");
240240

241241
server = Server.loadServer(testDirectoryPath.resolve(testServerId));
242242
assertNotNull(server);
243243
assertThat(server.getConfigArtifacts().size(), equalTo(0));
244244
assertThat(server.getContentPackages().size(), equalTo(1));
245-
assertThat(server.getContentPackages().get(0).getArtifactId(), equalTo("hiv"));
245+
assertThat(server.getContentPackages().get(0).getArtifactId(), equalTo("testpackage2"));
246246
}
247247

248248
@Test

integration-tests/src/test/java/org/openmrs/maven/plugins/SetupIT.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ public void setup_shouldInstallWithSpaSpecifiedAsMavenArtifacts() throws Excepti
492492

493493
@Test
494494
public void setup_shouldInstallWithContentPackage() throws Exception {
495+
setupContentPackage("testpackage2");
495496
includeDistroPropertiesFile("openmrs-distro-content-package.properties");
496497
addTaskParam("distro", testDirectory.toString() + File.separator + "openmrs-distro.properties");
497498
addMockDbSettings();
@@ -504,13 +505,13 @@ public void setup_shouldInstallWithContentPackage() throws Exception {
504505
executeTask("setup");
505506

506507
assertFilePresent( serverId, "openmrs-2.6.9.war");
507-
assertFilePresent(serverId, "configuration", "conceptclasses", "hiv", "conceptclasses.csv");
508-
assertFilePresent(serverId, "configuration", "conceptsources", "hiv", "conceptsources.csv");
509-
assertFilePresent(serverId, "configuration", "encountertypes", "hiv", "encountertypes.csv");
508+
assertFilePresent(serverId, "configuration", "globalproperties", "testpackage2", "gp.xml");
509+
assertFilePresent(serverId, "configuration", "patientidentifiertypes", "testpackage2", "patientidentifiertypes.csv");
510510
}
511511

512512
@Test
513513
public void setup_shouldInstallWithContentPackageWithNoNamespace() throws Exception {
514+
setupContentPackage("testpackage2");
514515
includeDistroPropertiesFile("openmrs-distro-content-package-no-namespace.properties");
515516
addTaskParam("distro", testDirectory.toString() + File.separator + "openmrs-distro.properties");
516517
addMockDbSettings();
@@ -523,9 +524,8 @@ public void setup_shouldInstallWithContentPackageWithNoNamespace() throws Except
523524
executeTask("setup");
524525

525526
assertFilePresent( serverId, "openmrs-2.6.9.war");
526-
assertFilePresent(serverId, "configuration", "conceptclasses", "conceptclasses.csv");
527-
assertFilePresent(serverId, "configuration", "conceptsources", "conceptsources.csv");
528-
assertFilePresent(serverId, "configuration", "encountertypes", "encountertypes.csv");
527+
assertFilePresent(serverId, "configuration", "globalproperties", "gp.xml");
528+
assertFilePresent(serverId, "configuration", "patientidentifiertypes", "patientidentifiertypes.csv");
529529
}
530530

531531
@Test
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name=Content Package Example
22
version=1.0.0
33
war.openmrs=2.6.9
4-
content.hiv.groupId=org.openmrs.content
5-
content.hiv.type=zip
6-
content.hiv=1.0.0
7-
content.hiv.namespace=
4+
omod.fhir2=1.8.0
5+
omod.webservices.rest=2.42.0
6+
omod.initializer=2.5.2
7+
content.testpackage2.groupId=org.openmrs.maven.sdk.test
8+
content.testpackage2.type=zip
9+
content.testpackage2=1.0.0
10+
content.testpackage2.namespace=
11+
var.concept.height.uuid=height-uuid
12+
var.concept.weight.uuid=weight-uuid
813
db.h2.supported=true
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name=Content Package Example
22
version=1.0.0
33
war.openmrs=2.6.9
4-
content.hiv.groupId=org.openmrs.content
5-
content.hiv.type=zip
6-
content.hiv=1.0.0
4+
omod.fhir2=1.8.0
5+
omod.webservices.rest=2.42.0
6+
omod.initializer=2.5.2
7+
content.testpackage2.groupId=org.openmrs.maven.sdk.test
8+
content.testpackage2.type=zip
9+
content.testpackage2=1.0.0
10+
var.concept.height.uuid=height-uuid
11+
var.concept.weight.uuid=weight-uuid
712
db.h2.supported=true

0 commit comments

Comments
 (0)