diff --git a/build.gradle b/build.gradle index 6aba98d..2188b20 100644 --- a/build.gradle +++ b/build.gradle @@ -12,16 +12,20 @@ repositories { jcenter() } springBoot { // when using spring loaded turn on noverify noverify = true } -applicationDefaultJvmArgs = [ - "-Dfile.encoding=UTF-8", - // if you need to debug java agents: - "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006" -] +ext { + applicationDefaultJvmArgs = [ + "-Dfile.encoding=UTF-8", + // if you need to debug java agents: + "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006" + ] +} dependencies { compile (project(':ch.psi.daq.query')) - compile 'org.hibernate:hibernate-validator:5.2.0.Final' + compile libraries.logback_classic + + compile 'org.hibernate:hibernate-validator:5.2.0.Final' compile(libraries.spring_boot_starter_web) { exclude group: 'org.slf4j', module: 'log4j-over-slf4j' } diff --git a/src/main/resources/logback-server.xml b/src/main/resources/logback-server.xml new file mode 100644 index 0000000..7eadf52 --- /dev/null +++ b/src/main/resources/logback-server.xml @@ -0,0 +1,64 @@ + + + + + + + + + + ${daq.logdir}/debug.log + + ${daq.logdir}/debug.log.%i.zip + 1 + 20 + + + 20MB + + + %-5level [%thread] %date{ISO8601} %F:%L - %msg%n + + + + + + + 1024 + 0 + true + + + + + + + + INFO + + + %-5level %date{ISO8601} %msg%n + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/queryrest.properties b/src/main/resources/queryrest.properties index e26d646..0baa29d 100644 --- a/src/main/resources/queryrest.properties +++ b/src/main/resources/queryrest.properties @@ -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,globalSeconds,shape,eventCount,value +queryrest.default.response.fields=channel,pulseId,globalSeconds,iocSeconds,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 diff --git a/src/test/java/ch/psi/daq/test/queryrest/controller/QueryRestControllerJsonTest.java b/src/test/java/ch/psi/daq/test/queryrest/controller/QueryRestControllerJsonTest.java index e524925..b05d262 100644 --- a/src/test/java/ch/psi/daq/test/queryrest/controller/QueryRestControllerJsonTest.java +++ b/src/test/java/ch/psi/daq/test/queryrest/controller/QueryRestControllerJsonTest.java @@ -337,6 +337,44 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest { TestTimeUtils.getTimeStr(1, 10000000))) .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].iocMillis").value(1010)); } + + @Test + public void testPulseRangeQuery_Fields() throws Exception { + DAQQuery request = new DAQQuery( + new RequestRangePulseId( + 100, + 199), + TEST_CHANNEL_NAMES); + request.addField(QueryField.pulseId); + request.addField(QueryField.eventCount); + request.setNrOfBins(2); + + String content = mapper.writeValueAsString(request); + System.out.println(content); + + this.mockMvc + .perform(MockMvcRequestBuilders + .post(QueryRestController.QUERY) + .contentType(MediaType.APPLICATION_JSON) + .content(content)) + + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().isOk()) + .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(100)) + .andExpect(MockMvcResultMatchers.jsonPath("$[0].data[0].eventCount").value(50)) + .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].pulseId").value(100)) + .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[0].eventCount").value(50)) + .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].pulseId").value(150)) + .andExpect(MockMvcResultMatchers.jsonPath("$[1].data[1].eventCount").value(50)); + } @Test public void testPulseRangeQueryBackends() throws Exception { diff --git a/src/main/resources/logback.xml b/src/test/resources/logback-test.xml similarity index 83% rename from src/main/resources/logback.xml rename to src/test/resources/logback-test.xml index f33cac2..c525fc7 100644 --- a/src/main/resources/logback.xml +++ b/src/test/resources/logback-test.xml @@ -1,5 +1,5 @@ - + .%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %n @@ -10,8 +10,8 @@ - - + +