Skip to content

Commit

Permalink
Merge pull request #37 from uniba-dsg/enable-openesb-on-travis
Browse files Browse the repository at this point in the history
Enable openesb on travis
  • Loading branch information
simonharrer committed Sep 15, 2015
2 parents 640a0c8 + 5054b91 commit 2e755d0
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 64 deletions.
12 changes: 10 additions & 2 deletions src/main/groovy/betsy/bpel/engines/openesb/OpenEsb231Engine.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package betsy.bpel.engines.openesb;

import betsy.common.util.ClasspathHelper;
import betsy.common.util.OperatingSystem;

import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -17,8 +18,15 @@ public Path getXsltPath() {

@Override
public void install() {
new OpenEsbInstaller(Paths.get("server/openesb231"), "openesb-v231-installer-windows.exe",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb231/state.xml.template")).install();
if(OperatingSystem.WINDOWS) {
new OpenEsbInstaller(getServerPath(),
"openesb-v231-installer-windows.exe",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb231/state.xml.template")).install();
} else {
new OpenEsbInstaller(getServerPath(),
"openesb-v231-installer-linux.sh",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb231/state.xml.template")).install();
}
}

}
12 changes: 10 additions & 2 deletions src/main/groovy/betsy/bpel/engines/openesb/OpenEsb23Engine.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package betsy.bpel.engines.openesb;

import betsy.common.util.ClasspathHelper;
import betsy.common.util.OperatingSystem;

import java.nio.file.Path;
import java.nio.file.Paths;
Expand All @@ -17,8 +18,15 @@ public Path getXsltPath() {

@Override
public void install() {
new OpenEsbInstaller(Paths.get("server/openesb23"), "openesb-v23-installer-windows.exe",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb23/state.xml.template")).install();
if(OperatingSystem.WINDOWS) {
new OpenEsbInstaller(getServerPath(),
"openesb-v23-installer-windows.exe",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb23/state.xml.template")).install();
} else {
new OpenEsbInstaller(getServerPath(),
"openesb-v23-installer-linux.sh",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb23/state.xml.template")).install();
}
}

}
8 changes: 8 additions & 0 deletions src/main/groovy/betsy/bpel/engines/openesb/OpenEsbCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ public OpenEsbCLI(Path glassfishHome) {

public void stopDomain() {
ConsoleTasks.executeOnWindowsAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminWindows()).values("stop-domain", "domain1"));

ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getBinFolder(), "chmod").values("+x", "asadmin"));
ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminUnix()).values("stop-domain", "domain1"));
}

public void startDomain() {
ConsoleTasks.executeOnWindowsAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminWindows()).values("start-domain", "domain1"));

ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getBinFolder(), "chmod").values("+x", "asadmin"));
ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminUnix()).values("start-domain", "domain1"));
}

private Path getAsAdminWindows() {
Expand Down Expand Up @@ -50,6 +56,8 @@ public void forceRedeploy(String processName, Path packageFilePath, Path tmpFold

ConsoleTasks.executeOnWindowsAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminWindows()).
values("multimode", "--file", deployCommands.toAbsolutePath().toString()));

ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getBinFolder(), "chmod").values("+x", "asadmin"));
ConsoleTasks.executeOnUnixAndIgnoreError(ConsoleTasks.CliCommand.build(getAsAdminUnix()).
values("multimode", "--file", deployCommands.toAbsolutePath().toString()));
}
Expand Down
15 changes: 12 additions & 3 deletions src/main/groovy/betsy/bpel/engines/openesb/OpenEsbEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import betsy.common.tasks.WaitTasks;
import betsy.common.tasks.XSLTTasks;
import betsy.common.util.ClasspathHelper;
import betsy.common.util.OperatingSystem;

import java.nio.file.Path;
import java.util.LinkedList;
Expand Down Expand Up @@ -36,7 +37,7 @@ public void storeLogs(BPELProcess process) {
public List<Path> getLogs() {
List<Path> result = new LinkedList<>();

result.addAll(FileTasks.findAllInFolder(getGlassfishHome().resolve("domains/domain1/logs/")));
result.addAll(FileTasks.findAllInFolder(getGlassfishHome().resolve("domains/domain1/logs/"), "*.log"));

return result;
}
Expand All @@ -52,7 +53,7 @@ protected Path getGlassfishHome() {
@Override
public void startup() {
getCli().startDomain();
WaitTasks.waitForAvailabilityOfUrl(15_000, 500, CHECK_URL);
WaitTasks.waitForAvailabilityOfUrl(15_000, 500, "http://localhost:8383");
}

@Override
Expand All @@ -62,7 +63,15 @@ public void shutdown() {

@Override
public void install() {
new OpenEsbInstaller(getServerPath(), "glassfishesb-v2.2-full-installer-windows.exe", ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb/state.xml.template")).install();
if(OperatingSystem.WINDOWS) {
new OpenEsbInstaller(getServerPath(),
"glassfishesb-v2.2-full-installer-windows.exe",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb/state.xml.template")).install();
} else {
new OpenEsbInstaller(getServerPath(),
"glassfishesb-v2.2-full-installer-linux.sh",
ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb/state.xml.template")).install();
}
}

@Override
Expand Down
16 changes: 10 additions & 6 deletions src/main/groovy/betsy/bpel/engines/openesb/OpenEsbInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@ public void install() {
Path stateXmlPath = path.resolve("state.xml").toAbsolutePath();
FileTasks.copyFileContentsToNewFile(stateXmlTemplate, stateXmlPath);
Map<String, Object> replacements = new HashMap<>();
replacements.put("INSTALL_PATH", path.toAbsolutePath());
replacements.put("JDK_LOCATION", System.getenv().get("JAVA_HOME"));
replacements.put("HTTP_PORT", 8383);
replacements.put("HTTPS_PORT", 8384);
replacements.put("@INSTALL_PATH@", path.toAbsolutePath());
replacements.put("@JDK_LOCATION@", System.getenv().get("JAVA_HOME"));
replacements.put("@HTTP_PORT@", 8383);
replacements.put("@HTTPS_PORT@", 8384);
FileTasks.replaceTokensInFile(stateXmlPath, replacements);

Path reinstallGlassFishBatPath = path.resolve("reinstallGlassFish.bat");
FileTasks.copyFileContentsToNewFile(ClasspathHelper.getFilesystemPathFromClasspathPath("/bpel/openesb/reinstallGlassFish.bat"), reinstallGlassFishBatPath);

Path installationScript = Configuration.getDownloadsDir().resolve(fileName);
ConsoleTasks.executeOnWindowsAndIgnoreError(ConsoleTasks.CliCommand.build(reinstallGlassFishBatPath).
values(Configuration.getDownloadsDir().resolve(fileName).toString(), stateXmlPath.toString()));
values(installationScript.toString(), stateXmlPath.toString()));

ConsoleTasks.executeOnUnix(ConsoleTasks.CliCommand.build("chmod").values("+x", installationScript.toString()));
ConsoleTasks.executeOnUnix(
ConsoleTasks.CliCommand.build(path, installationScript).
values("--silent", "--state", stateXmlPath.toString()));
}


Expand Down
9 changes: 9 additions & 0 deletions src/main/groovy/betsy/common/util/OperatingSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package betsy.common.util;

public class OperatingSystem {

public static final String osName = System.getProperty("os.name", "unknown").toLowerCase();
public static final boolean WINDOWS = osName.startsWith("win");
public static final boolean NOT_WINDOWS = !WINDOWS;

}
8 changes: 4 additions & 4 deletions src/main/resources/bpel/openesb/state.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
-->
<state xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="state-file.xsd">
<components>
<product platform="windows" status="to-be-installed" uid="glassfish" version="9.1.0.31g.20080411">
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="glassfish" version="9.1.0.31g.20080411">
<properties>
<property name="password">adminadmin</property>
<property name="jmx.admin.port">8686</property>
Expand All @@ -46,7 +46,7 @@
<property name="maximum.jdk.version">1.6.99</property>
<property name="minimum.jdk.version">1.5.0</property>
<property name="jdk.location">@JDK_LOCATION@</property>
<property name="installation.location">@INSTALL_PATH@\glassfish</property>
<property name="installation.location">@INSTALL_PATH@/glassfish</property>
<property name="http.port">@HTTP_PORT@</property>
<property name="https.port">@HTTPS_PORT@</property>
<property name="preferred.jdk.version.macosx">1.5.0.13.0</property>
Expand All @@ -60,12 +60,12 @@
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="openesb" version="2.0.0.091216.0">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="jbicomponents" version="2.0.0.091216.0">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
</components>
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/bpel/openesb23/state.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
-->
<state xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="state-file.xsd">
<components>
<product platform="windows" status="to-be-installed" uid="glassfish" version="2.1.1.31g.20091027">
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="glassfish" version="2.1.1.31g.20091027">
<properties>
<property name="password">adminadmin</property>
<property name="installation.location.windows">@INSTALL_PATH@\glassfish</property>
<property name="installation.location">@INSTALL_PATH@/glassfish</property>
<property name="jmx.admin.port">8686</property>
<property name="username">admin</property>
<property name="vendor.jdk.allowed.pattern">Sun Microsystems.*|Oracle.*</property>
Expand All @@ -60,12 +60,12 @@
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="openesb-core" version="2.3.0.182.20130418184920">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="openesb-components" version="2.3.0.182.20130418221809">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
</components>
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/bpel/openesb231/state.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
holder.
--><state xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="state-file.xsd">
<components>
<product platform="windows" status="to-be-installed" uid="glassfish" version="2.1.1.31g.20091027">
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="glassfish" version="2.1.1.31g.20091027">
<properties>
<property name="password">adminadmin</property>
<property name="installation.location.windows">@INSTALL_PATH@\glassfish</property>
<property name="installation.location">@INSTALL_PATH@/glassfish</property>
<property name="jmx.admin.port">8686</property>
<property name="username">admin</property>
<property name="vendor.jdk.allowed.pattern">Sun Microsystems.*|Oracle.*</property>
Expand All @@ -57,12 +57,12 @@
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="openesb-core" version="2.3.1.27.20131115143207">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
<product platform="windows linux solaris-sparc solaris-x86 macosx-ppc macosx-x86 aix" status="to-be-installed" uid="openesb-components" version="2.3.1.30.20131119172140">
<properties>
<property name="installation.location">@INSTALL_PATH@\glassfish\addons\jbi-components</property>
<property name="installation.location">@INSTALL_PATH@/glassfish/addons/jbi-components</property>
</properties>
</product>
</components>
Expand Down
44 changes: 44 additions & 0 deletions src/test/groovy/betsy/AbstractSystemTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package betsy;

import betsy.common.tasks.FileTasks;
import org.junit.After;

import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class AbstractSystemTest {

@After
public void cleanupTestFolders() throws IOException {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get("."), "test-*")) {
for (Path path : stream) {
if (Files.isDirectory(path)) {
try {
FileTasks.deleteDirectory(path);
} catch (Exception ignored) {
// try to clean up even if it would fail
}
}
}
}
}

@After
public void cleanupEngineFolders() throws IOException {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(".").resolve("server"))) {
for (Path path : stream) {
if (Files.isDirectory(path)) {
try {
FileTasks.deleteDirectory(path);
} catch (Exception ignored) {
// try to clean up even if it would fail
}
}
}
}
}

}
16 changes: 8 additions & 8 deletions src/test/groovy/betsy/BPELSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.junit.Assert.assertEquals;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BPELSystemTest {
public class BPELSystemTest extends AbstractSystemTest{

@BeforeClass
public static void disableSoapUIShutdown() {
Expand Down Expand Up @@ -87,22 +87,22 @@ public void test_B4_BpelWso320Sequence() throws IOException, InterruptedExceptio
}

@Test
public void test_B5_BpelOpenesb301StandaloneSequence() throws IOException, InterruptedException {
public void test_B5_A_BpelOpenesb301StandaloneSequence() throws IOException, InterruptedException {
testBPELEngine("openesb301standalone");
}

@Test @Ignore("untested")
public void test_B5_BpelOpenesb23Sequence() throws IOException, InterruptedException {
@Test
public void test_B5_B2_BpelOpenesb23Sequence() throws IOException, InterruptedException {
testBPELEngine("openesb23");
}

@Test @Ignore("untested")
public void test_B5_BpelOpenesb231Sequence() throws IOException, InterruptedException {
@Test
public void test_B5__B3_BpelOpenesb231Sequence() throws IOException, InterruptedException {
testBPELEngine("openesb231");
}

@Test @Ignore("untested")
public void test_B5_BpelOpenesbSequence() throws IOException, InterruptedException {
@Test
public void test_B5__B1_BpelOpenesbSequence() throws IOException, InterruptedException {
testBPELEngine("openesb");
}

Expand Down
32 changes: 1 addition & 31 deletions src/test/groovy/betsy/BPMNSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BPMNSystemTest {
public class BPMNSystemTest extends AbstractSystemTest {

@Test
public void testBPMNEngine() throws IOException {
Expand Down Expand Up @@ -64,36 +64,6 @@ public void test_A_BpmnjBPM620SequenceFlow() throws IOException {
testBPMNEngine("jbpm620");
}

@After
public void cleanupTestFolders() throws IOException {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get("."), "test-*")) {
for (Path path : stream) {
if (Files.isDirectory(path)) {
try {
FileTasks.deleteDirectory(path);
} catch (Exception ignored) {
// try to clean up even if it would fail
}
}
}
}
}

@After
public void cleanupEngineFolders() throws IOException {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(".").resolve("server"))) {
for (Path path : stream) {
if (Files.isDirectory(path)) {
try {
FileTasks.deleteDirectory(path);
} catch (Exception ignored) {
// try to clean up even if it would fail
}
}
}
}
}

private void testBPMNEngine(String engine) throws IOException {
Main.main("bpmn", "-f", "test-" + engine, engine, "SequenceFlow");
assertEquals("[SequenceFlow;" + engine + ";basics;1;0;1;1]", Files.readAllLines(Paths.get("test-" + engine + "/reports/results.csv")).toString());
Expand Down

0 comments on commit 2e755d0

Please sign in to comment.