Skip to content

Commit

Permalink
Merge pull request #703 from TIBCOSoftware/2.9.6
Browse files Browse the repository at this point in the history
2.9.6
  • Loading branch information
mmilinds-tibco authored May 26, 2023
2 parents 416d12b + ec5dd79 commit 75df0fa
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 30 deletions.
6 changes: 3 additions & 3 deletions Source/bw6-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tibco.plugins</groupId>
<artifactId>bw6-maven-plugin</artifactId>
<version>2.9.5</version>
<version>2.9.6</version>
<packaging>maven-plugin</packaging>
<name>Plugin Code for Apache Maven and TIBCO BusinessWorks™</name>
<description>Plugin Code for Apache Maven and TIBCO BusinessWorks™.
Expand Down Expand Up @@ -165,12 +165,12 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.2.0</version>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,19 @@ private void addModules() throws Exception {
String dependencyVersion = BWProjectUtils.getModuleVersion(artifact.getFile());

Manifest mf = ManifestParser.parseManifestFromJAR( f);
for( Object str : mf.getMainAttributes().keySet())
{
getLog().debug( str.toString() );
if( "TIBCO-BW-SharedModule".equals(str.toString() ))
{
moduleVersionMap.put(artifact.getArtifactId(), dependencyVersion);
artifactFiles.add(artifact.getFile());
break;

}
}
if (mf != null) {
for( Object str : mf.getMainAttributes().keySet())
{
getLog().debug( str.toString() );
if( "TIBCO-BW-SharedModule".equals(str.toString() ))
{
moduleVersionMap.put(artifact.getArtifactId(), dependencyVersion);
artifactFiles.add(artifact.getFile());
break;

}
}
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,17 @@ private void addDependencies() throws Exception {

boolean isSharedModule = false;
Manifest mf = ManifestParser.parseManifestFromJAR( file);
if(mf == null){
throw new Exception("Failed to get Manifest for - "+ file.getName() +". Please verify if jar file is valid, the MANIFEST.MF should be first or second entry in the jar file. Use Command - jar tf <Jar_File_Path> to verify.");
}
for( Object str : mf.getMainAttributes().keySet())
{
getLog().debug( str.toString() );
if( Constants.TIBCO_SHARED_MODULE.equals(str.toString() ))
{
isSharedModule = true;
break;
}
}
if(mf != null){
for( Object str : mf.getMainAttributes().keySet())
{
getLog().debug( str.toString() );
if( Constants.TIBCO_SHARED_MODULE.equals(str.toString() ))
{
isSharedModule = true;
break;
}
}
}
if(!isSharedModule) {
getLog().debug("Dependency added with name " + file.toString());
jarArchiver.addFile(file, "lib/" + file.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
public class ProcessCoverageParser
{

private static final Map<String, String> ALWAYS_EXECUTED_ACTIVITIES = new HashMap<>();
static {
ALWAYS_EXECUTED_ACTIVITIES.put("OnMessageStart", "");
ALWAYS_EXECUTED_ACTIVITIES.put("OnMessageEnd", "");
}

Map<String,ProcessCoverage> processMap = new HashMap<>();

@Component
Expand Down Expand Up @@ -117,7 +123,8 @@ private void collectCoverageFromTestResults(TestSuiteResultDTO result) {
ProcessCoverage pc = processMap.get(testset.getProcessName());
pc.setProcessExecuted(true);
// always put starter activity as executed
pc.getActivitiesExec().add(pc.getActivities().get(0));
String startActivityName = pc.getActivities().get(0);
pc.getActivitiesExec().add(startActivityName);

Set<String> transitionsExecuted = new HashSet<String>();
for( int j = 0 ; j < testset.getTestCaseResult().size() ; j++ )
Expand All @@ -127,9 +134,15 @@ private void collectCoverageFromTestResults(TestSuiteResultDTO result) {
for( int assercount = 0 ; assercount < testcase.getAssertionResult().size() ; assercount++ )
{
AssertionResultDTO aresult = (AssertionResultDTO) testcase.getAssertionResult().get( assercount );
pc.getActivitiesExec().add(aresult.getActivityName());
String activityName = aresult.getActivityName();
// keep it simple
if (!activityName.equals("N/A")) {
pc.getActivitiesExec().add(aresult.getActivityName());
}
for (String transition: pc.getTransitions()) {
if (transition.indexOf(aresult.getActivityName()) >= 0) {
if (transition.indexOf(aresult.getActivityName()) >= 0 ||
transition.indexOf(startActivityName) >= 0
) {
if (!transitionsExecuted.contains(transition)) {
pc.getTransitionExec().add(transition);
transitionsExecuted.add(transition);
Expand All @@ -149,6 +162,14 @@ private void collectCoverageFromTestResults(TestSuiteResultDTO result) {
}
}
}

for (String activity: pc.getActivities() ) {

if (ALWAYS_EXECUTED_ACTIVITIES.containsKey(activity)) {
pc.getActivitiesExec().add(activity);
}

}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ else if( "Operation".equals(cEl.getNodeName()))
BWTestConfig.INSTANCE.getLogger().debug("Provided Mock File path is relative "+file.getPath());
mockOutputFilePath = baseDirectoryPath.concat("/"+mockOutputFilePath);
}
if(!disableMocking){
//do not execute if activity is Confirm activity
if(!disableMocking && !activityName.equalsIgnoreCase("Confirm")){
boolean isValidFile = validateMockXMLFile(mockOutputFilePath, activityName, processName);
if(isValidFile){
mockActivity.setmockOutputFilePath(mockOutputFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public static String getModuleVersion( File jarFile ) throws Exception {
JarInputStream jarStream = new JarInputStream( new FileInputStream( jarFile ));
Manifest moduleManifest = jarStream.getManifest();
jarStream.close();
if (moduleManifest == null) {
return "1.0.0"; // default to 1?
}
return moduleManifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
}

Expand Down

0 comments on commit 75df0fa

Please sign in to comment.