fixes tests and coverage
This commit is contained in:
parent
99d2faf97d
commit
cacd780f50
8 changed files with 60 additions and 32 deletions
17
pom.xml
17
pom.xml
|
@ -174,25 +174,8 @@
|
|||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>post-unit-test</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- Sets the path to the file which contains the execution
|
||||
data. -->
|
||||
<dataFile>target/jacoco.exec</dataFile>
|
||||
<!-- Sets the output directory for the code coverage report. -->
|
||||
<outputDirectory>target/jacoco-ut</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- <includes> -->
|
||||
<!-- <include>ch/ethz/seb/sebserver/*</include> -->
|
||||
<!-- </includes> -->
|
||||
<excludes>
|
||||
<exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
|
||||
<exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>
|
||||
|
|
|
@ -32,15 +32,17 @@ public final class Indicator implements Entity {
|
|||
public static final String FILTER_ATTR_EXAM_ID = "examId";
|
||||
|
||||
public enum IndicatorType {
|
||||
LAST_PING(Names.LAST_PING),
|
||||
ERROR_COUNT(Names.ERROR_COUNT)
|
||||
LAST_PING(Names.LAST_PING, true),
|
||||
ERROR_COUNT(Names.ERROR_COUNT, true)
|
||||
|
||||
;
|
||||
|
||||
public final String name;
|
||||
public boolean integerValue;
|
||||
|
||||
private IndicatorType(final String name) {
|
||||
private IndicatorType(final String name, final boolean integerValue) {
|
||||
this.name = name;
|
||||
this.integerValue = integerValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ClientConnectionData {
|
|||
while (i1.hasNext()) {
|
||||
final IndicatorValue iv1 = i1.next();
|
||||
final IndicatorValue iv2 = i2.next();
|
||||
if (iv1.getType() != iv2.getType() || iv1.getValue() != iv2.getValue()) {
|
||||
if (iv1.getType() != iv2.getType() || Math.abs(iv1.getValue() - iv2.getValue()) > 0.1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,6 +245,14 @@ public final class ClientConnectionTable {
|
|||
(e1, e2) -> e1, LinkedHashMap::new));
|
||||
}
|
||||
|
||||
private static String getDisplayValue(final IndicatorValue indicatorValue) {
|
||||
if (indicatorValue.getType().integerValue) {
|
||||
return String.valueOf((int) indicatorValue.getValue());
|
||||
} else {
|
||||
return String.valueOf(indicatorValue.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private final class UpdatableTableItem implements Comparable<UpdatableTableItem> {
|
||||
|
||||
final Long connectionId;
|
||||
|
@ -313,7 +321,8 @@ public final class ClientConnectionTable {
|
|||
indicatorData.index,
|
||||
indicatorData.defaultColor);
|
||||
} else {
|
||||
tableItem.setText(indicatorData.index, String.valueOf(indicatorValue.getValue()));
|
||||
|
||||
tableItem.setText(indicatorData.index, getDisplayValue(indicatorValue));
|
||||
tableItem.setBackground(
|
||||
indicatorData.index,
|
||||
indicatorData.thresholdColor[this.thresholdColorIndices[i]].color);
|
||||
|
|
|
@ -24,8 +24,6 @@ public interface ClientIndicator extends IndicatorValue {
|
|||
|
||||
void init(Indicator indicatorDefinition, Long connectionId, boolean cachingEnabled);
|
||||
|
||||
String name();
|
||||
|
||||
Long examId();
|
||||
|
||||
Long connectionId();
|
||||
|
|
|
@ -18,7 +18,6 @@ public abstract class AbstractClientIndicator implements ClientIndicator {
|
|||
|
||||
protected Long examId;
|
||||
protected Long connectionId;
|
||||
protected String name;
|
||||
protected boolean cachingEnabled;
|
||||
|
||||
protected double currentValue = Double.NaN;
|
||||
|
@ -44,11 +43,6 @@ public abstract class AbstractClientIndicator implements ClientIndicator {
|
|||
return this.connectionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getValue() {
|
||||
if (Double.isNaN(this.currentValue) || !this.cachingEnabled) {
|
||||
|
|
|
@ -79,6 +79,9 @@ public class ClientIndicatorFactory {
|
|||
e);
|
||||
}
|
||||
}
|
||||
} catch (final RuntimeException e) {
|
||||
log.error("Failed to create ClientIndicator for ClientConnection: {}", clientConnection);
|
||||
throw e;
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to create ClientIndicator for ClientConnection: {}", clientConnection);
|
||||
}
|
||||
|
|
|
@ -966,8 +966,6 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
|||
// - save configuration in history
|
||||
// - change some attribute
|
||||
// - process an undo
|
||||
// - table value add, delete, modify
|
||||
// - export
|
||||
public void testUsecase10() throws IOException {
|
||||
final RestServiceImpl restService = createRestServiceForUser(
|
||||
"examAdmin2",
|
||||
|
@ -1159,4 +1157,45 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest {
|
|||
assertEquals("2", currentValue.value);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(11)
|
||||
// *************************************
|
||||
// Use Case 11: Login as examAdmin2 and create a new SEB Exam Configuration
|
||||
// - table value add, delete, modify
|
||||
// - export
|
||||
public void testUsecase11() throws IOException {
|
||||
final RestServiceImpl restService = createRestServiceForUser(
|
||||
"examAdmin2",
|
||||
"examAdmin2",
|
||||
new NewExamConfig(),
|
||||
new GetExamConfigNode(),
|
||||
new GetExamConfigNodePage(),
|
||||
new GetConfigurationPage(),
|
||||
new GetConfigurations(),
|
||||
new SaveExamConfigHistory(),
|
||||
new ExportExamConfig(),
|
||||
new GetFollowupConfiguration(),
|
||||
new SebExamConfigUndo(),
|
||||
new SaveExamConfigValue(),
|
||||
new SaveExamConfigTableValues(),
|
||||
new GetConfigurationValuePage(),
|
||||
new GetConfigurationValues(),
|
||||
new ActivateExamConfig(),
|
||||
new DeactivateExamConfig(),
|
||||
new GetUserAccountNames());
|
||||
|
||||
// get configuration page
|
||||
final Result<Page<ConfigurationNode>> pageResponse = restService
|
||||
.getBuilder(GetExamConfigNodePage.class)
|
||||
.call();
|
||||
|
||||
assertNotNull(pageResponse);
|
||||
assertFalse(pageResponse.hasError());
|
||||
final Page<ConfigurationNode> page = pageResponse.get();
|
||||
assertFalse(page.content.isEmpty());
|
||||
|
||||
final ConfigurationNode configurationNode = page.content.get(0);
|
||||
assertEquals("New Exam Config", configurationNode.name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue