Commit 554be867 authored by Nicolas Bailliet's avatar Nicolas Bailliet
Browse files

modifications to solve errors before test plan

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/simulators/gazelle-webservice-tester/branches/gazelle-webservice-tester-nbt@64333 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent d43b679c
......@@ -5,13 +5,13 @@
<parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester-ear</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>gazelle-webservice-tester - EAR</name>
......
......@@ -4,7 +4,7 @@
<parent>
<artifactId>gazelle-webservice-tester</artifactId>
<groupId>net.ihe.gazelle</groupId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -147,14 +147,21 @@ public class RunInstanceAction {
public void reRunTestInstance(Execution oldExecution) {
this.execution = new Execution();
prepareExecution();
if (oldExecution.getTestInstanceResult() != null) {
//Test instance from TM
TestInstanceResult newTestInstanceResult = initTestInstanceResultForReRun(oldExecution);
this.execution.setTestInstanceResult(newTestInstanceResult);
} else {
componentToExecute = oldExecution.getTestComponent();
componentToExecute = HibernateUtil.initializeAndUnproxy(componentToExecute);
}
this.execution.setCustomPropertiesUsed(oldExecution.getCustomPropertiesUsed());
this.execution = ExecutionDao.mergeExecution(execution);
this.currentProject = oldExecution.getSoapuiProject();
this.currentProject.getGwtProject().setGwtProjectResults(oldExecution.getSoapuiProject().getGwtProject().getGwtProjectResults());
this.currentProject.getGwtProject().setXvalidatorOidsMap(oldExecution.getSoapuiProject().getGwtProject().getXvalidatorOidsMap());
if (oldExecution.getTestInstanceResult() != null) {
runTestInstance();
} else {
......@@ -193,9 +200,13 @@ public class RunInstanceAction {
}
public Execution run() {
prepareExecution();
// prepareExecution();
WsdlProject wsdlProject = createWsdlProject();
List<TestRunner> testRunners = startExecution(wsdlProject);
List<GwtProjectResult> gwtProjectResultList = currentProject.getGwtProject().getGwtProjectResults();
if (gwtProjectResultList != null) {
resetGwtProjectResults(gwtProjectResultList);
}
if (!testRunners.isEmpty()) {
List<GwtTestStepResult> gwtTestStepResultList;
if (componentToExecute instanceof GwtProject) {
......@@ -211,6 +222,17 @@ public class RunInstanceAction {
return execution;
}
private void resetGwtProjectResults(List<GwtProjectResult> gwtProjectResultList) {
for (GwtProjectResult gwtProjectResult : gwtProjectResultList) {
if (gwtProjectResult.getxValidatorInputInfoList() != null && gwtProjectResult.getTestStepInfoList() != null) {
gwtProjectResult.setxValidatorInputInfoList(new ArrayList<XValidatorInputInfo>());
gwtProjectResult.setTestStepInfoList(new ArrayList<TestStepInfo>());
gwtProjectResult.setXvalidationResult(null);
gwtProjectResult.save();
}
}
}
public List<TestRunner> startExecution(WsdlProject project) {
List<TestRunner> listResult = new ArrayList<>();
Map<String, TestProperty> testProperties = project.getProperties();
......@@ -322,11 +344,11 @@ public class RunInstanceAction {
} else if (result instanceof RestRequestStepResult) {
for (MessageExchange messageExchange : ((RestRequestStepResult) result).getMessageExchanges()) {
gwtTestStepResultList.add(createGwtTestStepResultRest(result, messageExchange, transactionInstance, execution));
}
}
}
}
}
}
return gwtTestStepResultList;
}
......@@ -363,7 +385,7 @@ public class RunInstanceAction {
Map<String, String> xvalidatorOidsMap = new HashMap<>();
List<GwtProjectResult> gwtProjectResultList = new ArrayList<>();
List<String> indexList = new ArrayList<>();
if (project.getXvalidatorOidsMap().isEmpty()) {
if (project.getXvalidatorOidsMap().isEmpty() || project.getGwtProjectResults().isEmpty()) {
while (testPropertiesIterator.hasNext()) {
Map.Entry<String, TestProperty> entry = testPropertiesIterator.next();
if (entry.getKey().contains("oid_xval_")) {
......@@ -428,19 +450,24 @@ public class RunInstanceAction {
}
}
TestStepInfo testStepInfo = new TestStepInfo(correspondingGwtProjectResult, testStepName, inputType);
XValidatorInputInfo xValidatorInputInfo = new XValidatorInputInfo(correspondingGwtProjectResult, inputName, messageContent, inputType);
testStepInfoList.add(testStepInfo);
xValidatorInputInfoList.add(xValidatorInputInfo);
if (messageContent.length > 0) {
XValidatorInputInfo xValidatorInputInfo = new XValidatorInputInfo(correspondingGwtProjectResult, inputName, messageContent, inputType);
xValidatorInputInfoList.add(xValidatorInputInfo);
} else {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "One of the test step from the project result " +
"in empty message content during extraction, an input will be missing for cross validation process");
}
}
if (correspondingGwtProjectResult.getTestStepInfoList() == null) {
if (correspondingGwtProjectResult.getTestStepInfoList() == null || correspondingGwtProjectResult.getTestStepInfoList().isEmpty()) {
correspondingGwtProjectResult.setTestStepInfoList(testStepInfoList);
} else {
correspondingGwtProjectResult.addTestStepInfoToList(testStepInfoList);
}
if (correspondingGwtProjectResult.getxValidatorInputInfoList() == null) {
if (correspondingGwtProjectResult.getxValidatorInputInfoList() == null || correspondingGwtProjectResult.getxValidatorInputInfoList().isEmpty()) {
correspondingGwtProjectResult.setxValidatorInputInfoList(xValidatorInputInfoList);
} else {
correspondingGwtProjectResult.addxValidatorInputInfoToList(xValidatorInputInfoList);
......@@ -452,6 +479,7 @@ public class RunInstanceAction {
private GwtProjectResult getGwtProjectResultFromXValidatorIndex(String xvalidatorIndex) {
GwtProjectResultQuery query = new GwtProjectResultQuery();
query.project().id().eq(currentProject.getGwtProject().getId());
query.execution().id().eq(execution.getId());
query.getList();
query.xvalidatorOidIndex().eq(xvalidatorIndex);
GwtProjectResult projectResult = query.getUniqueResult();
......@@ -587,6 +615,7 @@ public class RunInstanceAction {
prepareExecution();
componentToExecute = HibernateUtil.initializeAndUnproxy(componentToExecute);
Hibernate.initialize(componentToExecute.getCustomProperties());
execution = ExecutionDao.mergeExecution(execution);
execution.setCustomPropertiesUsed(getCustomPropertiesUsed(componentToExecute));
execution = ExecutionDao.mergeExecution(execution);
}
......
......@@ -159,7 +159,9 @@ public class Execution implements Serializable {
}
public void setProjectResults(List<GwtProjectResult> projectResults) {
this.projectResults = projectResults;
if (this.projectResults == null) {
this.projectResults = projectResults;
}
}
public List<CustomPropertyUsed> getCustomPropertiesUsed() {
......@@ -220,25 +222,26 @@ public class Execution implements Serializable {
public void updateGlobalStatus() {
if (testStepResults == null || testStepResults.size() == 0) {
setStatus("UNKNOWN");
}
boolean isPassed = true;
for (GwtTestStepResult testStepResult : testStepResults) {
if (testStepResult.getStatus().equals("FAILED")
|| (testStepResult.getResponseValidation() != null && testStepResult.getResponseValidation().getValidationStatus().equals("FAILED"))
|| (testStepResult.getRequestValidation() != null && testStepResult.getRequestValidation().getValidationStatus().equals("FAILED"))) {
setStatus("FAILED");
isPassed = false;
break;
} else {
boolean isPassed = true;
for (GwtTestStepResult testStepResult : testStepResults) {
if (testStepResult.getStatus().equals("FAILED")
|| (testStepResult.getResponseValidation() != null && testStepResult.getResponseValidation().getValidationStatus().equals("FAILED"))
|| (testStepResult.getRequestValidation() != null && testStepResult.getRequestValidation().getValidationStatus().equals("FAILED"))) {
setStatus("FAILED");
isPassed = false;
break;
}
if (testStepResult.getStatus().equals("UNKNOWN")) {
setStatus(testStepResult.getStatus());
isPassed = false;
break;
}
}
if (testStepResult.getStatus().equals("UNKNOWN")) {
setStatus(testStepResult.getStatus());
isPassed = false;
break;
if (isPassed) {
setStatus("PASSED");
}
}
if (isPassed) {
setStatus("PASSED");
}
}
......
......@@ -23,7 +23,7 @@ import java.util.Map;
@DiscriminatorValue("project")
public class GwtProject extends TestComponent implements Serializable {
@OneToOne(fetch = FetchType.EAGER,
@OneToOne(fetch = FetchType.LAZY,
cascade = CascadeType.ALL)
@JoinColumn(name = "soapui_project")
private SoapuiProject soapuiProject;
......@@ -36,7 +36,7 @@ public class GwtProject extends TestComponent implements Serializable {
)
private List<GwtTestSuite> testSuites;
@OneToMany(
@OneToMany(fetch = FetchType.EAGER,
targetEntity = GwtProjectResult.class,
mappedBy = "project",
cascade = CascadeType.ALL,
......@@ -44,7 +44,7 @@ public class GwtProject extends TestComponent implements Serializable {
)
private List<GwtProjectResult> gwtProjectResults = new ArrayList<>();
@ElementCollection
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "index")
@Column(name = "x_validator_oid")
@CollectionTable(name="x_validator_oids_map", joinColumns=@JoinColumn(name="project_id"))
......
......@@ -58,7 +58,7 @@ public class SoapuiProject implements Serializable {
@JoinColumn(name = "keystore")
private Keystore keystore;
@OneToOne(fetch = FetchType.EAGER,
@OneToOne(fetch = FetchType.LAZY,
cascade = CascadeType.ALL)
@JoinColumn(name = "gwt_project")
@OnDelete(action = OnDeleteAction.CASCADE)
......
......@@ -4,13 +4,13 @@
<parent>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gazelle-webservice-tester-war</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gazelle-webservice-tester - WAR</name>
<build>
......
......@@ -11,7 +11,7 @@
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester</artifactId>
<packaging>pom</packaging>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<name>gazelle-webservice-tester</name>
<scm>
......@@ -125,13 +125,13 @@
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester-ejb</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-webservice-tester-war</artifactId>
<version>1.2.2-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment