Commit 4a83be76 authored by Malo Toudic's avatar Malo Toudic
Browse files
parent ee526688
......@@ -31,6 +31,7 @@ public class ExecutionResult {
private static final Logger LOG = LoggerFactory.getLogger(ExecutionResult.class);
private Execution execution;
private List<CustomPropertyUsed> customPropertyUsedList;
private GazelleTreeNodeImpl<TestComponent> tree;
@RequestParameter("id")
private Integer id;
......@@ -63,9 +64,19 @@ public class ExecutionResult {
this.id = id;
}
public GazelleTreeNodeImpl<TestComponent> getTree() {
return tree;
}
public void setTree(GazelleTreeNodeImpl<TestComponent> tree) {
this.tree = tree;
}
@Create
public void init() {
execution = ExecutionDao.getExecutionById(id);
tree = Tree.getComponentWithParentsAsTree(execution.getTestComponent());
}
public String getSoapuiProject() {
......@@ -128,8 +139,8 @@ public class ExecutionResult {
return false;
}
public GazelleTreeNodeImpl<TestComponent> getComponentWithParentsAsTree() {
return Tree.getComponentWithParentsAsTree(execution.getTestComponent());
public int numberOfCustumPropertiesUsed(TestComponent testComponent) {
return testComponent.getCustomPropertiesUsed(execution).size();
}
private String current;
......
......@@ -29,6 +29,7 @@ import org.richfaces.model.UploadedFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.event.ValueChangeEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -50,6 +51,7 @@ public class UploadProject implements Serializable {
private SoapuiProject soapuiProject;
private List<CustomProperty> customPropertyList;
private GazelleTreeNodeImpl<TestComponent> tree;
private boolean checkAllProperties;
public SoapuiProject getSoapuiProject() {
return soapuiProject;
......@@ -73,6 +75,21 @@ public class UploadProject implements Serializable {
public void setCustomPropertyList(List<CustomProperty> customPropertyList) {
this.customPropertyList = customPropertyList;
boolean allToModify = true;
for (CustomProperty customProperty : customPropertyList) {
if (customProperty.isToModify() == false) {
allToModify = false;
}
}
checkAllProperties = allToModify;
}
public boolean isCheckAllProperties() {
return checkAllProperties;
}
public void setCheckAllProperties(boolean checkAllProperties) {
this.checkAllProperties = checkAllProperties;
}
public GazelleTreeNodeImpl<TestComponent> getTree() {
......@@ -249,6 +266,16 @@ public class UploadProject implements Serializable {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "Invalid file type. Expected file type is xml");
}
public void checkAll(ValueChangeEvent event) {
changeAllPropertiesToModify((boolean) event.getNewValue());
}
public void changeAllPropertiesToModify(boolean toModify) {
for (CustomProperty customProperty : customPropertyList) {
customProperty.setToModify(toModify);
}
}
public String redirectToDetail() {
if (checkLabelInDb()) {
this.moveTmpFile();
......
......@@ -15,6 +15,7 @@ import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
......@@ -62,6 +63,9 @@ public abstract class TestComponent implements Serializable {
)
private List<Execution> executionList;
@Transient
private boolean expendedInTree;
public TestComponent() {
super();
}
......@@ -142,6 +146,17 @@ public abstract class TestComponent implements Serializable {
this.executable = executable;
}
public boolean isExpendedInTree() {
return expendedInTree;
}
public void setExpendedInTree(boolean expendedInTree) {
this.expendedInTree = expendedInTree;
}
public abstract String getClassName();
public int numberOfCustumProperties() {
return customProperties.size();
}
}
......@@ -24,6 +24,7 @@ public class Tree {
private static void getProjectAsTree(GwtProject gwtProject, GazelleTreeNodeImpl<TestComponent> parentNode, int index, boolean withTestStep) {
GazelleTreeNodeImpl<TestComponent> nodeProject = new GazelleTreeNodeImpl<>();
gwtProject.setExpendedInTree(true);
nodeProject.setData(gwtProject);
parentNode.addChild(index, nodeProject);
index++;
......@@ -36,6 +37,7 @@ public class Tree {
private static void getTestSuiteAsTree(GwtTestSuite testSuite, GazelleTreeNodeImpl<TestComponent> parentNode, int index, boolean withTestStep) {
if (!testSuite.isDisable()) {
GazelleTreeNodeImpl<TestComponent> nodeSuite = new GazelleTreeNodeImpl<>();
testSuite.setExpendedInTree(true);
nodeSuite.setData(testSuite);
parentNode.addChild(index, nodeSuite);
for (GwtTestCase testCase : testSuite.getTestCases()) {
......@@ -48,12 +50,14 @@ public class Tree {
private static void getTestCaseAsTree(GwtTestCase testCase, GazelleTreeNodeImpl<TestComponent> parentNode, int index, boolean withTestStep) {
if (!testCase.isDisable()) {
GazelleTreeNodeImpl<TestComponent> nodeCase = new GazelleTreeNodeImpl<>();
testCase.setExpendedInTree(true);
nodeCase.setData(testCase);
parentNode.addChild(index, nodeCase);
if (withTestStep) {
for (GwtTestStep testStep : testCase.getTestSteps()) {
if (!testStep.isDisable()) {
GazelleTreeNodeImpl<TestComponent> nodeStep = new GazelleTreeNodeImpl<>();
testStep.setExpendedInTree(true);
nodeStep.setData(testStep);
nodeCase.addChild(index, nodeStep);
index++;
......@@ -70,17 +74,20 @@ public class Tree {
getProjectAsTree((GwtProject) testComponent, treeRoot, index, false);
} else if (testComponent instanceof GwtTestSuite) {
GazelleTreeNodeImpl<TestComponent> nodeProject = new GazelleTreeNodeImpl<>();
((GwtTestSuite) testComponent).getProject().setExpendedInTree(true);
nodeProject.setData(((GwtTestSuite) testComponent).getProject());
treeRoot.addChild(index, nodeProject);
index++;
getTestSuiteAsTree((GwtTestSuite) testComponent, nodeProject, index, false);
} else if (testComponent instanceof GwtTestCase) {
GazelleTreeNodeImpl<TestComponent> nodeProject = new GazelleTreeNodeImpl<>();
((GwtTestCase) testComponent).getTestSuite().getProject().setExpendedInTree(true);
nodeProject.setData(((GwtTestCase) testComponent).getTestSuite().getProject());
treeRoot.addChild(index, nodeProject);
index++;
GazelleTreeNodeImpl<TestComponent> nodeSuite = new GazelleTreeNodeImpl<>();
((GwtTestCase) testComponent).getTestSuite().setExpendedInTree(true);
nodeSuite.setData(((GwtTestCase) testComponent).getTestSuite());
nodeProject.addChild(index, nodeSuite);
index++;
......
......@@ -154,34 +154,34 @@
<div class="row">
<div class="col-md-6">
<rich:tree id="treeOfParams" value="#{executionResult.getComponentWithParentsAsTree()}"
<rich:tree id="treeOfParams" value="#{executionResult.tree}"
var="node">
<rich:treeNode iconExpanded="images/testcase.png"
iconCollapsed="images/testcase.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestCase'}"
expanded="#{true}">
expanded="#{node.data.expendedInTree}">
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{executionResult.setCustomPropertyUsedList(node.data)}"
oncomplete="sidebarReset()"
value="#{node.data.label}"/>
value="#{node.data.label} [#{executionResult.numberOfCustumPropertiesUsed(node.data)}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="images/testsuite.png"
iconCollapsed="images/testsuite.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestSuite'}"
expanded="#{true}">
expanded="#{node.data.expendedInTree}">
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{executionResult.setCustomPropertyUsedList(node.data)}"
oncomplete="sidebarReset()"
value="#{node.data.label}"/>
value="#{node.data.label} [#{executionResult.numberOfCustumPropertiesUsed(node.data)}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="images/project.png"
iconCollapsed="images/project.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtProject'}"
expanded="#{true}">
expanded="#{node.data.expendedInTree}">
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{executionResult.setCustomPropertyUsedList(node.data)}"
oncomplete="sidebarReset()"
value="#{node.data.label}"/>
value="#{node.data.label} [#{executionResult.numberOfCustumPropertiesUsed(node.data)}]"/>
</rich:treeNode>
</rich:tree>
</div>
......
......@@ -43,7 +43,7 @@
<rich:treeNode iconExpanded="images/teststep.png"
iconCollapsed="images/teststep.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestStep'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
......@@ -52,7 +52,7 @@
<rich:treeNode iconExpanded="images/testcase.png"
iconCollapsed="images/testcase.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestCase'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
......@@ -61,7 +61,7 @@
<rich:treeNode iconExpanded="images/testsuite.png"
iconCollapsed="images/testsuite.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestSuite'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
......@@ -70,7 +70,7 @@
<rich:treeNode iconExpanded="images/project.png"
iconCollapsed="images/project.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtProject'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
......
......@@ -40,7 +40,8 @@
<h:outputText value="#{projectDetail.projectDetail.soapuiProject.creationDate}"/>
</s:decorate>
<s:decorate template="/layout/display/_display.xhtml" rendered="#{projectDetail.editProject == false}">
<s:decorate template="/layout/display/_display.xhtml"
rendered="#{projectDetail.editProject == false}">
<ui:define name="label">Keystore</ui:define>
<h:outputText value="#{projectDetail.projectDetail.soapuiProject.keystore.label}"
rendered="#{projectDetail.projectDetail.soapuiProject.keystore != null}"/>
......@@ -77,42 +78,42 @@
<rich:treeNode iconExpanded="../images/teststep.png"
iconCollapsed="../images/teststep.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestStep'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"
disabled="#{projectDetail.editProject == false}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{projectDetail.projectDetail.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="../images/testcase.png"
iconCollapsed="../images/testcase.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestCase'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"
disabled="#{projectDetail.editProject == false}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{projectDetail.projectDetail.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="../images/testsuite.png"
iconCollapsed="../images/testsuite.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestSuite'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"
disabled="#{projectDetail.editProject == false}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{projectDetail.projectDetail.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="../images/project.png"
iconCollapsed="../images/project.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtProject'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"
disabled="#{projectDetail.editProject == false}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{projectDetail.projectDetail.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
</rich:tree>
</div>
......@@ -125,7 +126,8 @@
<rich:list value="#{projectDetail.projectDetail.customPropertyList}" id="list"
var="paramSelected"
type="unordered">
type="unordered"
rendered="#{not empty projectDetail.projectDetail.customPropertyList}">
<s:decorate template="/layout/form/_checkbox.xhtml">
<h:selectBooleanCheckbox value="#{paramSelected.toModify}"
disabled="#{projectDetail.editProject == false}"/>
......@@ -135,6 +137,12 @@
</s:decorate>
</s:decorate>
</rich:list>
<rich:panel styleClass="gzl-alert gzl-alert-blue"
rendered="#{empty uploadProject.customPropertyList}">
<h:outputText
value="There is no custom properties for this component."/>
</rich:panel>
</gri:panel>
</s:div>
</div>
......@@ -147,10 +155,15 @@
rendered="#{projectDetail.editProject == false and s:hasRole('admin_role') and projectDetail.projectDetail.soapuiProject.active == false}"
render="pageDiv"/>
<a4j:commandButton value="Edit" action="#{projectDetail.setEditProject(true)}"
styleClass="gzl-btn-blue" rendered="#{projectDetail.editProject == false and s:hasRole('admin_role')}" render="pageDiv"/>
styleClass="gzl-btn-blue"
rendered="#{projectDetail.editProject == false and s:hasRole('admin_role')}"
render="pageDiv"/>
<h:commandButton value="Save" action="#{projectDetail.saveEditProject()}"
styleClass="gzl-btn-blue" render="pageDiv" rendered="#{projectDetail.editProject}"/>
<h:commandButton value="Cancel" action="#{projectDetail.setEditProject(false)}" styleClass="gzl-btn" rendered="#{projectDetail.editProject}" immediate="true" render="pageDiv"/>
styleClass="gzl-btn-blue" render="pageDiv"
rendered="#{projectDetail.editProject}"/>
<h:commandButton value="Cancel" action="#{projectDetail.setEditProject(false)}"
styleClass="gzl-btn" rendered="#{projectDetail.editProject}" immediate="true"
render="pageDiv"/>
<h:commandButton value="Back to list" action="/project/projectList.seam" styleClass="gzl-btn"/>
</f:facet>
</gri:panel>
......
......@@ -116,7 +116,7 @@
<rich:treeNode iconExpanded="images/testcase.png"
iconCollapsed="images/testcase.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestCase'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox rendered="#{node.data.executable}">
<a4j:ajax event="click"
listener="#{runSoapui.setCurrentNodeEventAndPrepareExecution}"
......@@ -128,7 +128,7 @@
<rich:treeNode iconExpanded="images/testsuite.png"
iconCollapsed="images/testsuite.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestSuite'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox rendered="#{node.data.executable}">
<a4j:ajax event="click"
listener="#{runSoapui.setCurrentNodeEventAndPrepareExecution}"
......@@ -140,7 +140,7 @@
<rich:treeNode iconExpanded="images/project.png"
iconCollapsed="images/project.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtProject'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox rendered="#{node.data.executable}">
<a4j:ajax event="click"
listener="#{runSoapui.setCurrentNodeEventAndPrepareExecution}"
......
......@@ -17,7 +17,8 @@
value="Please upload the SoapUi project"/>
<rich:fileUpload id="uploadSoapUIFile" fileUploadListener="#{uploadProject.uploadEventListener}"
<rich:fileUpload id="uploadSoapUIFile"
fileUploadListener="#{uploadProject.uploadEventListener}"
maxFilesQuantity="1"
acceptedTypes="xml"
listHeight="60px"
......@@ -94,38 +95,38 @@
<rich:treeNode iconExpanded="images/teststep.png"
iconCollapsed="images/teststep.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestStep'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="images/testcase.png"
iconCollapsed="images/testcase.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestCase'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="images/testsuite.png"
iconCollapsed="images/testsuite.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtTestSuite'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
<rich:treeNode iconExpanded="images/project.png"
iconCollapsed="images/project.png"
rendered="#{node.data.getClass().getSimpleName() == 'GwtProject'}"
expanded="true">
expanded="#{node.data.expendedInTree}">
<h:selectBooleanCheckbox value="#{node.data.executable}"/>
<a4j:commandLink render="paramPanel" ajaxSingle="true"
actionListener="#{uploadProject.setCustomPropertyList(node.data.customProperties)}"
value="#{node.data.label}"/>
value="#{node.data.label} [#{node.data.numberOfCustumProperties()}]"/>
</rich:treeNode>
</rich:tree>
</div>
......@@ -136,16 +137,37 @@
<h:outputText value="Parameters"/>
</f:facet>
<rich:list value="#{uploadProject.customPropertyList}" id="list"
var="paramList" type="unordered">
<s:decorate template="/layout/form/_checkbox.xhtml">
<h:selectBooleanCheckbox value="#{paramList.toModify}"/>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">#{paramList.label}</ui:define>
<h:outputText value="#{paramList.defaultValue}"/>
<s:div rendered="#{not empty uploadProject.customPropertyList}">
<rich:list value="#{uploadProject.customPropertyList}" id="list"
var="paramList" type="unordered">
<s:decorate template="/layout/form/_checkbox.xhtml">
<h:selectBooleanCheckbox value="#{paramList.toModify}"/>
<s:decorate template="/layout/display/_display.xhtml">
<ui:define name="label">#{paramList.label}
</ui:define>
<h:outputText value="#{paramList.defaultValue}"/>
</s:decorate>
</s:decorate>
</rich:list>
<s:decorate template="/layout/form/_checkbox.xhtml">
<h:selectBooleanCheckbox
value="#{uploadProject.checkAllProperties}"
valueChangeListener="#{uploadProject.checkAll}">
<f:ajax render="list"/>
</h:selectBooleanCheckbox>
<h:outputText value="Select all the custom properties"/>
</s:decorate>
</rich:list>
</s:div>
<rich:panel styleClass="gzl-alert gzl-alert-blue"
rendered="#{empty uploadProject.customPropertyList}">
<h:outputText
value="There is no custom properties for this component."/>
</rich:panel>
</gri:panel>
</s:div>
</div>
......
Supports Markdown
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