com.tibco.bw.maven.plugin.testsuite.BWTSFileReaderWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bw6-maven-plugin Show documentation
Show all versions of bw6-maven-plugin Show documentation
Plugin Code for Apache Maven and TIBCO BusinessWorks™.
This is the Maven Plugin for BW6 and BWCE Build.
package com.tibco.bw.maven.plugin.testsuite;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.project.MavenProject;
import com.tibco.bw.maven.plugin.test.helpers.BWTestConfig;
public class BWTSFileReaderWrapper {
public List readBWTSFile(List testSuiteList , String TestFolderPath, MavenProject project) throws IOException{
List returnList = new ArrayList<>();
List tempReturnList ;
HashMap> testSuiteMap = new HashMap>();
try {
for(String testSuiteName : testSuiteList){
Path path = Paths.get(testSuiteName);
BWTSModel bwtsModel = YMLBWTSFileReader.getModelFrom(path);
Object testCaseList = bwtsModel.getOthers().get("testCases");
tempReturnList = new ArrayList<>();
if(null != testCaseList){
for (Object obj : (ArrayList>)testCaseList) {
if(obj instanceof String){
returnList.add(new File(TestFolderPath.concat("//"+(String)obj)));
tempReturnList.add(new File(TestFolderPath.concat("//"+(String)obj)));
}
}
}
String testSuite = StringUtils.substringAfter(testSuiteName, TestFolderPath.concat("//"));
testSuiteMap.put(testSuite, tempReturnList);
}
BWTestConfig.INSTANCE.setTestSuiteMap(project, testSuiteMap);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
return returnList;
}
public List readBWTSFileFromESM(List testSuiteList , String TestFolderPath, String esmDir) throws IOException{
List returnList = new ArrayList<>();
List tempReturnList ;
HashMap> testSuiteMap = new HashMap>();
try {
for(String testSuiteName : testSuiteList){
Path path = Paths.get(testSuiteName);
BWTSModel bwtsModel = YMLBWTSFileReader.getModelFrom(path);
Object testCaseList = bwtsModel.getOthers().get("testCases");
tempReturnList = new ArrayList<>();
if(null != testCaseList){
for (Object obj : (ArrayList>)testCaseList) {
if(obj instanceof String){
returnList.add(new File(TestFolderPath.concat("//"+(String)obj)));
tempReturnList.add(new File(TestFolderPath.concat("//"+(String)obj)));
}
}
}
String testSuite = StringUtils.substringAfter(testSuiteName, TestFolderPath.concat("//"));
testSuiteMap.put(testSuite, tempReturnList);
}
BWTestConfig.INSTANCE.setEsmTestSuiteMap(esmDir, testSuiteMap);
} catch (IOException e) {
e.printStackTrace();
throw e;
}
return returnList;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy