ATEST-311
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# defines the fields that are included in the response
|
||||
# if no fields have been specified by the user
|
||||
queryrest.default.response.fields=channel,pulseId,globalMillis,globalNanos,iocMillis,iocNanos,shape,eventCount,value
|
||||
queryrest.default.response.fields=channel,pulseId,globalSeconds,shape,eventCount,value
|
||||
|
||||
# aggregation which are included in the response by default if aggregation is enabled for a given query
|
||||
queryrest.default.response.aggregations=min,mean,max
|
||||
|
@ -12,13 +12,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
|
||||
|
||||
import ch.psi.daq.cassandra.reader.CassandraReader;
|
||||
import ch.psi.daq.cassandra.util.test.CassandraDataGen;
|
||||
import ch.psi.daq.domain.reader.DataReader;
|
||||
import ch.psi.daq.query.processor.QueryProcessor;
|
||||
import ch.psi.daq.query.processor.QueryProcessorLocal;
|
||||
import ch.psi.daq.test.cassandra.admin.CassandraTestAdmin;
|
||||
import ch.psi.daq.test.cassandra.admin.CassandraTestAdminImpl;
|
||||
import ch.psi.daq.test.query.config.LocalQueryTestConfig;
|
||||
import ch.psi.daq.test.queryrest.query.DummyArchiverApplianceReader;
|
||||
import ch.psi.daq.test.queryrest.query.DummyCassandraReader;
|
||||
|
||||
@Configuration
|
||||
|
@ -29,6 +29,8 @@ import ch.psi.daq.cassandra.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeTime;
|
||||
import ch.psi.daq.cassandra.util.test.CassandraDataGen;
|
||||
import ch.psi.daq.common.ordering.Ordering;
|
||||
import ch.psi.daq.common.time.TimeUtils;
|
||||
import ch.psi.daq.domain.test.TestTimeUtils;
|
||||
import ch.psi.daq.query.model.Aggregation;
|
||||
import ch.psi.daq.query.model.AggregationType;
|
||||
import ch.psi.daq.query.model.Compression;
|
||||
@ -79,14 +81,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -125,10 +127,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL + channelCount, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("1", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.value.name()));
|
||||
@ -170,14 +176,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -218,10 +224,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL + channelCount, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("1", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.value.name()));
|
||||
@ -257,14 +267,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -301,10 +311,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(channelName, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[2048]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("1", customerMap.get(QueryField.eventCount.name()));
|
||||
assertTrue(customerMap.get(QueryField.value.name()).toString().startsWith("["));
|
||||
@ -321,8 +335,8 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
public void testTimeRangeQuery() throws Exception {
|
||||
DAQQuery request = new DAQQuery(
|
||||
new RequestRangeTime(
|
||||
0,
|
||||
10),
|
||||
TimeUtils.getTimeFromMillis(0, 0),
|
||||
TimeUtils.getTimeFromMillis(10, 0)),
|
||||
TEST_CHANNEL_NAMES);
|
||||
request.setResponseFormat(ResponseFormat.CSV);
|
||||
|
||||
@ -332,14 +346,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -378,10 +392,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL + channelCount, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("1", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.value.name()));
|
||||
@ -418,14 +436,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -464,10 +482,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL + channelCount, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("1", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.value.name()));
|
||||
@ -567,14 +589,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -618,10 +640,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL_01, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("5", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse + ".0", customerMap.get(Aggregation.min.name()));
|
||||
@ -655,14 +681,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.pulseId);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.iocNanos);
|
||||
queryFields.add(QueryField.globalSeconds);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalMillis);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.globalNanos);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.shape);
|
||||
cellProcessors.add(new NotNull());
|
||||
queryFields.add(QueryField.eventCount);
|
||||
@ -707,10 +733,14 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
while ((customerMap = mapReader.read(header, processors)) != null) {
|
||||
assertEquals(TEST_CHANNEL_01, customerMap.get(QueryField.channel.name()));
|
||||
assertEquals("" + pulse, customerMap.get(QueryField.pulseId.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.iocNanos.name()));
|
||||
assertEquals("" + pulse * 10, customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("0", customerMap.get(QueryField.globalNanos.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.iocMillis.name()));
|
||||
assertEquals("" + TimeUtils.getTimeStr(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalSeconds.name()));
|
||||
assertEquals("" + TimeUtils.getMillis(TestTimeUtils.getTimeFromPulseId(pulse)),
|
||||
customerMap.get(QueryField.globalMillis.name()));
|
||||
assertEquals("[1]", customerMap.get(QueryField.shape.name()));
|
||||
assertEquals("10", customerMap.get(QueryField.eventCount.name()));
|
||||
assertEquals("" + pulse + ".0", customerMap.get(Aggregation.min.name()));
|
||||
|
@ -15,10 +15,13 @@ import ch.psi.daq.cassandra.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeTime;
|
||||
import ch.psi.daq.cassandra.util.test.CassandraDataGen;
|
||||
import ch.psi.daq.common.ordering.Ordering;
|
||||
import ch.psi.daq.common.time.TimeUtils;
|
||||
import ch.psi.daq.domain.json.ChannelName;
|
||||
import ch.psi.daq.domain.reader.Backend;
|
||||
import ch.psi.daq.domain.test.TestTimeUtils;
|
||||
import ch.psi.daq.query.model.AggregationType;
|
||||
import ch.psi.daq.query.model.Compression;
|
||||
import ch.psi.daq.query.model.QueryField;
|
||||
import ch.psi.daq.query.model.impl.DAQQueries;
|
||||
import ch.psi.daq.query.model.impl.DAQQuery;
|
||||
import ch.psi.daq.query.model.impl.DAQQueryElement;
|
||||
@ -67,16 +70,16 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").value("BoolScalar"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[1]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[1]").value("BoolWaveform"))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[0]").exists())
|
||||
// .andExpect(
|
||||
// MockMvcResultMatchers.jsonPath("$[1].channels[0]").value(DummyArchiverApplianceReader.TEST_CHANNEL_1))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[1]").exists())
|
||||
// .andExpect(
|
||||
// MockMvcResultMatchers.jsonPath("$[1].channels[1]").value(DummyArchiverApplianceReader.TEST_CHANNEL_2))
|
||||
;
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[0]").exists())
|
||||
// .andExpect(
|
||||
// MockMvcResultMatchers.jsonPath("$[1].channels[0]").value(DummyArchiverApplianceReader.TEST_CHANNEL_1))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[1]").exists())
|
||||
// .andExpect(
|
||||
// MockMvcResultMatchers.jsonPath("$[1].channels[1]").value(DummyArchiverApplianceReader.TEST_CHANNEL_2))
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
@ -100,11 +103,11 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[2]").value("UInt32Scalar"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[3]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[3]").value("UInt32Waveform"))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[0]").doesNotExist())
|
||||
;
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[0]").doesNotExist())
|
||||
;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -156,12 +159,12 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[23]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[24]").doesNotExist())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[2]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[3]").doesNotExist())
|
||||
;
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[2]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[3]").doesNotExist())
|
||||
;
|
||||
|
||||
// each reload add another channel
|
||||
request.setReload(true);
|
||||
@ -182,12 +185,12 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[24]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[25]").doesNotExist())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[3]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[4]").doesNotExist())
|
||||
;
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[3]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels[4]").doesNotExist())
|
||||
;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -279,9 +282,14 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
public void testPulseRangeQuery() throws Exception {
|
||||
DAQQuery request = new DAQQuery(
|
||||
new RequestRangePulseId(
|
||||
10,
|
||||
11),
|
||||
100,
|
||||
101),
|
||||
TEST_CHANNEL_NAMES);
|
||||
request.addField(QueryField.pulseId);
|
||||
request.addField(QueryField.globalSeconds);
|
||||
request.addField(QueryField.globalMillis);
|
||||
request.addField(QueryField.iocSeconds);
|
||||
request.addField(QueryField.iocMillis);
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
System.out.println(content);
|
||||
@ -297,25 +305,45 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.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].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].iocSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].iocMillis").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(1010))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].iocSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].iocMillis").value(1010))
|
||||
.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].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(110));
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].iocSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].iocMillis").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(1010))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].iocSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].iocMillis").value(1010));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPulseRangeQueryBackends() throws Exception {
|
||||
DAQQuery request = new DAQQuery(
|
||||
new RequestRangePulseId(
|
||||
10,
|
||||
11),
|
||||
100,
|
||||
101),
|
||||
new ChannelName(TEST_CHANNEL_01, Backend.databuffer),
|
||||
new ChannelName(TEST_CHANNEL_02, Backend.archiverappliance));
|
||||
|
||||
@ -334,19 +362,21 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel").isMap())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(110))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channel").isMap())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.name").value(TEST_CHANNEL_02))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(10))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(100))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(11))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(110))
|
||||
;
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channel").isMap())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.name").value(TEST_CHANNEL_02))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(10))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(100))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(11))
|
||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(110))
|
||||
;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -355,13 +385,13 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
DAQQueries request = new DAQQueries(
|
||||
new DAQQueryElement(
|
||||
new RequestRangePulseId(
|
||||
10,
|
||||
11),
|
||||
100,
|
||||
101),
|
||||
TEST_CHANNEL_NAMES),
|
||||
new DAQQueryElement(
|
||||
new RequestRangePulseId(
|
||||
10,
|
||||
11),
|
||||
100,
|
||||
101),
|
||||
testChannel3));
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
@ -380,33 +410,39 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[1].globalMillis").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].channel.name").value(TEST_CHANNEL_02))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[1].globalMillis").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0][1].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1]").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].channel.name").value(testChannel3))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[1].globalMillis").value(110));
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1][0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTimeRangeQuery() throws Exception {
|
||||
DAQQuery request = new DAQQuery(
|
||||
new RequestRangeTime(
|
||||
100,
|
||||
110),
|
||||
TimeUtils.getTimeFromMillis(2000, 0),
|
||||
TimeUtils.getTimeFromMillis(2010, 0)),
|
||||
TEST_CHANNEL_NAMES);
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
@ -423,24 +459,28 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel").isMap())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(200))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(2, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(201))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(2, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].channel").isMap())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.name").value(TEST_CHANNEL_02))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(110));
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(200))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(2, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(201))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(2, 10000000)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateRangeQuery() throws Exception {
|
||||
String startDate = RequestRangeDate.format(100);
|
||||
String endDate = RequestRangeDate.format(110);
|
||||
String startDate = RequestRangeDate.format(1000);
|
||||
String endDate = RequestRangeDate.format(1010);
|
||||
DAQQuery request = new DAQQuery(
|
||||
new RequestRangeDate(
|
||||
startDate,
|
||||
@ -464,18 +504,22 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value("databuffer"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.name").value(TEST_CHANNEL_02))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].channel.backend").value("databuffer"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(11))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalMillis").value(110));
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(101))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 10000000)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -520,8 +564,8 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
@Test
|
||||
public void testDateRangeQueryNrOfBinsAggregate() throws Exception {
|
||||
long startTime = 100;
|
||||
long endTime = 199;
|
||||
long startTime = 1000;
|
||||
long endTime = 1099;
|
||||
String startDate = RequestRangeDate.format(startTime);
|
||||
String endDate = RequestRangeDate.format(endTime);
|
||||
DAQQuery request = new DAQQuery(
|
||||
@ -549,18 +593,20 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].eventCount").value(5))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(15))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(150))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(105))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(1, 50000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].eventCount").value(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateRangeQueryBinSizeAggregate() throws Exception {
|
||||
long startTime = 1000;
|
||||
long endTime = 1999;
|
||||
long startTime = 10000;
|
||||
long endTime = 10999;
|
||||
String startDate = RequestRangeDate.format(startTime);
|
||||
String endDate = RequestRangeDate.format(endTime);
|
||||
DAQQuery request = new DAQQuery(
|
||||
@ -588,35 +634,45 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.name").value(TEST_CHANNEL_01))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalMillis").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 0)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(110))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalMillis").value(1100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].pulseId").value(1010))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 100000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[1].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[2].pulseId").value(120))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[2].globalMillis").value(1200))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[2].pulseId").value(1020))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[2].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 200000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[2].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[3].pulseId").value(130))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[3].globalMillis").value(1300))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[3].pulseId").value(1030))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[3].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 300000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[3].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[4].pulseId").value(140))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[4].globalMillis").value(1400))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[4].pulseId").value(1040))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[4].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 400000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[4].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[5].pulseId").value(150))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[5].globalMillis").value(1500))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[5].pulseId").value(1050))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[5].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 500000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[5].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[6].pulseId").value(160))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[6].globalMillis").value(1600))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[6].pulseId").value(1060))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[6].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 600000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[6].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[7].pulseId").value(170))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[7].globalMillis").value(1700))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[7].pulseId").value(1070))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[7].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 700000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[7].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[8].pulseId").value(180))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[8].globalMillis").value(1800))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[8].pulseId").value(1080))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[8].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 800000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[8].eventCount").value(10))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[9].pulseId").value(190))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[9].globalMillis").value(1900))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[9].pulseId").value(1090))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[9].globalSeconds").value(
|
||||
TestTimeUtils.getTimeStr(10, 900000000)))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[9].eventCount").value(10));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ch.psi.daq.test.queryrest.query;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -10,6 +11,7 @@ import java.util.stream.Stream;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import ch.psi.daq.common.ordering.Ordering;
|
||||
import ch.psi.daq.common.time.TimeUtils;
|
||||
import ch.psi.daq.domain.DataEvent;
|
||||
import ch.psi.daq.domain.cassandra.ChannelEvent;
|
||||
import ch.psi.daq.domain.reader.Backend;
|
||||
@ -51,25 +53,25 @@ public class DummyArchiverApplianceReader implements DataReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<? extends DataEvent> getEventStream(String channel, long startMillis, long startNanos, long endMillis,
|
||||
long endNanos, Ordering ordering, boolean aggregateValues, String... columns) {
|
||||
return getElements(channel, startMillis / 10, endMillis / 10);
|
||||
public Stream<? extends DataEvent> getEventStream(String channel, BigDecimal startTime, BigDecimal endTime,
|
||||
Ordering ordering, boolean aggregateValues, String... columns) {
|
||||
return getElements(channel, TimeUtils.getMillis(startTime) / 10, TimeUtils.getMillis(endTime) / 10);
|
||||
}
|
||||
|
||||
protected Stream<? extends DataEvent> getElements(String channel, long start, long end) {
|
||||
String channelLower = channel.toLowerCase();
|
||||
|
||||
Stream<? extends DataEvent> eventStream = LongStream.rangeClosed(start, end).mapToObj(i -> {
|
||||
BigDecimal time = TimeUtils.getTimeFromMillis(i * 10, 0);
|
||||
|
||||
if (channelLower.contains("waveform")) {
|
||||
long[] value = random.longs(2048).toArray();
|
||||
value[0] = i;
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
1,
|
||||
value
|
||||
);
|
||||
@ -82,11 +84,9 @@ public class DummyArchiverApplianceReader implements DataReader {
|
||||
value[0] = i;
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
1,
|
||||
value,
|
||||
shape
|
||||
@ -94,11 +94,9 @@ public class DummyArchiverApplianceReader implements DataReader {
|
||||
} else {
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
1,
|
||||
i
|
||||
);
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package ch.psi.daq.test.queryrest.query;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -21,6 +22,7 @@ import com.google.common.collect.Lists;
|
||||
import ch.psi.daq.cassandra.reader.CassandraReader;
|
||||
import ch.psi.daq.cassandra.util.test.CassandraDataGen;
|
||||
import ch.psi.daq.common.ordering.Ordering;
|
||||
import ch.psi.daq.common.time.TimeUtils;
|
||||
import ch.psi.daq.domain.DataEvent;
|
||||
import ch.psi.daq.domain.cassandra.ChannelConfiguration;
|
||||
import ch.psi.daq.domain.cassandra.ChannelEvent;
|
||||
@ -107,9 +109,9 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Stream<? extends DataEvent> getEventStream(String channel, long startMillis, long startNanos, long endMillis,
|
||||
long endNanos, Ordering ordering, boolean aggregateValues, String... columns) {
|
||||
return getDummyEventStream(channel, startMillis / 10, endMillis / 10);
|
||||
public Stream<? extends DataEvent> getEventStream(String channel, BigDecimal startTime, BigDecimal endTime,
|
||||
Ordering ordering, boolean aggregateValues, String... columns) {
|
||||
return getDummyEventStream(channel, TimeUtils.getMillis(startTime) / 10, TimeUtils.getMillis(endTime) / 10);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,16 +162,16 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
String channelLower = channel.toLowerCase();
|
||||
|
||||
Stream<? extends DataEvent> eventStream = LongStream.rangeClosed(startIndex, endIndex).mapToObj(i -> {
|
||||
BigDecimal time = TimeUtils.getTimeFromMillis(i * 10, 0);
|
||||
|
||||
if (channelLower.contains("waveform")) {
|
||||
long[] value = random.longs(2048).toArray();
|
||||
value[0] = i;
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
KEYSPACE,
|
||||
value
|
||||
);
|
||||
@ -182,11 +184,9 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
value[0] = i;
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
KEYSPACE,
|
||||
value,
|
||||
shape
|
||||
@ -194,11 +194,9 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
} else {
|
||||
return new ChannelEvent(
|
||||
channel,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
i,
|
||||
i * 10,
|
||||
0,
|
||||
time,
|
||||
KEYSPACE,
|
||||
i
|
||||
);
|
||||
|
Reference in New Issue
Block a user