Skip to content

Commit

Permalink
SDK-344 - Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton committed Nov 8, 2024
1 parent 1e65133 commit 7c23829
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ public void assertFilePresent(String... paths) {
assertPathPresent(resolvedPath);
}

public void assertFileContains(String regex, String... paths) throws IOException {
public void assertFileContains(String text, String... paths) throws IOException {
Path resolvedPath = testDirectoryPath.toAbsolutePath();
for (String path : paths) {
resolvedPath = resolvedPath.resolve(path);
}
String jsContents = new String(Files.readAllBytes(resolvedPath), StandardCharsets.UTF_8);
assertThat(jsContents, Matchers.containsString(regex));
assertThat(jsContents, Matchers.containsString(text));
}

public void assertPathPresent(Path path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,24 @@ public void setup_shouldInstallWithParentDistroSpecifiedInDistroProperties() thr
assertFileNotPresent(serverId, "modules", "htmlformentry-3.3.0.omod");
}

@Test
public void setup_shouldInstallWithSpaSpecifiedAsMavenArtifacts() throws Exception{
addTaskParam("distro", testDirectory.toString() + File.separator + "openmrs-distro-spa-artifacts.properties");
addMockDbSettings();

String serverId = UUID.randomUUID().toString();
addAnswer(serverId);
addAnswer("1044");
addAnswer("8080");

executeTask("setup");

assertFilePresent( serverId, "openmrs-2.6.9.war");
assertModulesInstalled(serverId, "spa-2.0.0.omod");
assertFilePresent(serverId, "frontend", "index.html");
assertFileContains("@openmrs/esm-dispensing-app", serverId, "frontend", "importmap.json");
}

private String readValueFromPropertyKey(File propertiesFile, String key) throws Exception {

InputStream in = new FileInputStream(propertiesFile);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name=Spa Artifact Example
version=1.0.0-SNAPSHOT

war.openmrs=2.6.9

omod.spa=2.0.0

spa.artifactId=openmrs-frontend-zl
spa.groupId=org.pih.openmrs
spa.version=1.3.0
spa.include=openmrs-frontend-zl-1.3.0

db.h2.supported=false

0 comments on commit 7c23829

Please sign in to comment.