diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/pom.xml b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/pom.xml
new file mode 100644
index 00000000..b8a13bb4
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/pom.xml
@@ -0,0 +1,49 @@
+
+
+ 4.0.0
+
+ com.ibm.cics.test-bundle-deploy-neither-smss
+ test-bundle-deploy-neither-smss
+ Example CICS bundle
+ 0.0.1-SNAPSHOT
+
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+ true
+
+
+ deploy
+ verify
+
+ deploy
+
+
+ neither
+ bundle
+ BAR
+ ${basedir}/test-app-bundle-0.0.1-SNAPSHOT.zip
+
+
+
+
+
+
+
+
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/postbuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/postbuild.bsh
similarity index 100%
rename from cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/postbuild.bsh
rename to cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/postbuild.bsh
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/prebuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/prebuild.bsh
new file mode 100644
index 00000000..61445190
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/prebuild.bsh
@@ -0,0 +1 @@
+context.put("wireMockServer", com.ibm.cics.cbmp.DeployPreBuild.setupSMSSWiremock(Integer.parseInt(wiremockPort)));
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/test-app-bundle-0.0.1-SNAPSHOT.zip b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/test-app-bundle-0.0.1-SNAPSHOT.zip
new file mode 100644
index 00000000..5338f17b
Binary files /dev/null and b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither-smss/test-app-bundle-0.0.1-SNAPSHOT.zip differ
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/invoker.properties b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/invoker.properties
new file mode 100644
index 00000000..f46ab66f
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/invoker.properties
@@ -0,0 +1,15 @@
+###
+# #%L
+# CICS Bundle Maven Plugin
+# %%
+# Copyright (C) 2019 IBM Corp.
+# %%
+# This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License 2.0
+# which is available at https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+# #L%
+###
+# The expected result of the build, possible values are "success" (default) and "failure"
+invoker.buildResult = failure
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/pom.xml b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/pom.xml
index b71ad16a..01c81880 100644
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/pom.xml
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/pom.xml
@@ -21,7 +21,7 @@
-
+
@project.groupId@
@project.artifactId@
@@ -35,10 +35,8 @@
deploy
- serverId
+ neither
bundle
- cicsplex
- region
BAR
${basedir}/test-app-bundle-0.0.1-SNAPSHOT.zip
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/postbuild.groovy b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/postbuild.groovy
new file mode 100644
index 00000000..e688de8b
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/postbuild.groovy
@@ -0,0 +1,23 @@
+/*-
+ * #%L
+ * CICS Bundle Maven Plugin
+ * %%
+ * Copyright (C) 2019 IBM Corp.
+ * %%
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ * #L%
+ */
+import com.ibm.cics.cbmp.DeployPreBuild
+
+context.get("wireMockServer").shutdownServer()
+
+File buildLog = new File(basedir, 'build.log')
+
+assert buildLog.exists()
+assert buildLog.text.contains("[ERROR] Failed to execute goal com.ibm.cics:cics-bundle-maven-plugin:")
+assert buildLog.text.contains("com.ibm.cics.bundle.deploy.BundleDeployException: Some of the supplied parameters were invalid")
+assert buildLog.text.contains("- cicsplex: CICSplex could not be found")
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/prebuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/prebuild.bsh
index f4680d0e..60e6e892 100644
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/prebuild.bsh
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-neither/prebuild.bsh
@@ -1 +1 @@
-context.put("wireMockServer", com.ibm.cics.cbmp.DeployPreBuild.setupWiremock(Integer.parseInt(wiremockPort)));
\ No newline at end of file
+context.put("wireMockServer", com.ibm.cics.cbmp.DeployPreBuild.setupWiremockNoCICSplexRegion(Integer.parseInt(wiremockPort)));
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/invoker.properties b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/invoker.properties
new file mode 100644
index 00000000..f46ab66f
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/invoker.properties
@@ -0,0 +1,15 @@
+###
+# #%L
+# CICS Bundle Maven Plugin
+# %%
+# Copyright (C) 2019 IBM Corp.
+# %%
+# This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License 2.0
+# which is available at https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+# #L%
+###
+# The expected result of the build, possible values are "success" (default) and "failure"
+invoker.buildResult = failure
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/pom.xml b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/pom.xml
index c3f4a082..83b3aec6 100644
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/pom.xml
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/pom.xml
@@ -21,7 +21,8 @@
-
+
+
@project.groupId@
@project.artifactId@
@@ -35,8 +36,7 @@
deploy
- cicsplex
- serverId
+ noCICSplex
bundle
BAR
${basedir}/test-app-bundle-0.0.1-SNAPSHOT.zip
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.bsh
deleted file mode 100644
index d93e6103..00000000
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.bsh
+++ /dev/null
@@ -1 +0,0 @@
-context.get("wireMockServer").shutdownServer();
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.groovy b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.groovy
new file mode 100644
index 00000000..20eb3e34
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noCICSplex/postbuild.groovy
@@ -0,0 +1,22 @@
+/*-
+ * #%L
+ * CICS Bundle Maven Plugin
+ * %%
+ * Copyright (C) 2019 IBM Corp.
+ * %%
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ * #L%
+ */
+import com.ibm.cics.cbmp.DeployPreBuild
+
+context.get("wireMockServer").shutdownServer()
+
+File buildLog = new File(basedir, 'build.log')
+
+assert buildLog.exists()
+assert buildLog.text.contains("[ERROR] Failed to execute goal com.ibm.cics:cics-bundle-maven-plugin:")
+assert buildLog.text.contains("(deploy) on project test-bundle-deploy-noCICSplex: Specify both or neither of cicsplex and region in plugin configuration or server configuration")
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/invoker.properties b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/invoker.properties
new file mode 100644
index 00000000..f46ab66f
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/invoker.properties
@@ -0,0 +1,15 @@
+###
+# #%L
+# CICS Bundle Maven Plugin
+# %%
+# Copyright (C) 2019 IBM Corp.
+# %%
+# This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License 2.0
+# which is available at https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+# #L%
+###
+# The expected result of the build, possible values are "success" (default) and "failure"
+invoker.buildResult = failure
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/pom.xml b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/pom.xml
index 515b70be..d91cb397 100644
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/pom.xml
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/pom.xml
@@ -20,7 +20,8 @@
-
+
+
@project.groupId@
@project.artifactId@
@@ -34,9 +35,8 @@
deploy
- serverId
+ noRegion
bundle
- region
BAR
${basedir}/test-app-bundle-0.0.1-SNAPSHOT.zip
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.bsh
deleted file mode 100644
index d93e6103..00000000
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.bsh
+++ /dev/null
@@ -1 +0,0 @@
-context.get("wireMockServer").shutdownServer();
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.groovy b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.groovy
new file mode 100644
index 00000000..997b9f05
--- /dev/null
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/postbuild.groovy
@@ -0,0 +1,22 @@
+/*-
+ * #%L
+ * CICS Bundle Maven Plugin
+ * %%
+ * Copyright (C) 2019 IBM Corp.
+ * %%
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ * #L%
+ */
+import com.ibm.cics.cbmp.DeployPreBuild
+
+context.get("wireMockServer").shutdownServer()
+
+File buildLog = new File(basedir, 'build.log')
+
+assert buildLog.exists()
+assert buildLog.text.contains("[ERROR] Failed to execute goal com.ibm.cics:cics-bundle-maven-plugin:")
+assert buildLog.text.contains("(deploy) on project test-bundle-deploy-noRegion: Specify both or neither of cicsplex and region in plugin configuration or server configuration")
diff --git a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/prebuild.bsh b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/prebuild.bsh
index f4680d0e..61445190 100644
--- a/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/prebuild.bsh
+++ b/cics-bundle-maven-plugin/src/it/test-bundle-deploy-noRegion/prebuild.bsh
@@ -1 +1 @@
-context.put("wireMockServer", com.ibm.cics.cbmp.DeployPreBuild.setupWiremock(Integer.parseInt(wiremockPort)));
\ No newline at end of file
+context.put("wireMockServer", com.ibm.cics.cbmp.DeployPreBuild.setupSMSSWiremock(Integer.parseInt(wiremockPort)));
\ No newline at end of file
diff --git a/cics-bundle-maven-plugin/src/test/java/com/ibm/cics/cbmp/DeployPreBuild.java b/cics-bundle-maven-plugin/src/test/java/com/ibm/cics/cbmp/DeployPreBuild.java
index 48401cd0..57f2f57d 100644
--- a/cics-bundle-maven-plugin/src/test/java/com/ibm/cics/cbmp/DeployPreBuild.java
+++ b/cics-bundle-maven-plugin/src/test/java/com/ibm/cics/cbmp/DeployPreBuild.java
@@ -77,17 +77,17 @@ static WireMockServer setupWiremock(int port, Protocol protocol) {
.withName("region")
.withBody(equalTo("region")))
.withMultipartRequestBody(
- aMultipart()
- .withName("bunddef")
- .withBody(equalTo("bundle")))
+ aMultipart()
+ .withName("bunddef")
+ .withBody(equalTo("bundle")))
.withMultipartRequestBody(
- aMultipart()
- .withName("csdgroup")
- .withBody(equalTo("BAR")))
+ aMultipart()
+ .withName("csdgroup")
+ .withBody(equalTo("BAR")))
.withMultipartRequestBody(
- aMultipart()
- .withName("bundle")
- .withBody(WireMock.binaryEqualTo(bundleBinary)))
+ aMultipart()
+ .withName("bundle")
+ .withBody(WireMock.binaryEqualTo(bundleBinary)))
.willReturn(
aResponse()
.withStatus(200)
@@ -95,9 +95,88 @@ static WireMockServer setupWiremock(int port, Protocol protocol) {
.withBody("Some content")
)
);
+
return wireMockServer;
}
-
+
+ static WireMockServer setupWiremockNoCICSplexRegion(int port) {
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+
+ try {
+ Thread.currentThread().setContextClassLoader(WireMock.class.getClassLoader());
+ wireMockServer = new WireMockServer(WireMockConfiguration.options().port(port));
+ } finally {
+ Thread.currentThread().setContextClassLoader(ccl);
+ }
+
+ wireMockServer.start();
+
+ wireMockServer
+ .stubFor(
+ post(urlEqualTo("/managedcicsbundles"))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("bunddef")
+ .withBody(equalTo("bundle")))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("csdgroup")
+ .withBody(equalTo("BAR")))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("bundle")
+ .withBody(WireMock.binaryEqualTo(bundleBinary)))
+ .willReturn(
+ aResponse()
+ .withStatus(400)
+ .withHeader("Content-Type", "text/plain")
+ .withBody("com.ibm.cics.bundle.deploy.BundleDeployException: Some of the supplied parameters were invalid:\n" +
+ " - cicsplex: CICSplex could not be found")
+ )
+ );
+
+ return wireMockServer;
+ }
+
+
+ static WireMockServer setupSMSSWiremock(int port) {
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+
+ try {
+ Thread.currentThread().setContextClassLoader(WireMock.class.getClassLoader());
+ wireMockServer = new WireMockServer(WireMockConfiguration.options().port(port));
+ } finally {
+ Thread.currentThread().setContextClassLoader(ccl);
+ }
+
+ wireMockServer.start();
+
+ wireMockServer
+ .stubFor(
+ post(urlEqualTo("/managedcicsbundles"))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("bunddef")
+ .withBody(equalTo("bundle")))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("csdgroup")
+ .withBody(equalTo("BAR")))
+ .withMultipartRequestBody(
+ aMultipart()
+ .withName("bundle")
+ .withBody(WireMock.binaryEqualTo(bundleBinary)))
+ .willReturn(
+ aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/plain")
+ .withBody("Some content")
+ )
+ );
+ return wireMockServer;
+ }
+
+
/*
* Used by test-reactor-war-deploy which builds the bundle and then tests deploying it, so we can't check for a specific binary for the bundle
*/