Fix tests.

This commit is contained in:
Fabian Märki
2019-02-21 10:32:13 +01:00
parent 0cfa4ac8da
commit d123effc36
5 changed files with 15 additions and 6 deletions

View File

@ -73,7 +73,7 @@ public class BackendTest extends AbstractDaqRestTest {
timeout = context.getBean(DomainConfig.BEAN_NAME_QUERY_TIMEOUT, Integer.class);
assertEquals(11, timeout);
if (backend.getId() == 255) {
if (backend.getId() == 253) {
// from test-overload.properties
timeout = context.getBean(DomainConfig.BEAN_NAME_SHUTDOWN_TIMEOUT, Integer.class);
assertEquals(32, timeout);
@ -106,7 +106,7 @@ public class BackendTest extends AbstractDaqRestTest {
timeout = context.getBean(DomainConfig.BEAN_NAME_DELETE_TIMEOUT, Integer.class);
assertEquals(43, timeout);
} else if (backend.getId() == 253) {
} else if (backend.getId() == 255) {
// from queryrest-test.properties
timeout = context.getBean(DomainConfig.BEAN_NAME_SHUTDOWN_TIMEOUT, Integer.class);
assertEquals(31, timeout);

View File

@ -79,7 +79,8 @@ public class JsonQueryRestControllerTableTest extends AbstractDaqRestTest implem
context = backend.getApplicationContext();
for (final Backend baknd : Backend.getBackends()) {
if (baknd != backend) {
// make sure we get one of the test backends
if (baknd != backend && baknd.getId() > 250) {
backend2 = baknd;
break;
}

View File

@ -84,7 +84,8 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest implements
context = backend.getApplicationContext();
for (final Backend baknd : Backend.getBackends()) {
if (baknd != backend) {
// make sure we get one of the test backends
if (baknd != backend && baknd.getId() > 250) {
if (backend2 == null) {
backend2 = baknd;
} else if (backend3 == null) {
@ -549,6 +550,7 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest implements
new AggregationDescriptor().setNrOfBins(2),
TEST_CHANNEL_NAMES);
request.addEventField(EventField.pulseId);
request.addEventField(EventField.globalTime);
request.addEventField(EventField.eventCount);
String content = mapper.writeValueAsString(request);
@ -565,15 +567,19 @@ public class JsonQueryRestControllerTest extends AbstractDaqRestTest implements
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalTime").value(1000000000))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].eventCount").value(50))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalTime").value(1500000000))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(150))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].eventCount").value(50))
.andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
.andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.name").value(TEST_CHANNEL_02))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalTime").value(1000000000))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(100))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].eventCount").value(50))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalTime").value(1500000000))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(150))
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].eventCount").value(50));
}

View File

@ -80,7 +80,9 @@ public class QueryManagerRemoteTest extends AbstractDaqRestTest {
@Test
public void testStatisticsJSON_01() throws Exception {
final ObjectMapper objectMapper = context.getBean(DomainConfig.BEAN_NAME_OBJECT_MAPPER, ObjectMapper.class);
final ObjectMapper objectMapper = context.getBean(DomainConfig.BEAN_NAME_OBJECT_MAPPER, ObjectMapper.class)
.copy();
objectMapper.registerSubtypes(StorelessStatistics.class);
final StorelessStatistics stats1 = new StorelessStatistics(3);
stats1.add(5);

View File

@ -1,7 +1,7 @@
backend.types=ch.psi.daq.filestorage.backend.FilestorageBackendType,ch.psi.daq.archiverappliance.backend.ArchiverApplianceBackendType
backend.default=queryrest-1
backends.active=["queryrest-1","queryrest-2","queryrest-3"]
backends=[{"id":255,"name":"queryrest-1","dbKey":255,"type":{"name":"filestorage"},"properties":["classpath:test-overload.properties"],"packages":["ch.psi.daq.filestorage.config"]},{"id":254,"name":"queryrest-2","dbKey":254,"type":{"name":"filestorage"},"properties":["classpath:test-overload2.properties"],"packages":["ch.psi.daq.filestorage.config"]},{"id":253,"name":"queryrest-3","dbKey":253,"type":{"name":"archiverappliance"},"properties":["classpath:test-overload3.properties"],"packages":["ch.psi.daq.archiverappliance.config"]}]
backends=[{"id":253,"name":"queryrest-1","dbKey":253,"type":{"name":"filestorage"},"properties":["classpath:test-overload.properties"],"packages":["ch.psi.daq.filestorage.config"]},{"id":254,"name":"queryrest-2","dbKey":254,"type":{"name":"filestorage"},"properties":["classpath:test-overload2.properties"],"packages":["ch.psi.daq.filestorage.config"]},{"id":255,"name":"queryrest-3","dbKey":255,"type":{"name":"archiverappliance"},"properties":["classpath:test-overload3.properties"],"packages":["ch.psi.daq.archiverappliance.config"]}]
query.hazelcast.node=true