Commit dc0dea9d authored by Malo Toudic's avatar Malo Toudic
Browse files

Revert last commit + fix xdstools

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/simulators/gazelle-webservice-tester/trunk@63159 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent c086e9e3
......@@ -23,4 +23,9 @@ INSERT INTO app_configuration (id, variable, value) VALUES (nextval('app_configu
INSERT INTO app_configuration (id, variable, value) VALUES (nextval('app_configuration_id_seq'), 'keystore_directory', '/opt/gazelle-webservice-tester/keystores/');
INSERT INTO app_configuration (id, variable, value) VALUES (nextval('app_configuration_id_seq'), 'logs_directory', '/opt/gazelle-webservice-tester/logs/');
INSERT INTO app_configuration (id, variable, value)
VALUES (nextval('app_configuration_id_seq'), 'ehealthsuisse', 'false');
\ No newline at end of file
VALUES (nextval('app_configuration_id_seq'), 'ehealthsuisse', 'false');
INSERT INTO app_configuration (id, variable, value)
VALUES (nextval('app_configuration_id_seq'), 'tool_instance_oid', 'oid');
INSERT INTO app_configuration (id, variable, value)
VALUES (nextval('app_configuration_id_seq'), 'evs_client_url', 'url');
DELETE FROM app_configuration WHERE variable = 'cas_url';
\ No newline at end of file
......@@ -45,7 +45,7 @@
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-evsclient-connector</artifactId>
<version>1.1.18-SNAPSHOT</version>
<version>1.1.17</version>
</dependency>
<dependency>
<groupId>net.ihe.gazelle.simulators</groupId>
......
......@@ -32,34 +32,17 @@ public class GwtTestStepValidation implements EVSClientValidatedObject {
String gwtTestStepResultId;
byte[] selectedMessage;
byte[] xvalRequest;
byte[] xvalResponse;
GwtTestStepResult gwtTestStepResultSelected;
String gwtTestStepXValOid;
ValidationResult validationResult;
public GwtTestStepValidation() {
}
//Validation
public GwtTestStepValidation(String gwtTestStepResultId, byte[] selectedMessage) {
this.gwtTestStepResultId = gwtTestStepResultId;
this.selectedMessage = selectedMessage;
}
//XValidation
public GwtTestStepValidation(String gwtTestStepResultId, byte[] request, byte[] response, String gwtTestStepXValOid) {
this.gwtTestStepResultId = gwtTestStepResultId;
this.xvalRequest = request;
this.xvalResponse = response;
this.gwtTestStepXValOid = gwtTestStepXValOid;
}
public byte[] getSelectedMessage() {
return selectedMessage;
}
......@@ -68,22 +51,6 @@ public class GwtTestStepValidation implements EVSClientValidatedObject {
this.selectedMessage = selectedMessage;
}
public byte[] getXvalRequest() {
return xvalRequest;
}
public void setXvalRequest(byte[] xvalRequest) {
this.xvalRequest = xvalRequest;
}
public byte[] getXvalResponse() {
return xvalResponse;
}
public void setXvalResponse(byte[] xvalResponse) {
this.xvalResponse = xvalResponse;
}
public String getGwtTestStepResultId() {
return gwtTestStepResultId;
}
......@@ -100,14 +67,6 @@ public class GwtTestStepValidation implements EVSClientValidatedObject {
this.gwtTestStepResultSelected = gwtTestStepResultSelected;
}
public String getGwtTestStepXValOid() {
return gwtTestStepXValOid;
}
public void setGwtTestStepXValOid(String gwtTestStepXValOid) {
this.gwtTestStepXValOid = gwtTestStepXValOid;
}
public ValidationResult getValidationResult() {
return validationResult;
}
......@@ -170,24 +129,6 @@ public class GwtTestStepValidation implements EVSClientValidatedObject {
}
}
@Override
public PartSource getXValRequestPartSource() {
if (xvalRequest != null) {
return PartSourceUtils.buildEncoded64PartSource(xvalRequest, getType());
} else {
return null;
}
}
@Override
public PartSource getXValResponsePartSource() {
if (xvalResponse != null) {
return PartSourceUtils.buildEncoded64PartSource(xvalResponse, getType());
} else {
return null;
}
}
@Override
public String getType() {
return "xml";
......@@ -206,22 +147,4 @@ public class GwtTestStepValidation implements EVSClientValidatedObject {
}
}
public void xvalidate() throws IOException {
String evsClientUrl = ApplicationConfiguration.getValueOfVariable("evs_client_url");
String toolOid = ApplicationConfiguration.getValueOfVariable("tool_instance_oid");
LOG.debug("OID_XVAL = ",gwtTestStepXValOid);
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();
EVSClientServletConnector.sendToXValidation(this, extContext, evsClientUrl, toolOid, gwtTestStepXValOid);
}
}
}
......@@ -326,10 +326,7 @@ public class RunInstanceAction {
transactionInstance.setTimestamp(new Date(result.getTimeStamp()));
String root = PreferenceService.getString("gwt_root_oid");
String oid_teststep = root + transactionInstance.getId();
return new GwtTestStepResult(result.getStatus().toString(), result.getTimeTaken(), oid_teststep,transactionInstance, GwtTestStepDao.getGwtTestStep(result, this.currentProject.getLabel()), execution, messageExchange.getEndpoint(), Arrays.asList(result.getMessages()));
return new GwtTestStepResult(result.getStatus().toString(), result.getTimeTaken(), transactionInstance, GwtTestStepDao.getGwtTestStep(result, this.currentProject.getLabel()), execution, messageExchange.getEndpoint(), Arrays.asList(result.getMessages()));
}
public void prepareExecution() {
......
......@@ -213,8 +213,6 @@ public class UploadProject implements Serializable {
gwtTestStep.setLabel(testStep.getName());
gwtTestStep.setTestCase(gwtTestCase);
gwtTestStep.setDisable(testStep.isDisabled());
//TODO temporary definition of x val oid, need to be declared through properties for ex
gwtTestStep.setOid_xval("1.3.6.1.4.1.12559.11.1.2.0.5");
gwtTestSteps.add(gwtTestStep);
}
......
package net.ihe.gazelle.wstester.model;
import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import java.io.Serializable;
import java.util.List;
......@@ -12,9 +18,6 @@ public class GwtTestStep extends TestComponent implements Serializable {
@JoinColumn(name = "test_case_id")
private GwtTestCase testCase;
@Column(name = "oid_xval")
private String oid_xval;
@OneToMany(
targetEntity = GwtTestStepResult.class,
mappedBy = "testStep",
......@@ -32,11 +35,10 @@ public class GwtTestStep extends TestComponent implements Serializable {
return GwtTestStep.class.getSimpleName();
}
public GwtTestStep(String label, List<CustomProperty> customProperties, GwtTestCase testCase, List<GwtTestStepResult> gwtTestStepResults, String oid_xval) {
public GwtTestStep(String label, List<CustomProperty> customProperties, GwtTestCase testCase, List<GwtTestStepResult> gwtTestStepResults) {
super(label, customProperties);
this.testCase = testCase;
this.gwtTestStepResults = gwtTestStepResults;
this.oid_xval=oid_xval;
}
public GwtTestCase getTestCase() {
......@@ -55,15 +57,6 @@ public class GwtTestStep extends TestComponent implements Serializable {
this.gwtTestStepResults = gwtTestStepResults;
}
public String getOid_xval() {
return oid_xval;
}
public void setOid_xval(String oid_xval) {
this.oid_xval = oid_xval;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
......
package net.ihe.gazelle.wstester.model;
import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
import jxl.biff.ByteArray;
import net.ihe.gazelle.simulator.message.model.TransactionInstance;
import net.ihe.gazelle.wstester.action.GwtTestStepValidation;
import net.ihe.gazelle.wstester.util.DateUtil;
......@@ -26,7 +25,6 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
......@@ -50,9 +48,6 @@ public class GwtTestStepResult implements Serializable {
@Column(name = "time_taken", nullable = false)
private long timeTaken;
@Column(name = "oid_teststep")
private String oid_teststep;
@Column(name = "endpoint")
private String endpoint;
......@@ -80,20 +75,18 @@ public class GwtTestStepResult implements Serializable {
super();
}
public GwtTestStepResult(String status, long timeTaken, String oid_teststep, TransactionInstance messages, GwtTestStep testStep, Execution execution, String endpoint) {
public GwtTestStepResult(String status, long timeTaken, TransactionInstance messages, GwtTestStep testStep, Execution execution, String endpoint) {
this.status = status;
this.timeTaken = timeTaken;
this.oid_teststep = oid_teststep;
this.messages = messages;
this.testStep = testStep;
this.execution = execution;
this.endpoint = endpoint;
}
public GwtTestStepResult(String status, long timeTaken, String oid_teststep, TransactionInstance messages, GwtTestStep testStep, Execution execution, String endpoint, List<String> soapUIMessages) {
public GwtTestStepResult(String status, long timeTaken, TransactionInstance messages, GwtTestStep testStep, Execution execution, String endpoint, List<String> soapUIMessages) {
this.status = status;
this.timeTaken = timeTaken;
this.oid_teststep = oid_teststep;
this.endpoint = endpoint;
this.messages = messages;
this.testStep = testStep;
......@@ -125,14 +118,6 @@ public class GwtTestStepResult implements Serializable {
this.timeTaken = timeTaken;
}
public String getOid_teststep() {
return oid_teststep;
}
public void setOid_teststep(String oid_teststep) {
this.oid_teststep = oid_teststep;
}
public String getEndpoint() {
return endpoint;
}
......@@ -141,7 +126,9 @@ public class GwtTestStepResult implements Serializable {
this.endpoint = endpoint;
}
public TransactionInstance getTransaction() { return messages; }
public TransactionInstance getTransaction() {
return messages;
}
public void setTransaction(TransactionInstance messages) {
this.messages = messages;
......@@ -215,30 +202,6 @@ public class GwtTestStepResult implements Serializable {
return null;
}
public String getXValContent() {
try {
if (this.messages.getRequest().getContent() != null) {
return XhtmlRendererFactory.getRenderer("xml").highlight("Request", Xml.prettyFormat(new String(this.messages.getRequest().getContent(), StandardCharsets.UTF_8)
), "UTF-8", false).replaceAll("<h1>.*</h1>", "");
} else {
return null;
}
} catch (IOException e) {
LOG.error("getXValRequestContent() : " + e.getMessage());
}
try {
if (this.messages.getResponse().getContent() != null) {
return XhtmlRendererFactory.getRenderer("xml").highlight("Response", Xml.prettyFormat(new String(this.messages.getResponse()
.getContent(), StandardCharsets.UTF_8)), "UTF-8", false).replaceAll("<h1>.*</h1>", "");
} else {
return null;
}
} catch (IOException e) {
LOG.error("getXValResponseContent() : " + e.getMessage());
}
return null;
}
public String getStatusForCss() {
if (getStatus() != null) {
if (getStatus().equals("OK")) {
......@@ -261,19 +224,6 @@ public class GwtTestStepResult implements Serializable {
gwtTestStepValidation.validate();
}
public void xvalidate() {
String xvalOid = testStep.getOid_xval();
GwtTestStepValidation gwtTestStepValidation = new GwtTestStepValidation(id + "xval", messages.getRequest().getContent(), messages.getResponse().getContent(), xvalOid);
try {
gwtTestStepValidation.xvalidate();
} catch (IOException e) {
e.printStackTrace();
}
}
public ValidationResult getResponseValidation() {
ValidationResultQuery query = new ValidationResultQuery();
query.gwtTestStepResult().eq(this);
......@@ -288,12 +238,6 @@ public class GwtTestStepResult implements Serializable {
return query.getUniqueResult();
}
public XValidationResult getXValidation() {
XValidationResultQuery query = new XValidationResultQuery();
query.gwtTestStepResult().eq(this);
return query.getUniqueResult();
}
public void downloadRequest() {
final String content = this.getMessages().getRequest().getContentAsString();
final String fileName = this.testStep.getLabel() + "_request.xml";
......
......@@ -105,7 +105,8 @@ public class Xdstools {
TestInstanceTm newTestInstanceTm = new TestInstanceTm(testInstanceId, systemKeyword, testingSession, testInstanceTmList.get(0).getNonce(), callingTool);
newTestInstanceTm.merge();
}
return redirect(testInstanceTmList.get(0).getNonce().getUrl());
String redirectUrl = testInstanceTmList.get(0).getNonce().getUrl() + getActorType(roleInTest) + "/" + getIntegrationProfileCode(integrationProfile) + "/" + getIntegrationProfileOptionCode(integrationProfileOption) + "/" + systemKeyword;
return redirect(redirectUrl);
} else
{
......@@ -116,8 +117,9 @@ public class Xdstools {
String response = getHTML(url);
getActorCode(actor);
if (response != null && !response.isEmpty()) {
String redirectUrl = PreferenceService.getString("xdstools_url") + "Xdstools2.html#ConfActor:default/" + response + "/" + getActorType(roleInTest) + "/" + getIntegrationProfileCode(integrationProfile) + "/" + getIntegrationProfileOptionCode(integrationProfileOption) + "/" + systemKeyword;
Nonce nonce = new Nonce(response, redirectUrl);
String baseUrl = PreferenceService.getString("xdstools_url") + "Xdstools2.html#ConfActor:default/" + response + "/";
String redirectUrl = baseUrl + getActorType(roleInTest) + "/" + getIntegrationProfileCode(integrationProfile) + "/" + getIntegrationProfileOptionCode(integrationProfileOption) + "/" + systemKeyword;
Nonce nonce = new Nonce(response, baseUrl);
TestInstanceTm newTestInstanceTm = new TestInstanceTm(testInstanceId, systemKeyword, testingSession, nonce, callingTool);
nonce.addTestInstanceTm(newTestInstanceTm);
nonce.merge();
......
......@@ -138,10 +138,7 @@
</g:column>
<g:column>
<ui:define name="header">Cross-Validation</ui:define>
<h:commandLink actionListener="#{testStepResult.xvalidate()}"
target="_blank">
<s:span title="X Validate" styleClass="gzl-icon-play-blue"/>
</h:commandLink>
<h:outputText value="Not yet implemented"/>
</g:column>
</rich:dataTable>
</ui:decorate>
......@@ -269,35 +266,7 @@
<rich:togglePanelItem name="#{testStepResult.id}" switchType="ajax">
<gri:panel>
<f:facet name="header">
<div class="row">
<div class="col-md-10">
<h:outputText value="#{testStepResult.getFullLabel()}"/>
</div>
<div class="col-md-2" style="text-align:right">
<h:outputText value="Cross Validation : "></h:outputText>
<h:outputLink
value="#{testStepResult.getXValidation().permanentLink}"
target="_blank">
<h:outputText
value="#{testStepResult.getXValidation().permanentLink}"/>
</h:outputLink>
<h:outputText
value="#{testStepResult.getXValidation().validationStatus}"
styleClass="gzl-label #{testStepResult.getXValidation().validationStatus}"
rendered="#{testStepResult.getXValidation() != null}"/>
<h:commandLink actionListener="#{testStepResult.xvalidate()}"
rendered="#{testStepResult.getXValidation() == null}"
target="_blank">
<s:span title="X Validate"
styleClass="gzl-icon-play-blue"/>
</h:commandLink>
<h:commandLink actionListener="#{testStepResult.xvalidate()}"
target="_blank"
rendered="#{testStepResult.getXValidation() != null}">
<s:span title="Re-X-validate" styleClass="gzl-icon-repeat"/>
</h:commandLink>
</div>
</div>
<h:outputText value="#{testStepResult.getFullLabel()}"/>
</f:facet>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">SoapUI Validation</ui:define>
......@@ -315,20 +284,10 @@
<h:outputText value="#{testStepResult.getTimestamp()}"/>
</s:decorate>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">Time Taken</ui:define>
<h:outputText value="#{testStepResult.timeTaken} ms"/>
</s:decorate>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">OID TestStep</ui:define>
<h:outputText value="#{testStepResult.oid_teststep}"/>
</s:decorate>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">OID XVAL</ui:define>
<h:outputText value="#{testStepResult.getTestStep().oid_xval}"/>
</s:decorate>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">Time Taken</ui:define>
<h:outputText value="#{testStepResult.timeTaken} ms"/>
</s:decorate>
<gri:panel
rendered="#{testStepResult.soapUIMessages != null and testStepResult.soapUIMessages.size() != 0}">
......
......@@ -4,84 +4,84 @@
xmlns:a4j="http://richfaces.org/a4j" xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core" xmlns="http://www.w3.org/1999/xhtml">
<h:head>
<h:outputStylesheet library="stylesheet" name="gazelle-webservice-tester-${gazelle-assets-version}.min.css"/>
<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"/>
<script>
// in case of conflicts
jq162 = jQuery.noConflict(true);
<h:head>
<h:outputStylesheet library="stylesheet" name="gazelle-webservice-tester-${gazelle-assets-version}.min.css"/>
<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"/>
<script>
// in case of conflicts
jq162 = jQuery.noConflict(true);
jq162(function () {
updateSelects();
jq162('[data-toggle="popover"]').popover({html: true})
});
jq162(function () {
updateSelects();
jq162('[data-toggle="popover"]').popover({html: true})
});
function updateSelects() {
updateSelects_(jq162, {allow_single_deselect: true, display_selected_options: true, width: "90%"});
}
</script>
</h:head>
<h:body>
<f:view>
<ui:include src="/ajaxStatus.xhtml"/>
<h:form>
<ui:decorate template="/layout/menu/_menu_template.xhtml">
<ui:define name="menu_title">
<h:outputLink value="/gazelle-webservice-tester/">
<h:outputText styleClass="navbar-brand" value="Gazelle Webservice Tester"/>
</h:outputLink>
</ui:define>
<ui:define name="menu_logo">
<h:graphicImage library="img" name="gazelle.png"/>
</ui:define>
<ui:define name="menu_navigation_links">
<ui:include src="/layout/menu_links.xhtml"/>
</ui:define>
<ui:define name="menu_user_actions_right">
<ui:decorate template="/layout/menu-right.xhtml">
<ui:param name="applicationRoot" value="gazelle-webservice-tester"/>
<ui:define name="administration_links">
<ui:include src="/layout/admin.xhtml"/>
</ui:define>
</ui:decorate>
</ui:define>
</ui:decorate>
</h:form>
function updateSelects() {
updateSelects_(jq162, {allow_single_deselect: true, display_selected_options: true, width: "90%"});
}
</script>
</h:head>
<h:body>
<f:view>
<ui:include src="/ajaxStatus.xhtml"/>
<h:form>
<ui:decorate template="/layout/menu/_menu_template.xhtml">
<ui:define name="menu_title">
<h:outputLink value="/gazelle-webservice-tester/">
<h:outputText styleClass="navbar-brand" value="Gazelle Webservice Tester"/>
</h:outputLink>
</ui:define>
<ui:define name="menu_logo">
<h:graphicImage library="img" name="gazelle.png"/>
</ui:define>
<ui:define name="menu_navigation_links">
<ui:include src="/layout/menu_links.xhtml"/>
</ui:define>
<ui:define name="menu_user_actions_right">
<ui:decorate template="/layout/menu-right.xhtml">
<ui:param name="applicationRoot" value="gazelle-webservice-tester"/>
<ui:define name="administration_links">
<ui:include src="/layout/admin.xhtml"/>
</ui:define>
</ui:decorate>
</ui:define>
</ui:decorate>
</h:form>
<div id="gzl-container">
<div class="row">
<div class="center-block gazelle-alert">
<s:decorate id="gazelle-messages">