Skip to content

Commit ee4070d

Browse files
Merge pull request #736 from TIBCOSoftware/2.10.0_master_merge
2.10.0 to master merge
2 parents 91426da + fa01e48 commit ee4070d

File tree

8 files changed

+177
-34
lines changed

8 files changed

+177
-34
lines changed

Source/bw6-maven-plugin/pom.xml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.tibco.plugins</groupId>
44
<artifactId>bw6-maven-plugin</artifactId>
5-
<version>2.9.9</version>
5+
<version>2.10.0</version>
66
<packaging>maven-plugin</packaging>
77
<name>Plugin Code for Apache Maven and TIBCO BusinessWorks™</name>
88
<description>Plugin Code for Apache Maven and TIBCO BusinessWorks™.
@@ -193,6 +193,41 @@
193193
<version>2.15.0</version>
194194
</dependency>
195195

196+
<dependency>
197+
<groupId>org.apache.maven.plugins</groupId>
198+
<artifactId>maven-project-info-reports-plugin</artifactId>
199+
<version>3.6.0</version>
200+
</dependency>
201+
202+
<dependency>
203+
<groupId>org.apache.maven.doxia</groupId>
204+
<artifactId>doxia-sink-api</artifactId>
205+
<version>2.0.0-M12</version>
206+
</dependency>
207+
208+
<dependency>
209+
<groupId>org.apache.maven.doxia</groupId>
210+
<artifactId>doxia-site-model</artifactId>
211+
<version>2.0.0-M19</version>
212+
</dependency>
213+
214+
<dependency>
215+
<groupId>org.apache.maven.doxia</groupId>
216+
<artifactId>doxia-core</artifactId>
217+
<version>2.0.0-M12</version>
218+
</dependency>
219+
220+
<dependency>
221+
<groupId>org.codehaus.plexus</groupId>
222+
<artifactId>plexus-utils</artifactId>
223+
<version>4.0.1</version>
224+
</dependency>
225+
226+
<dependency>
227+
<groupId>org.apache.maven.doxia</groupId>
228+
<artifactId>doxia-integration-tools</artifactId>
229+
<version>2.0.0-M19</version>
230+
</dependency>
196231
</dependencies>
197232
<distributionManagement>
198233
<snapshotRepository>
@@ -265,7 +300,6 @@
265300
</configuration>
266301
</plugin>
267302

268-
269303
<plugin>
270304
<artifactId>maven-compiler-plugin</artifactId>
271305
<version>3.8.0</version>

Source/bw6-maven-plugin/src/main/java/com/tibco/bw/maven/plugin/application/BWEARInstallerMojo.java

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,24 @@ public class BWEARInstallerMojo extends AbstractMojo {
217217

218218
@Parameter(property = "namespace")
219219
private String namespace;
220+
221+
@Parameter(property="platformBuild", defaultValue ="false")
222+
private boolean platformBuild;
223+
224+
@Parameter(property="platformDeploy", defaultValue ="false")
225+
private boolean platformDeploy;
226+
227+
@Parameter(property="platformScale", defaultValue ="false")
228+
private boolean platformScale;
229+
230+
@Parameter(property="platformUpgrade", defaultValue ="false")
231+
private boolean platformUpgrade;
232+
233+
@Parameter(property = "appId")
234+
private String appId;
235+
236+
@Parameter(property = "buildId")
237+
private String buildId;
220238

221239
private String earLoc;
222240
private String earName;
@@ -246,13 +264,28 @@ public void execute() throws MojoExecutionException {
246264
deployer.close();
247265
}else if(projectType != null && projectType.equalsIgnoreCase(Constants.Platform)) {
248266
//Platform deployment
249-
File [] files = BWFileUtils.getFilesForType(outputDirectory, ".ear");
250-
if(files.length == 0) {
251-
throw new Exception("EAR file not found for the Application");
252-
}
253-
String application = manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLIC_NAME);
254-
PlatformDeployer deployer = new PlatformDeployer(connectTimeout, readTimeout, retryCount, getLog());
255-
deployer.buildApp(application, files[0].getPath(), buildName, appName, profile, replicas, enableAutoScaling, enableServiceMesh, eula, platformConfigFile, dpUrl, authToken, baseVersion, baseImageTag, namespace);
267+
PlatformDeployer deployer = new PlatformDeployer(connectTimeout, readTimeout, retryCount, getLog());
268+
if(platformBuild || platformDeploy || platformScale || platformUpgrade) {
269+
if(platformBuild) {
270+
File [] files = BWFileUtils.getFilesForType(outputDirectory, ".ear");
271+
if(files.length == 0) {
272+
throw new Exception("EAR file not found for the Application");
273+
}
274+
deployer.buildApp(files[0].getPath(), buildName, appName, profile, replicas, enableAutoScaling, enableServiceMesh, eula, platformConfigFile, dpUrl, authToken, baseVersion, baseImageTag, namespace, false);
275+
}else if(platformDeploy) {
276+
deployer.deployApp(dpUrl, buildId, namespace, authToken, eula, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh);
277+
}else if(platformScale) {
278+
deployer.scaleApp(dpUrl, appId, replicas, authToken);
279+
}else if(platformUpgrade) {
280+
deployer.upgradeApp(dpUrl, appId, buildId, namespace, authToken, eula, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh);
281+
}
282+
}else {
283+
File [] files = BWFileUtils.getFilesForType(outputDirectory, ".ear");
284+
if(files.length == 0) {
285+
throw new Exception("EAR file not found for the Application");
286+
}
287+
deployer.buildApp(files[0].getPath(), buildName, appName, profile, replicas, enableAutoScaling, enableServiceMesh, eula, platformConfigFile, dpUrl, authToken, baseVersion, baseImageTag, namespace, true);
288+
}
256289
}else {
257290
//enterprise deployment
258291
boolean configFileExists = deploymentConfigExists();

Source/bw6-maven-plugin/src/main/java/com/tibco/bw/maven/plugin/platform/client/PlatformDeployer.java

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public PlatformDeployer(int connectTimeout, int readTimeout, int retryCount, Log
4848
this.log = log;
4949
}
5050

51-
public void buildApp(String application, String earPath, String buildName, String appName, String profile, int replicas, boolean enableAutoScaling, boolean enableServiceMesh, boolean eula, String platformConfigFile, String dpUrl, String authToken, String baseVersion, String baseImageTag, String namespace) throws ClientException, IOException, InterruptedException {
51+
public void buildApp(String earPath, String buildName, String appName, String profile, int replicas, boolean enableAutoScaling, boolean enableServiceMesh, boolean eula, String platformConfigFile, String dpUrl, String authToken, String baseVersion, String baseImageTag, String namespace, boolean deploy) throws ClientException, IOException, InterruptedException {
5252
try {
53-
this.log.info("Deployment to Platform started...");
53+
this.log.info("Application build creation in Platform started...");
5454
if(dpUrl == null) {
5555
throw new ClientException("Unable to build the application. Please provide the data plane URL.");
5656
}
@@ -143,13 +143,15 @@ public void buildApp(String application, String earPath, String buildName, Strin
143143
.post(Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA));
144144
StatusType statusInfo = response.getStatusInfo();
145145
if(statusInfo.getFamily().equals(Family.SUCCESSFUL)) {
146-
String readEntity = response.readEntity(String.class);
147-
ObjectMapper mapper = new ObjectMapper();
148-
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
149-
Map<?, ?> responseMap;
150-
responseMap = mapper.readValue(readEntity, Map.class);
151-
String buildId = (String) responseMap.get("buildId");
152-
deployApp(buildId, namespace, authToken, eula, replicas, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh);
146+
if(deploy) {
147+
String readEntity = response.readEntity(String.class);
148+
ObjectMapper mapper = new ObjectMapper();
149+
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
150+
Map<?, ?> responseMap;
151+
responseMap = mapper.readValue(readEntity, Map.class);
152+
String buildId = (String) responseMap.get("buildId");
153+
deployApp(null, buildId, namespace, authToken, eula, replicas, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh, true);
154+
}
153155
}else {
154156
processErrorResponse(response, statusInfo);
155157
}
@@ -162,7 +164,7 @@ public void buildApp(String application, String earPath, String buildName, Strin
162164
}
163165
}
164166

165-
public void deployApp(String buildId, String namespace, String authToken, boolean eula, int replicas, String appName, String profile, String platformConfigFile, boolean enableAutoScaling, boolean enableServiceMesh) throws ClientException, IOException, InterruptedException {
167+
public void deployApp(String appId, String buildId, String namespace, String authToken, boolean eula, int replicas, String appName, String profile, String platformConfigFile, boolean enableAutoScaling, boolean enableServiceMesh, boolean scale) throws ClientException, IOException, InterruptedException {
166168
if(buildId == null || buildId.isEmpty()) {
167169
throw new ClientException("Unable to deploy the application. Please provide a valid build ID.");
168170
}
@@ -222,6 +224,9 @@ public void deployApp(String buildId, String namespace, String authToken, boolea
222224
tagsArray = (JSONArray) tags.get("tags");
223225
}
224226
}
227+
if(appId != null && !appId.isEmpty()) {
228+
appJsonObject.put("appId", appId);
229+
}
225230
appJsonObject.put("buildId", buildId);
226231
appJsonObject.put("enableAutoScaling", enableAutoScaling);
227232
appJsonObject.put("enableServiceMesh", enableServiceMesh);
@@ -259,18 +264,35 @@ public void deployApp(String buildId, String namespace, String authToken, boolea
259264
.post(Entity.entity(appJsonObject.toString(), MediaType.APPLICATION_JSON));
260265
StatusType statusInfo = response.getStatusInfo();
261266
if(statusInfo.getFamily().equals(Family.SUCCESSFUL)) {
262-
String readEntity = response.readEntity(String.class);
263-
ObjectMapper mapper = new ObjectMapper();
264-
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
265-
Map<?, ?> responseMap;
266-
responseMap = mapper.readValue(readEntity, Map.class);
267-
String appId = (String) responseMap.get("appId");
268-
scaleApp(appId, replicas, authToken);
267+
if(scale) {
268+
String readEntity = response.readEntity(String.class);
269+
ObjectMapper mapper = new ObjectMapper();
270+
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
271+
Map<?, ?> responseMap;
272+
responseMap = mapper.readValue(readEntity, Map.class);
273+
scaleApp((String) responseMap.get("appId"), replicas, authToken);
274+
}
269275
}else {
270276
processErrorResponse(response, statusInfo);
271277
}
272278
}
273279

280+
public void deployApp(String dpUrl, String buildId, String namespace, String authToken, boolean eula, String appName, String profile, String platformConfigFile, boolean enableAutoScaling, boolean enableServiceMesh) throws ClientException, IOException, InterruptedException {
281+
try {
282+
this.log.info("Build deployment in Platform started...");
283+
Client client = ClientBuilder.newClient();
284+
webTarget = client.target(new URI(dpUrl));
285+
webTarget.register(MultiPartFeature.class);
286+
deployApp(null, buildId, namespace, authToken, eula, 0, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh, false);
287+
}catch (ProcessingException pe) {
288+
pe.printStackTrace();
289+
throw getConnectionException(pe);
290+
}catch (Exception ex) {
291+
ex.printStackTrace();
292+
throw new ClientException(500, ex.getMessage(), ex);
293+
}
294+
}
295+
274296
public void scaleApp(String appId, int replicas, String authToken) throws ClientException, IOException, InterruptedException {
275297
if(appId == null || appId.isEmpty()) {
276298
throw new ClientException("Unable to scale the application. Please provide app ID.");
@@ -292,6 +314,38 @@ public void scaleApp(String appId, int replicas, String authToken) throws Client
292314
}
293315
}
294316

317+
public void scaleApp(String dpUrl, String appId, int replicas, String authToken) throws ClientException, IOException, InterruptedException {
318+
try {
319+
this.log.info("Applicatoin scaling in Platform started...");
320+
Client client = ClientBuilder.newClient();
321+
webTarget = client.target(new URI(dpUrl));
322+
webTarget.register(MultiPartFeature.class);
323+
scaleApp(appId, replicas, authToken);
324+
}catch (ProcessingException pe) {
325+
pe.printStackTrace();
326+
throw getConnectionException(pe);
327+
}catch (Exception ex) {
328+
ex.printStackTrace();
329+
throw new ClientException(500, ex.getMessage(), ex);
330+
}
331+
}
332+
333+
public void upgradeApp(String dpUrl, String appId, String buildId, String namespace, String authToken, boolean eula, String appName, String profile, String platformConfigFile, boolean enableAutoScaling, boolean enableServiceMesh) throws ClientException, IOException, InterruptedException {
334+
try {
335+
this.log.info("Application upgrade in Platform started...");
336+
Client client = ClientBuilder.newClient();
337+
webTarget = client.target(new URI(dpUrl));
338+
webTarget.register(MultiPartFeature.class);
339+
deployApp(appId, buildId, namespace, authToken, eula, 0, appName, profile, platformConfigFile, enableAutoScaling, enableServiceMesh, false);
340+
}catch (ProcessingException pe) {
341+
pe.printStackTrace();
342+
throw getConnectionException(pe);
343+
}catch (Exception ex) {
344+
ex.printStackTrace();
345+
throw new ClientException(500, ex.getMessage(), ex);
346+
}
347+
}
348+
295349
private void processErrorResponse(Response response, StatusType statusInfo) throws ClientException {
296350
if (statusInfo.getStatusCode() == 401) {
297351
throw new ClientException(response.getStatus(), statusInfo.getStatusCode() + ": " + statusInfo.getReasonPhrase(), null);

Source/bw6-maven-plugin/src/main/java/com/tibco/bw/maven/plugin/test/rest/BWTestRunner.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ private void printFailureDetails(TestCaseResultDTO testcase,String testCaseFile,
521521
if(!"passed".equals(assertion.getAssertionStatus())) {
522522
String inputValue = assertion.getActivityOutput();
523523
if(assertion.getAssertionMode().equals("Primitive") ){
524-
if (inputValue.startsWith(assertion.getStartElementNameTag())) {
524+
if (assertion.getStartElementNameTag() != null && inputValue.startsWith(assertion.getStartElementNameTag())) {
525525
inputValue = StringUtils.substringBetween(inputValue, assertion.getStartElementNameTag(), assertion.getEndElementNameTag());
526526
inputValue = inputValue!=null? inputValue:assertion.getActivityOutput();
527527
if(inputValue!= null && inputValue.contains(assertion.getStartElementNameTag())){
@@ -570,9 +570,19 @@ private void printFailureDetails(TestCaseResultDTO testcase,String testCaseFile,
570570
assertionFileBuilder.append("\n");
571571
}
572572
else {
573-
assertionFileBuilder.append(" [Activity Output: "+inputValue+"]");
574-
assertionFileBuilder.append(" [Gold Output: "+assertion.getGoldInput()+"]");
575-
assertionFileBuilder.append("\n");
573+
if (inputValue.equals(assertion.getGoldInput())) {
574+
assertionFileBuilder.append(" [Activity Output does not match ");
575+
if (assertion.getGoldInput() != null)
576+
assertionFileBuilder.append(" [Gold Output: "+assertion.getGoldInput()+"]");
577+
else
578+
assertionFileBuilder.append(" [Gold Output");
579+
assertionFileBuilder.append("\n");
580+
}
581+
else {
582+
assertionFileBuilder.append(" [Activity Output: "+inputValue+"]");
583+
assertionFileBuilder.append(" [Gold Output: "+assertion.getGoldInput()+"]");
584+
assertionFileBuilder.append("\n");
585+
}
576586
}
577587

578588
BWTestConfig.INSTANCE.getLogger().error(assertionFileBuilder.toString());

Source/bw6-maven-plugin/src/main/java/com/tibco/bw/maven/plugin/test/setuplocal/ConfigFileGenerator.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ private void addPluginsFromDir( File target , StringBuilder builder )
234234
File libFolder = new File(file.getAbsolutePath().concat("/lib"));
235235
if(libFolder.exists()){
236236
if (libFolder.getAbsolutePath() != null && !(libFolder.getAbsolutePath().indexOf("com.tibco.bw.jdbc.datasourcefactory.datadirect") >= 0)) {
237-
if(libFolder.isDirectory() && libFolder.list().length==0){
237+
if(libFolder.isDirectory() && !hasDBJar(libFolder)){
238238
continue;
239239
}
240240
}
@@ -278,6 +278,18 @@ private void addPluginsFromDir( File target , StringBuilder builder )
278278
}
279279

280280

281+
private boolean hasDBJar(File libFolder) {
282+
File[] files = libFolder.listFiles();
283+
if (files != null) {
284+
for (File file : files) {
285+
if (file.isFile() && file.getName().endsWith(".jar")) {
286+
return true;
287+
}
288+
}
289+
}
290+
return false;
291+
}
292+
281293
private void addReference( StringBuilder builder , File file ,String key)
282294
{
283295

Source/bw6-maven-plugin/src/main/resources/com/tibco/resources/mac_environment.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%%TIBCO_HOME%%/tibcojre64/11/Contents/Home/bin/java
1+
%%TIBCO_HOME%%/tibcojre64/17/Contents/Home/bin/java
22
-Dbw.appnode=BWEclipseAppNode
33
-Xms256m
44
-Xmx2048m

Source/bw6-maven-plugin/src/main/resources/com/tibco/resources/unix_environment.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%%TIBCO_HOME%%/tibcojre64/11/bin/java
1+
%%TIBCO_HOME%%/tibcojre64/17/bin/java
22
-Dbw.appnode=BWEclipseAppNode
33
-Xms256m
44
-Xmx2048m

Source/bw6-maven-plugin/src/main/resources/com/tibco/resources/win_environment.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%%TIBCO_HOME%%/tibcojre64/11/bin/java.exe
1+
%%TIBCO_HOME%%/tibcojre64/17/bin/java.exe
22
-Dbw.appnode=BWEclipseAppNode
33
-Xms256m
44
-Xmx2048m

0 commit comments

Comments
 (0)