Commit 577e56b3 authored by Nicolas Bailliet's avatar Nicolas Bailliet
Browse files

New validation classes forgotten in last commit, template and pom in war...

New validation classes forgotten in last commit, template and pom in war refactored 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@63960 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent a3dbf0ed
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.evsclient.connector.api.EVSClientResults;
import net.ihe.gazelle.evsclient.connector.api.EVSClientServletConnector;
import net.ihe.gazelle.hql.providers.EntityManagerService;
import net.ihe.gazelle.simulator.common.model.ApplicationConfiguration;
import net.ihe.gazelle.wstester.model.GwtProjectResult;
import net.ihe.gazelle.wstester.model.XValidationResult;
import net.ihe.gazelle.wstester.model.XValidatorInputInfo;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.international.StatusMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class GwtProjectXValidation extends GwtValidation {
private static final Logger LOG = LoggerFactory.getLogger(GwtTestStepValidation.class);
private List<XValidatorInputInfo> xValidatorInputInfoList;
private String gwtProjectResultId;
private GwtProjectResult gwtProjectResultSelected;
private XValidationResult xvalidationResult;
public GwtProjectXValidation() {
}
public GwtProjectXValidation(GwtProjectResult gwtProjectResultSelected, String gwtProjectResultId, List<XValidatorInputInfo> xValidatorInputInfoList) {
this.gwtProjectResultSelected = gwtProjectResultSelected;
this.gwtProjectResultId = gwtProjectResultId;
this.xValidatorInputInfoList = xValidatorInputInfoList;
}
public void init() {
Map<String, String> urlParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (urlParams != null && urlParams.size() > 0) {
String externalId = urlParams.get("id");
EntityManager entityManager = EntityManagerService.provideEntityManager();
if (externalId != null) {
gwtProjectResultSelected = entityManager.find(GwtProjectResult.class, Integer.parseInt(externalId));
if (gwtProjectResultSelected == null) {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "The given id does not match any test step result in the " +
"database");
}
String xvalidationLogOid = EVSClientResults.getXValResultOidFromUrl(urlParams);
if (xvalidationLogOid != null) {
XValidationResult result = new XValidationResult(gwtProjectResultSelected, xvalidationLogOid);
gwtProjectResultSelected.setXvalidationResult(result);
getXValResultDetails(result);
}
}
gwtProjectResultSelected.save();
try {
if (gwtProjectResultSelected != null) {
String executionId = String.valueOf(gwtProjectResultSelected.getExecution().getId());
FacesContext.getCurrentInstance().getExternalContext().redirect("/gazelle-webservice-tester/executionResult.seam?id="
+ executionId);
}
} catch (IOException e) {
LOG.error(e.getMessage());
}
} else {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "The url used must have a problem, it is not possible to redirect to the " +
"execution test step.");
}
}
public void xvalidate() throws IOException {
String evsClientUrl = ApplicationConfiguration.getValueOfVariable("evs_client_url");
String toolOid = ApplicationConfiguration.getValueOfVariable("tool_instance_oid");
if (evsClientUrl == null) {
LOG.error("evs_client_url is missing in app_configuration table");
} else if (toolOid == null) {
LOG.error("tool_instance_oid is missing in app_configuration table");
} else {
ExternalContext extContext = FacesContext.getCurrentInstance().getExternalContext();
Part[] parts = createParts();
EVSClientServletConnector.sendToXValidationFromGWT(parts, extContext, evsClientUrl, toolOid, gwtProjectResultSelected.getXvalidatorOid(), String.valueOf(gwtProjectResultSelected.getId()));
}
}
private void getXValResultDetails(final XValidationResult result) {
String evsclientUrl = ApplicationConfiguration.getValueOfVariable("evs_client_url");
String xvalidationDate = EVSClientResults.getXValidationDate(result.getLogOid(), evsclientUrl);
result.setXvalidationDate(xvalidationDate);
String xvalidationStatus = EVSClientResults.getXValidationStatus(result.getLogOid(), evsclientUrl);
result.setXvalidationStatus(xvalidationStatus);
String linkToResult = EVSClientResults.getXValidationPermanentLink(result.getLogOid(), evsclientUrl);
result.setPermanentLink(linkToResult);
xvalidationResult = result.save();
}
public Part[] createParts() {
Part[] parts;
parts = new Part[xValidatorInputInfoList.size()];
if (xValidatorInputInfoList.size() != 0) {
for (int index = 0; index < xValidatorInputInfoList.size(); index++) {
//We give the keyword this time
parts[index] = EVSClientServletConnector.addToParts(xValidatorInputInfoList.get(index), xValidatorInputInfoList.get(index).getInputName());
}
return parts;
} else {
return null;
}
}
}
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.wstester.dao.ExecutionDao;
import net.ihe.gazelle.wstester.model.Execution;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import javax.faces.context.FacesContext;
import java.util.Map;
@Name("messageValidation")
@Scope(ScopeType.PAGE)
public class GwtValidation {
String id;
Execution execution;
GwtTestStepValidation gwtTestStepValidation;
GwtProjectXValidation gwtProjectXValidation;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Execution getExecution() {
return execution;
}
public void setExecution(Execution execution) {
this.execution = execution;
}
public GwtTestStepValidation getGwtTestStepValidation() {
return gwtTestStepValidation;
}
public void setGwtTestStepValidation(GwtTestStepValidation gwtTestStepValidation) {
this.gwtTestStepValidation = gwtTestStepValidation;
}
public GwtProjectXValidation getGwtProjectXValidation() {
return gwtProjectXValidation;
}
public void setGwtProjectXValidation(GwtProjectXValidation gwtProjectXValidation) {
this.gwtProjectXValidation = gwtProjectXValidation;
}
@Create
public void initializePage() {
Map<String, String> urlParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (urlParams != null && urlParams.size() > 0) {
if (urlParams.containsKey("id")) {
id = urlParams.get("id");
if (id != null) {
execution = ExecutionDao.getExecutionById(Integer.decode(id));
//Validation process
if (urlParams.containsKey("logoid")) {
//XValidation
gwtProjectXValidation = new GwtProjectXValidation();
gwtProjectXValidation.init();
} else {
//Validation
gwtTestStepValidation = new GwtTestStepValidation();
gwtTestStepValidation.init();
}
}
}
}
}
}
......@@ -13,11 +13,6 @@
<version>1.3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gazelle-webservice-tester - WAR</name>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<gazelle-assets-version>${maven.build.timestamp}</gazelle-assets-version>
</properties>
<build>
<plugins>
<plugin>
......@@ -75,6 +70,7 @@
<cssSourceFile>daterangepicker.css</cssSourceFile>
<cssSourceFile>summernote.css</cssSourceFile>
<cssSourceFile>status.css</cssSourceFile>
<cssSourceFile>tooltip.css</cssSourceFile>
</cssSourceFiles>
<cssTargetDir>resources/stylesheet</cssTargetDir>
<cssFinalFile>gazelle-webservice-tester-${gazelle-assets-version}.css</cssFinalFile>
......
......@@ -113,6 +113,7 @@
<ui:define name="content">
<h:outputText value="#{gwtProjectResult.getValidatorNameFromOid()}"/>
<br/>
<br/>
<h:outputText value="#{gwtProjectResult.getValidatorDescriptionFromOid()}"/>
</ui:define>
</ui:decorate>
......
......@@ -9,15 +9,6 @@
<title>${pageNameTitle}</title>
<link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<ui:insert name="header"/>
<h:outputScript library="jscript" name="jquery_1_11_2.min.js"/>
<h:outputScript library="jscript" name="moment.js"/>
<h:outputScript library="jscript" name="daterangepicker.js"/>
<h:outputScript library="jscript" name="bootstrap.min.js"/>
<h:outputScript library="jscript" name="chosen.jquery.min.js"/>
<h:outputScript library="jscript" name="summernote.min.js"/>
<h:outputScript library="jscript" name="gazelleTools.js"/>
<h:outputStylesheet library="stylesheet" name="tooltip.css"/>
<h:outputScript library="jscript" name="gazelle-webservice-tester-${gazelle-assets-version}.min.js"/>
......
......@@ -50,7 +50,7 @@
<messages.mode>crowdin</messages.mode>
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<!--<gazelle-assets-version>${maven.build.timestamp}</gazelle-assets-version>-->
<gazelle-assets-version>${maven.build.timestamp}</gazelle-assets-version>
<gazelle.plugins.version>1.60</gazelle.plugins.version>
<sonar.jacoco.reportPaths>target/jacoco.exec</sonar.jacoco.reportPaths>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
......
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