Log loaded values in config
Add/remove / in REST interface.
This commit is contained in:
@ -84,7 +84,7 @@ There exist following fields:
|
||||
### Example
|
||||
|
||||
```
|
||||
curl -H "Content-Type: application/json" -X GET -d '{"channels":["channel1","channel2"],"startPulseId":0,"endPulseId":4}' http://sf-nube-14.psi.ch:8080/channels
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"channels":["channel1","channel2"],"startPulseId":0,"endPulseId":4}' http://sf-nube-14.psi.ch:8080/query
|
||||
```
|
||||
|
||||
### Response example
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ch.psi.daq.queryrest.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
@ -131,6 +132,8 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
|
||||
public Set<QueryField> defaultResponseFields() {
|
||||
String[] responseFields =
|
||||
StringUtils.commaDelimitedListToStringArray(env.getProperty(QUERYREST_DEFAULT_RESPONSE_FIELDS));
|
||||
LOGGER.debug("Load '{}={}'", BEAN_NAME_DEFAULT_RESPONSE_FIELDS, Arrays.toString(responseFields));
|
||||
|
||||
// preserve order
|
||||
LinkedHashSet<QueryField> defaultResponseFields = new LinkedHashSet<>(responseFields.length);
|
||||
for (String field : responseFields) {
|
||||
@ -148,6 +151,8 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
|
||||
public Set<Aggregation> defaultResponseAggregations() {
|
||||
String[] responseAggregations =
|
||||
StringUtils.commaDelimitedListToStringArray(env.getProperty(QUERYREST_DEFAULT_RESPONSE_AGGREGATIONS));
|
||||
LOGGER.debug("Load '{}={}'", BEAN_NAME_DEFAULT_RESPONSE_AGGREGATIONS, Arrays.toString(responseAggregations));
|
||||
|
||||
// preserve order
|
||||
LinkedHashSet<Aggregation> defaultResponseAggregations = new LinkedHashSet<>(responseAggregations.length);
|
||||
for (String aggregation : responseAggregations) {
|
||||
|
@ -70,11 +70,13 @@ public class QueryRestController {
|
||||
|
||||
@InitBinder
|
||||
protected void initBinder(WebDataBinder binder) {
|
||||
if (requestProviderValidator.supports(binder.getTarget().getClass())) {
|
||||
binder.addValidators(requestProviderValidator);
|
||||
}
|
||||
if (queryValidator.supports(binder.getTarget().getClass())) {
|
||||
binder.addValidators(queryValidator);
|
||||
if (binder.getTarget() != null) {
|
||||
if (requestProviderValidator.supports(binder.getTarget().getClass())) {
|
||||
binder.addValidators(requestProviderValidator);
|
||||
}
|
||||
if (queryValidator.supports(binder.getTarget().getClass())) {
|
||||
binder.addValidators(queryValidator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +161,7 @@ public class QueryRestController {
|
||||
i -> 0,
|
||||
i -> new long[] {nrOfElements - i, nrOfElements - i, nrOfElements - i, nrOfElements - i},
|
||||
"TRFCA-channel2");
|
||||
|
||||
|
||||
cassandraDataGen.writeData(3, 0, 4,
|
||||
i -> i,
|
||||
i -> 0,
|
||||
@ -168,7 +170,7 @@ public class QueryRestController {
|
||||
i -> 0,
|
||||
i -> i,
|
||||
"TRFCB-channel3");
|
||||
|
||||
|
||||
cassandraDataGen.writeData(3, 0, 4,
|
||||
i -> i,
|
||||
i -> 0,
|
||||
|
@ -53,7 +53,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc.perform(
|
||||
MockMvcRequestBuilders
|
||||
.get("/" + QueryRestController.CHANNELS)
|
||||
.get(QueryRestController.CHANNELS)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
@ -79,7 +79,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
.post("/" + QueryRestController.QUERY)
|
||||
.post(QueryRestController.QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@ -108,7 +108,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
String content = mapper.writeValueAsString(request);
|
||||
|
||||
this.mockMvc.perform(MockMvcRequestBuilders
|
||||
.post("/" + QueryRestController.QUERY)
|
||||
.post(QueryRestController.QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
@ -142,7 +142,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
this.mockMvc
|
||||
.perform(
|
||||
MockMvcRequestBuilders
|
||||
.post("/" + QueryRestController.QUERY)
|
||||
.post(QueryRestController.QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content)
|
||||
)
|
||||
@ -174,7 +174,7 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
String content = mapper.writeValueAsString(request);
|
||||
|
||||
this.mockMvc
|
||||
.perform(MockMvcRequestBuilders.post("/" + QueryRestController.QUERY)
|
||||
.perform(MockMvcRequestBuilders.post(QueryRestController.QUERY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(content))
|
||||
|
||||
|
Reference in New Issue
Block a user