use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDataServiceImplTest method testUpdateParameterSet.
public void testUpdateParameterSet() {
ParameterDataService pds = new ParameterDataServiceImpl();
Set<Parameter> paramSet = new LinkedHashSet<Parameter>();
for (int i = 0; i < 5; i++) {
paramSet.add(getParameter(PARAM_FAMILY, PARAM_ELEMENT + String.valueOf(i), String.valueOf(i)));
}
assertEquals(5, paramSet.size());
Iterator<Parameter> iter = paramSet.iterator();
int val = 0;
while (iter.hasNext()) {
assertEquals(val, Integer.valueOf(iter.next().getValue()).intValue());
val++;
}
Set<Parameter> paramToUpdate = new HashSet<Parameter>();
for (int i = 2; i < 5; i++) {
paramToUpdate.add(getParameter(PARAM_FAMILY, PARAM_ELEMENT + String.valueOf(i), String.valueOf(i + 10)));
}
assertEquals(3, paramToUpdate.size());
paramSet = pds.updateParameterSet(paramSet, paramToUpdate);
for (Parameter param : paramSet) {
int length = param.getParameterElement().getParameterElementCode().length();
int index = Integer.valueOf(param.getParameterElement().getParameterElementCode().substring(length - 1, length)).intValue();
if (index < 2) {
assertEquals(index, Integer.valueOf(param.getValue()).intValue());
} else {
assertEquals(index + 10, Integer.valueOf(param.getValue()).intValue());
}
}
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDataServiceImplTest method testUpdateParameter.
public void testUpdateParameter() {
ParameterDataService pds = new ParameterDataServiceImpl();
Set<Parameter> paramSet = new LinkedHashSet<Parameter>();
for (int i = 0; i < 5; i++) {
paramSet.add(getParameter(PARAM_FAMILY, PARAM_ELEMENT + String.valueOf(i), String.valueOf(i)));
}
assertEquals(5, paramSet.size());
paramSet = pds.updateParameter(paramSet, getParameter(PARAM_FAMILY, PARAM_ELEMENT + String.valueOf(3), String.valueOf(13)));
for (Parameter param : paramSet) {
if (param.getParameterElement().getParameterElementCode().equalsIgnoreCase(PARAM_ELEMENT + String.valueOf(3))) {
assertEquals(13, Integer.valueOf(param.getValue()).intValue());
} else {
int length = param.getParameterElement().getParameterElementCode().length();
assertEquals(Integer.valueOf(param.getParameterElement().getParameterElementCode().substring(length - 1, length)).intValue(), Integer.valueOf(param.getValue()).intValue());
}
}
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class WebResourceStatisticsDataServiceImpl method setWeightedResult.
/**
* @param wrStatistics
*/
private void setWeightedResult(WebResourceStatistics wrStatistics, WebResource webResource) {
// TODO: Collection à initialiser
Collection<Parameter> paramSet = new ArrayList<>();
BigDecimal weightedPassed = this.getWeightedResultByResultType(webResource.getId(), paramSet, TestSolution.PASSED, true);
BigDecimal weightedFailed = this.getWeightedResultByResultType(webResource.getId(), paramSet, TestSolution.FAILED, true);
BigDecimal weightedNa = this.getWeightedResultByResultType(webResource.getId(), paramSet, TestSolution.NOT_APPLICABLE, true);
BigDecimal weightedNmi = this.getWeightedResultByResultType(webResource.getId(), paramSet, TestSolution.NEED_MORE_INFO, true);
wrStatistics.setWeightedFailed(weightedFailed);
wrStatistics.setWeightedPassed(weightedPassed);
wrStatistics.setWeightedNmi(weightedNmi);
wrStatistics.setWeightedNa(weightedNa);
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDAOImplTest method testFindDefaultParameterSet.
@Test
public void testFindDefaultParameterSet() {
Set<Parameter> paramSet = parameterDAO.findDefaultParameterSet();
assertEquals(2, paramSet.size());
// and "Value5"
for (Parameter param : paramSet) {
if (param.getValue().equals("Value1") || param.getValue().equals("Value5")) {
assertTrue(true);
} else {
assertTrue(false);
}
}
}
use of org.asqatasun.entity.parameterization.Parameter in project Asqatasun by Asqatasun.
the class ParameterDataServiceImpl method getAuditPageParameterSet.
@Override
public Set<Parameter> getAuditPageParameterSet(Set<Parameter> defaultParameterSet) {
ParameterElement parameterElement = parameterElementDataService.getDepthParameterElement();
Parameter depthParameter = getParameter(parameterElement, "0");
Set<Parameter> auditPageParamSet = updateParameter(defaultParameterSet, depthParameter);
return auditPageParamSet;
}
Aggregations