ATEST-316
This commit is contained in:
+25
-25
@@ -23,20 +23,20 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeDate;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeTime;
|
||||
import ch.psi.daq.common.ordering.Ordering;
|
||||
import ch.psi.daq.common.time.TimeUtils;
|
||||
import ch.psi.daq.domain.query.DAQQueries;
|
||||
import ch.psi.daq.domain.query.DAQQuery;
|
||||
import ch.psi.daq.domain.query.DAQQueryElement;
|
||||
import ch.psi.daq.domain.query.operation.Aggregation;
|
||||
import ch.psi.daq.domain.query.operation.AggregationType;
|
||||
import ch.psi.daq.domain.query.operation.Compression;
|
||||
import ch.psi.daq.domain.query.operation.QueryField;
|
||||
import ch.psi.daq.domain.query.operation.ResponseFormat;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeDate;
|
||||
import ch.psi.daq.domain.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeTime;
|
||||
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;
|
||||
import ch.psi.daq.query.model.QueryField;
|
||||
import ch.psi.daq.query.model.ResponseFormat;
|
||||
import ch.psi.daq.query.model.impl.DAQQueries;
|
||||
import ch.psi.daq.query.model.impl.DAQQuery;
|
||||
import ch.psi.daq.query.model.impl.DAQQueryElement;
|
||||
import ch.psi.daq.queryrest.controller.QueryRestController;
|
||||
import ch.psi.daq.queryrest.response.csv.CSVResponseStreamWriter;
|
||||
import ch.psi.daq.test.queryrest.AbstractDaqRestTest;
|
||||
@@ -81,7 +81,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -169,7 +169,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -257,7 +257,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -354,7 +354,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERIES)
|
||||
.post(QueryRestController.PATH_QUERIES)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -437,7 +437,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -521,7 +521,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -608,7 +608,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -682,7 +682,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
try {
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print());
|
||||
@@ -712,7 +712,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
try {
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print());
|
||||
@@ -763,7 +763,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -863,7 +863,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -946,7 +946,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
MvcResult result = this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
@@ -1002,7 +1002,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -1024,7 +1024,7 @@ public class QueryRestControllerCsvTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
|
||||
+41
-41
@@ -8,21 +8,21 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeDate;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.cassandra.request.range.RequestRangeTime;
|
||||
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.query.DAQQueries;
|
||||
import ch.psi.daq.domain.query.DAQQuery;
|
||||
import ch.psi.daq.domain.query.DAQQueryElement;
|
||||
import ch.psi.daq.domain.query.channels.ChannelsRequest;
|
||||
import ch.psi.daq.domain.query.operation.AggregationType;
|
||||
import ch.psi.daq.domain.query.operation.Compression;
|
||||
import ch.psi.daq.domain.query.operation.QueryField;
|
||||
import ch.psi.daq.domain.reader.Backend;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeDate;
|
||||
import ch.psi.daq.domain.request.range.RequestRangePulseId;
|
||||
import ch.psi.daq.domain.request.range.RequestRangeTime;
|
||||
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;
|
||||
import ch.psi.daq.query.request.ChannelsRequest;
|
||||
import ch.psi.daq.queryrest.controller.QueryRestController;
|
||||
import ch.psi.daq.test.queryrest.AbstractDaqRestTest;
|
||||
|
||||
@@ -44,13 +44,13 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
MockMvcRequestBuilders
|
||||
.get(QueryRestController.CHANNELS)
|
||||
.get(QueryRestController.PATH_CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").value("BoolScalar"))
|
||||
@@ -73,13 +73,13 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
public void testSpecificChannelSearch() throws Exception {
|
||||
this.mockMvc.perform(
|
||||
MockMvcRequestBuilders
|
||||
.get(QueryRestController.CHANNELS + "/int32")
|
||||
.get(QueryRestController.PATH_CHANNELS + "/int32")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").value("Int32Scalar"))
|
||||
@@ -98,21 +98,21 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
@Test
|
||||
public void testChannelNameQueryBackendOrder() throws Exception {
|
||||
ChannelsRequest request = new ChannelsRequest("int64", Ordering.desc, Backend.databuffer);
|
||||
ChannelsRequest request = new ChannelsRequest("int64", Ordering.desc, Backend.SF_DATABUFFER);
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
System.out.println(content);
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.CHANNELS)
|
||||
.post(QueryRestController.PATH_CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[0]").value("UInt64Waveform"))
|
||||
@@ -134,14 +134,14 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.CHANNELS)
|
||||
.post(QueryRestController.PATH_CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[23]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[24]").doesNotExist())
|
||||
@@ -160,14 +160,14 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.CHANNELS)
|
||||
.post(QueryRestController.PATH_CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[24]").exists())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[25]").doesNotExist())
|
||||
@@ -185,7 +185,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc.perform(
|
||||
MockMvcRequestBuilders
|
||||
.options(QueryRestController.CHANNELS)
|
||||
.options(QueryRestController.PATH_CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
@@ -201,7 +201,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
// curl -H "Origin: *" -H "Access-Control-Request-Method: POST" -X OPTIONS -v http://localhost:8080/channels
|
||||
this.mockMvc.perform(
|
||||
MockMvcRequestBuilders
|
||||
.options(QueryRestController.CHANNELS)
|
||||
.options(QueryRestController.PATH_CHANNELS)
|
||||
.header("Origin", "*")
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -212,7 +212,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
// curl -H "Origin: http://localhost:8080" -H "Access-Control-Request-Method: POST" -X OPTIONS -v http://localhost:8080/channels
|
||||
this.mockMvc.perform(
|
||||
MockMvcRequestBuilders
|
||||
.options(QueryRestController.CHANNELS)
|
||||
.options(QueryRestController.PATH_CHANNELS)
|
||||
.header("Origin", "http://localhost:8080")
|
||||
.header("Access-Control-Request-Method", "POST")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -239,7 +239,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -297,7 +297,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -325,15 +325,15 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
new RequestRangePulseId(
|
||||
100,
|
||||
101),
|
||||
new ChannelName(TEST_CHANNEL_01, Backend.databuffer),
|
||||
new ChannelName(TEST_CHANNEL_02, Backend.archiverappliance));
|
||||
new ChannelName(TEST_CHANNEL_01, Backend.SF_DATABUFFER),
|
||||
new ChannelName(TEST_CHANNEL_02, Backend.SF_ARCHIVERAPPLIANCE));
|
||||
|
||||
String content = mapper.writeValueAsString(request);
|
||||
System.out.println(content);
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -380,7 +380,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERIES)
|
||||
.post(QueryRestController.PATH_QUERIES)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -429,7 +429,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
String content = mapper.writeValueAsString(request);
|
||||
|
||||
this.mockMvc.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -474,7 +474,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content)
|
||||
)
|
||||
@@ -483,7 +483,7 @@ 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].channel.backend").value("databuffer"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
@@ -493,7 +493,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
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].channel.backend").value("sf-databuffer"))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].globalSeconds").value(
|
||||
@@ -516,7 +516,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
String content = mapper.writeValueAsString(request);
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders.post(QueryRestController.QUERY)
|
||||
.perform(MockMvcRequestBuilders.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -562,7 +562,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content)
|
||||
)
|
||||
@@ -572,7 +572,7 @@ 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].channel.backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(100))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
@@ -603,7 +603,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content)
|
||||
)
|
||||
@@ -613,7 +613,7 @@ 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].channel.backend").value(Backend.databuffer.name()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channel.backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data").isArray())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].pulseId").value(1000))
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].globalSeconds").value(
|
||||
@@ -671,7 +671,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@@ -692,7 +692,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post(QueryRestController.QUERY)
|
||||
.post(QueryRestController.PATH_QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ import java.util.stream.Stream;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import ch.psi.daq.domain.StreamEvent;
|
||||
import ch.psi.daq.domain.cassandra.query.PulseIdRangeQuery;
|
||||
import ch.psi.daq.domain.cassandra.query.TimeRangeQuery;
|
||||
import ch.psi.daq.domain.query.backend.PulseIdRangeQuery;
|
||||
import ch.psi.daq.domain.query.backend.TimeRangeQuery;
|
||||
import ch.psi.daq.domain.query.event.EventQuery;
|
||||
import ch.psi.daq.domain.reader.Backend;
|
||||
import ch.psi.daq.domain.reader.DataReader;
|
||||
|
||||
@@ -25,7 +26,7 @@ public class DummyArchiverApplianceReader implements DataReader {
|
||||
|
||||
@Override
|
||||
public Backend getBackend() {
|
||||
return Backend.archiverappliance;
|
||||
return Backend.SF_ARCHIVERAPPLIANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,12 +46,12 @@ public class DummyArchiverApplianceReader implements DataReader {
|
||||
public Stream<? extends StreamEvent> getEventStream(PulseIdRangeQuery query) {
|
||||
return DummyCassandraReader.getDummyEventStream(query.getChannel(), query.getStartPulseId(), query.getEndPulseId(),
|
||||
query.getEventColumns())
|
||||
.filter(query.getFilterOrDefault(NO_OP_FILTER));
|
||||
.filter(query.getFilterOrDefault(EventQuery.NO_OP_FILTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<? extends StreamEvent> getEventStream(TimeRangeQuery query) {
|
||||
return DummyCassandraReader.getDummyEventStream(query.getChannel(), query.getStartMillis() / 10, query.getEndMillis() / 10)
|
||||
.filter(query.getFilterOrDefault(NO_OP_FILTER));
|
||||
.filter(query.getFilterOrDefault(EventQuery.NO_OP_FILTER));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -22,21 +21,21 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import ch.psi.daq.cassandra.domain.ChannelConfiguration;
|
||||
import ch.psi.daq.cassandra.domain.ChannelEvent;
|
||||
import ch.psi.daq.cassandra.domain.MetaPulseId;
|
||||
import ch.psi.daq.cassandra.reader.CassandraReader;
|
||||
import ch.psi.daq.cassandra.util.test.CassandraDataGen;
|
||||
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;
|
||||
import ch.psi.daq.domain.cassandra.FieldNames;
|
||||
import ch.psi.daq.domain.cassandra.MetaPulseId;
|
||||
import ch.psi.daq.domain.cassandra.query.PulseIdRangeQuery;
|
||||
import ch.psi.daq.domain.cassandra.query.TimeRangeQuery;
|
||||
import ch.psi.daq.domain.cassandra.querying.ChannelEventQuery;
|
||||
import ch.psi.daq.domain.cassandra.querying.EventQuery;
|
||||
import ch.psi.daq.domain.cassandra.querying.MetaChannelEvent;
|
||||
import ch.psi.daq.domain.cassandra.utils.PropertiesUtils;
|
||||
import ch.psi.daq.domain.FieldNames;
|
||||
import ch.psi.daq.domain.query.backend.PulseIdRangeQuery;
|
||||
import ch.psi.daq.domain.query.backend.TimeRangeQuery;
|
||||
import ch.psi.daq.domain.query.event.EventQuery;
|
||||
import ch.psi.daq.domain.query.event.StreamEventQuery;
|
||||
import ch.psi.daq.domain.reader.Backend;
|
||||
import ch.psi.daq.domain.reader.MetaStreamEvent;
|
||||
import ch.psi.daq.domain.utils.PropertiesUtils;
|
||||
|
||||
public class DummyCassandraReader implements CassandraReader {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DummyCassandraReader.class);
|
||||
@@ -82,7 +81,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
|
||||
@Override
|
||||
public Backend getBackend() {
|
||||
return Backend.databuffer;
|
||||
return Backend.SF_DATABUFFER;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,23 +103,23 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
public Stream<ChannelEvent> getEventStream(PulseIdRangeQuery query) {
|
||||
return getDummyEventStream(query.getChannel(), query.getStartPulseId(), query.getEndPulseId(),
|
||||
query.getEventColumns())
|
||||
.filter(query.getFilterOrDefault(NO_OP_FILTER));
|
||||
.filter(query.getFilterOrDefault(EventQuery.NO_OP_FILTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<ChannelEvent> getEventStream(TimeRangeQuery query) {
|
||||
return getDummyEventStream(query.getChannel(), query.getStartMillis() / 10, query.getEndMillis() / 10)
|
||||
.filter(query.getFilterOrDefault(NO_OP_FILTER));
|
||||
.filter(query.getFilterOrDefault(EventQuery.NO_OP_FILTER));
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Stream<ChannelEvent> getEventStream(EventQuery eventQuery, Stream<? extends ChannelEventQuery> queryProviders) {
|
||||
public Stream<ChannelEvent> getEventStream(EventQuery eventQuery, Stream<? extends StreamEventQuery> queryProviders) {
|
||||
Stream<ChannelEvent> result = queryProviders.map(ceq -> {
|
||||
if (ceq instanceof MetaChannelEvent) {
|
||||
return getEvent((MetaChannelEvent) ceq);
|
||||
if (ceq instanceof MetaStreamEvent) {
|
||||
return getEvent((MetaStreamEvent<ChannelEvent>) ceq);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("This is not yet implemented!");
|
||||
}
|
||||
@@ -235,7 +234,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public ChannelEvent getEvent(MetaChannelEvent queryInfo, String... columns) {
|
||||
public ChannelEvent getEvent(MetaStreamEvent<ChannelEvent> queryInfo, String... columns) {
|
||||
if (queryInfo.getPulseId() > 0) {
|
||||
return (ChannelEvent) getDummyEvents(queryInfo.getChannel(), queryInfo.getPulseId(), queryInfo.getPulseId(),
|
||||
columns)
|
||||
@@ -249,7 +248,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public CompletableFuture<ChannelEvent> getEventAsync(MetaChannelEvent queryInfo, String... columns) {
|
||||
public CompletableFuture<ChannelEvent> getEventAsync(MetaStreamEvent<ChannelEvent> queryInfo, String... columns) {
|
||||
// implement when needed
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -258,7 +257,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Stream<? extends ChannelEventQuery> getChannelEventQueryStream(PulseIdRangeQuery query) {
|
||||
public Stream<? extends StreamEventQuery> getStreamEventQueryStream(PulseIdRangeQuery query) {
|
||||
|
||||
return dataGen.generateMetaPulseId(
|
||||
query.getStartPulseId(),
|
||||
@@ -278,7 +277,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Stream<? extends ChannelEventQuery> getChannelEventQueryStream(TimeRangeQuery query) {
|
||||
public Stream<? extends StreamEventQuery> getStreamEventQueryStream(TimeRangeQuery query) {
|
||||
|
||||
return dataGen.generateMetaTime(
|
||||
KEYSPACE,
|
||||
@@ -297,7 +296,7 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
@Override
|
||||
public Stream<MetaPulseId> getMetaStream(PulseIdRangeQuery query) {
|
||||
|
||||
return getChannelEventQueryStream(query).map(r -> {
|
||||
return getStreamEventQueryStream(query).map(r -> {
|
||||
return (MetaPulseId) r;
|
||||
});
|
||||
|
||||
@@ -308,15 +307,15 @@ public class DummyCassandraReader implements CassandraReader {
|
||||
* @{inheritDoc
|
||||
*/
|
||||
@Override
|
||||
public Stream<? extends MetaChannelEvent> getMetaStream(TimeRangeQuery query) {
|
||||
public Stream<? extends MetaStreamEvent<ChannelEvent>> getMetaStream(TimeRangeQuery query) {
|
||||
|
||||
return getChannelEventQueryStream(query).map(r -> {
|
||||
return (MetaChannelEvent) r;
|
||||
return getStreamEventQueryStream(query).map(r -> {
|
||||
return (MetaStreamEvent<ChannelEvent>) r;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<ChannelEvent> getEventStream(Stream<? extends MetaChannelEvent> queryInfos) {
|
||||
public Stream<ChannelEvent> getEventStream(Stream<? extends MetaStreamEvent<ChannelEvent>> queryInfos) {
|
||||
return getEventStream(null, queryInfos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user