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

run project correction

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/simulators/gazelle-webservice-tester/trunk@60149 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent 58740824
......@@ -14,6 +14,14 @@
<packaging>ejb</packaging>
<name>gazelle-webservice-tester - EJB - JAR</name>
<repositories>
<repository>
<id>smartbear</id>
<name>smartbear repository</name>
<url>http://smartbearsoftware.com/repository/maven2</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
......@@ -149,9 +157,15 @@
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>com.github.redfish4ktc.soapui</groupId>
<artifactId>maven-soapui-extension-plugin</artifactId>
<version>4.6.4.2</version>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>5.3.0</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
......
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.wstester.dao.SoapuiProjectDao;
import net.ihe.gazelle.wstester.model.SoapuiProject;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Name("run")
@Scope(ScopeType.PAGE)
public class Run implements Serializable {
private static final Logger LOG = LoggerFactory.getLogger(Run.class);
private List<SoapuiProject> soapuiProjects;
private SoapuiProject currentProject;
public List<SoapuiProject> getSoapuiProjects() {
return soapuiProjects;
}
public void setSoapuiProjects(List<SoapuiProject> soapuiProjects) {
this.soapuiProjects = soapuiProjects;
}
public List<String> getSoapuiProjectsLabel() {
List<String> listLabel = new ArrayList<>();
for (SoapuiProject project : soapuiProjects) {
listLabel.add(project.getLabel());
}
return listLabel;
}
@Create
public void init() {
setSoapuiProjects(SoapuiProjectDao.getAllSoapuiProject());
}
}
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.common.tree.GazelleTreeNodeImpl;
import net.ihe.gazelle.wstester.dao.SoapuiProjectDao;
import net.ihe.gazelle.wstester.model.GwtTestSuite;
import net.ihe.gazelle.wstester.model.SoapuiProject;
import net.ihe.gazelle.wstester.model.TestParameter;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.util.List;
@Name("runSoapui")
@Scope(ScopeType.PAGE)
public class RunSoapui implements Serializable {
private static final Logger LOGGER = LoggerFactory.getLogger(RunSoapui.class);
private SoapuiProject currentProject = null;
public SoapuiProject getCurrentProject() {
RunSoapui.LOGGER.info("Get project");
return currentProject;
}
public void setCurrentProject(SoapuiProject currentProject) {
RunSoapui.LOGGER.info("Set project " + (currentProject != null ? currentProject.getLabel() : "null"));
this.currentProject = currentProject;
}
public List<SoapuiProject> getSoapuiProjects() {
return SoapuiProjectDao.getAllSoapuiProject();
}
public GazelleTreeNodeImpl<TestParameter> getProjectAsTree() {
GazelleTreeNodeImpl<TestParameter> treeRoot = new GazelleTreeNodeImpl<>();
GazelleTreeNodeImpl<TestParameter> nodeProject = new GazelleTreeNodeImpl<>();
int index = 0;
nodeProject.setData(currentProject);
treeRoot.addChild(index, nodeProject);
index++;
for (GwtTestSuite testSuite : currentProject.getTestSuites()) {
GazelleTreeNodeImpl<TestParameter> nodeSuite = new GazelleTreeNodeImpl<>();
nodeSuite.setData(testSuite);
nodeProject.addChild(index, nodeSuite);
index++;
}
return treeRoot;
}
}
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.wstester.dao.SoapuiProjectDao;
import net.ihe.gazelle.wstester.model.SoapuiProject;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.faces.Converter;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@Name("soapuiProjectConverter")
@BypassInterceptors
@Converter(forClass = SoapuiProject.class)
public class SoapuiProjectConverter implements javax.faces.convert.Converter {
private static final Logger LOGGER = LoggerFactory.getLogger(SoapuiProjectConverter.class);
@Override
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) {
return SoapuiProjectDao.getListSoapuiProjectByLabel(s);
}
@Override
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object o) {
if (o != null && o instanceof SoapuiProject) {
SoapuiProject project = (SoapuiProject) o;
return project.getLabel();
} else {
return null;
}
}
}
......@@ -93,7 +93,7 @@ public class UploadProject implements Serializable {
} catch (final IOException e) {
UploadProject.LOGGER.error(e.getMessage());
} catch (Exception e) {
System.out.println(e);
UploadProject.LOGGER.error(e.getMessage());
} finally {
if (fos != null) {
try {
......@@ -184,9 +184,7 @@ public class UploadProject implements Serializable {
Files.move(Paths.get(soapuiProject.getXmlFilePath()), Paths.get(target));
soapuiProject.setXmlFilePath(target);
} catch (IOException e) {
// e.printStackTrace();
LOGGER.error(e.getMessage());
UploadProject.LOGGER.error(e.getMessage());
}
soapuiProject = SoapuiProjectDao.mergeSoapuiProject(soapuiProject);
}
......
......@@ -43,10 +43,17 @@ public class SoapuiProjectDao {
return EntityManagerService.provideEntityManager().find(SoapuiProject.class, id);
}
public static List<SoapuiProject> getListSoapuiProjectByLabel(String label) {
public static SoapuiProject getListSoapuiProjectByLabel(String label) {
SoapuiProjectQuery query = new SoapuiProjectQuery();
query.label().eq(label);
return query.getListNullIfEmpty();
List<SoapuiProject> projects = query.getListNullIfEmpty();
if (projects == null) {
SoapuiProjectDao.LOGGER.error("There is no project with the label : " + label);
return null;
} else {
return projects.get(0);
}
}
public static List<SoapuiProject> getAllSoapuiProject() {
......
......@@ -49,7 +49,7 @@ public class Execution implements Serializable {
public Execution(String launchBy, Date launchDate, List<TestStepResult> testStepResults) {
this.launchBy = launchBy;
this.launchDate = launchDate;
this.launchDate = new Date(launchDate.getTime());
this.testStepResults = testStepResults;
}
......@@ -70,11 +70,11 @@ public class Execution implements Serializable {
}
public Date getLaunchDate() {
return launchDate;
return new Date(launchDate.getTime());
}
public void setLaunchDate(Date launchDate) {
this.launchDate = launchDate;
this.launchDate = new Date(launchDate.getTime());
}
public List<TestStepResult> getTestStepResults() {
......
......@@ -70,6 +70,14 @@ public class ParameterUsed implements Serializable {
this.testStepResult = testStepResult;
}
public SystemConfiguration getSystemConfiguration() {
return systemConfiguration;
}
public void setSystemConfiguration(SystemConfiguration systemConfiguration) {
this.systemConfiguration = systemConfiguration;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
......
......@@ -88,7 +88,7 @@ public class SoapuiProject implements Serializable, TestParameter {
this.version = version;
this.active = active;
this.owner = owner;
this.creationDate = creationDate;
this.creationDate = new Date(creationDate.getTime());
this.keystores = keystores;
this.testSuites = testSuites;
}
......@@ -142,11 +142,11 @@ public class SoapuiProject implements Serializable, TestParameter {
}
public Date getCreationDate() {
return creationDate;
return new Date(creationDate.getTime());
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
this.creationDate = new Date(creationDate.getTime());
}
public List<Keystore> getKeystores() {
......
......@@ -4,5 +4,5 @@ import java.util.List;
public interface TestParameter {
public List<Parameter> getParameters();
List<Parameter> getParameters();
}
......@@ -69,6 +69,14 @@ public class TestStepResult implements Serializable {
this.execution = execution;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStatus() {
return status;
}
......
......@@ -85,6 +85,10 @@
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
......
......@@ -13,7 +13,7 @@
</h:outputLink>
</li>
<li>
<h:outputLink value="/gazelle-webservice-tester/run.seam">
<h:outputLink value="/gazelle-webservice-tester/runProject.seam">
<h:outputText value="Run"/>
</h:outputLink>
</li>
......
......@@ -6,8 +6,6 @@
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"/>
<h:outputScript library="jscript" name="autofocus.js"/>
<h:outputScript library="jscript" name="activeModal.js"/>
<title>My Simulator</title>
<link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
......@@ -63,6 +61,8 @@
</ui:define>
</ui:decorate>
</h:form>
<div id="gzl-container">
<div class="row">
<div class="center-block gazelle-alert">
......
......@@ -45,7 +45,7 @@
<div class="col-md-6">
<rich:tree id="treeOfParams" value="#{projectDetail.getProjectAsTree()}"
var="node" style="vertical-align:top" toggleType="client" showConnectingLines="true">
<rich:treeNode expanded="true">
<rich:treeNode>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{projectDetail.setParameterList(node.data.parameters)}"
value="#{node.data.label}"/>
......
......@@ -59,7 +59,7 @@
</ui:decorate>
<s:div id="resultDiv">
<rich:dataTable value="#{projectList.soapuiProjects()}" var="project" styleClass="table table-striped table-responsive">
<rich:dataTable value="#{projectList.soapuiProjects}" var="project" styleClass="table table-striped table-responsive">
<g:column sortBy="#{'id'}">
<ui:define name="header">Id</ui:define>
......
<ui:composition xmlns:h="http://java.sun.com/jsf/html" xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:gri="http://java.sun.com/jsf/composite/gri" xmlns="http://www.w3.org/1999/xhtml"
template="//layout/template.xhtml">
<ui:param name="pageNameTitle" value="Run a SaopUI project"/>
<ui:define name="body">
<h:form>
<s:div id="globalDiv">
<gri:panel>
<f:facet name="header">
<h:outputText value="Project"/>
</f:facet>
<h:selectOneMenu styleClass="form-control gzl-select-text" value="Test">
<f:selectItems value="#{run.getSoapuiProjectsLabel()}"/>
<f:ajax listener="#{run.selectProject}"/>
</h:selectOneMenu>
<f:facet name="footer">
<h:outputText value="Panel footer"/>
</f:facet>
</gri:panel>
</s:div>
</h:form>
</ui:define>
</ui:composition>
\ No newline at end of file
<ui:composition xmlns:h="http://java.sun.com/jsf/html" xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns="http://www.w3.org/1999/xhtml"
template="/layout/template.xhtml">
<ui:param name="pageNameTitle" value="Run a SaopUI project"/>
<ui:define name="body">
<h:form id="formProject">
<s:decorate template="/layout/form/_edit.xhtml">
<ui:param name="id" value="selectProject"/>
<ui:define name="label">Project</ui:define>
<h:selectOneMenu id="selectProject" styleClass="form-control"
value="#{runSoapui.currentProject}" required="true">
<f:selectItem itemValue="#{null}" itemLabel="Please select..."
noSelectionOption="true"/>
<f:selectItems value="#{runSoapui.soapuiProjects}" var="uiproject" itemLabel="#{uiproject.label}"/>
<f:converter converterId="soapuiProjectConverter"/>
</h:selectOneMenu>
<h:commandButton value="Select" styleClass="gzl-btn-blue" render="result"/>
</s:decorate>
</h:form>
<s:div id="result">
<h:outputText value="It works !" rendered="#{runSoapui.currentProject != null}"/>
</s:div>
</ui:define>
</ui:composition>
\ No newline at end of file
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