New Version: Some minor tweeks for FileStorage.

This commit is contained in:
Fabian Märki
2016-07-21 17:34:14 +02:00
parent b338477b96
commit f667d55e31
5 changed files with 5 additions and 20 deletions

View File

@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.http.converter.HttpMessageConverter;
@ -57,7 +56,6 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
private static final String QUERYREST_DEFAULT_RESPONSE_FIELDS = "queryrest.default.response.fields";
private static final String QUERYREST_CORS_ALLOWEDORIGINS = "queryrest.cors.allowedorigins";
private static final String QUERYREST_CORS_FORCEALLHEADERS = "queryrest.cors.forceallheaders";
private static final String QUERYREST_READTIMOUT = "queryrest.readtimeout";
// a nested configuration
// this guarantees that the ordering of the properties file is as expected
@ -74,7 +72,6 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
public static final String BEAN_NAME_DEFAULT_RESPONSE_AGGREGATIONS = "defaultResponseAggregations";
public static final String BEAN_NAME_CORS_ALLOWEDORIGINS = "corsAllowedorigins";
public static final String BEAN_NAME_CORS_FORCEALLHEADERS = "corsForceallheaders";
public static final String BEAN_NAME_READ_TIMOUT = "queryRestReadTimout";
@Resource
private Environment env;
@ -194,12 +191,4 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
LOGGER.debug("Load '{}={}'", QUERYREST_CORS_FORCEALLHEADERS, value);
return value;
}
@Bean(name = BEAN_NAME_READ_TIMOUT)
@Lazy
public Integer readTimeout() {
Integer value = env.getProperty(QUERYREST_READTIMOUT, Integer.class, 10);
LOGGER.debug("Load '{}={}'", QUERYREST_READTIMOUT, value);
return value;
}
}

View File

@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import ch.psi.daq.cassandra.config.CassandraConfig;
import ch.psi.daq.common.ordering.Ordering;
import ch.psi.daq.domain.config.DomainConfig;
import ch.psi.daq.domain.json.ChannelName;
@ -54,7 +53,6 @@ import ch.psi.daq.query.config.QueryConfig;
import ch.psi.daq.query.model.Query;
import ch.psi.daq.query.processor.ChannelNameCache;
import ch.psi.daq.query.processor.QueryProcessor;
import ch.psi.daq.queryrest.config.QueryRestConfig;
import ch.psi.daq.queryrest.query.QueryManager;
import ch.psi.daq.queryrest.response.AbstractHTTPResponse;
import ch.psi.daq.queryrest.response.PolymorphicResponseMixIn;
@ -91,7 +89,7 @@ public class QueryRestController {
@Resource
private Function<Query, QueryAnalyzer> queryAnalizerFactory;
@Resource(name = QueryRestConfig.BEAN_NAME_READ_TIMOUT)
@Resource(name = DomainConfig.BEAN_NAME_READ_TIMEOUT)
private Integer readTimeout;
private Map<Backend, QueryProcessor> queryProcessors = new LinkedHashMap<>();
@ -165,7 +163,7 @@ public class QueryRestController {
}
channelNameCache =
new ChannelNameCache(queryProcessors, appContext.getBean(CassandraConfig.BEAN_NAME_READ_TIMEOUT,
new ChannelNameCache(queryProcessors, appContext.getBean(DomainConfig.BEAN_NAME_READ_TIMEOUT,
Integer.class).longValue());
}

View File

@ -21,6 +21,7 @@ import org.springframework.context.ApplicationContext;
import ch.psi.daq.cassandra.config.CassandraConfig;
import ch.psi.daq.domain.DataEvent;
import ch.psi.daq.domain.config.DomainConfig;
import ch.psi.daq.domain.json.ChannelName;
import ch.psi.daq.domain.query.DAQQueries;
import ch.psi.daq.domain.query.DAQQueryElement;
@ -86,7 +87,7 @@ public class QueryManagerImpl implements QueryManager {
}
channelNameCache =
new ChannelNameCache(queryProcessors, appContext.getBean(CassandraConfig.BEAN_NAME_READ_TIMEOUT,
new ChannelNameCache(queryProcessors, appContext.getBean(DomainConfig.BEAN_NAME_READ_TIMEOUT,
Integer.class).longValue());
}

View File

@ -16,6 +16,3 @@ queryrest.cors.forceallheaders=false
# If this is set to '*', then all requests are allowed, from any source. If it's set to, say, http://ui-data-api.psi.ch, then only requests
# originating from that domain (Origin header set to that value) will be allowed. Otherwise a 403 error will be returned.
queryrest.cors.allowedorigins=*
# Timeout for read operations in seconds
queryrest.readtimeout=30

View File

@ -151,7 +151,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
.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())
.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())