ATEST-81:
- remove not needed enum in BinningStrategyEnum - rename enum in Ordering
This commit is contained in:
6
.project
6
.project
@ -5,6 +5,11 @@
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
@ -20,5 +25,6 @@
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
@ -3,8 +3,6 @@ package ch.psi.daq.rest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import ch.psi.daq.cassandra.writer.CassandraWriter;
|
||||
import ch.psi.daq.cassandra.writer.CassandraWriterImpl;
|
||||
import ch.psi.daq.common.statistic.StorelessStatistics;
|
||||
import ch.psi.daq.domain.cassandra.ChannelEvent;
|
||||
import ch.psi.daq.hazelcast.query.processor.QueryProcessor;
|
||||
@ -24,11 +22,6 @@ public class DaqRestConfiguration {
|
||||
return new CassandraQueryProcessorLocal();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CassandraWriter cassandraWriter() {
|
||||
return new CassandraWriterImpl();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JsonFactory jsonFactory() {
|
||||
return new JsonFactory();
|
||||
|
@ -75,7 +75,7 @@ public abstract class AbstractQuery implements Query {
|
||||
@JsonProperty(value = "channels") List<String> channels,
|
||||
@JsonProperty(value = "fields") LinkedHashSet<String> fields,
|
||||
@JsonProperty(value = "binningStrategy") BinningStrategyEnum binningStrategyEnum,
|
||||
@JsonProperty(value = "binDuration") long binDurationOrBinCount,
|
||||
@JsonProperty(value = "binDuration") long lengthOrCount,
|
||||
@JsonProperty(value = "aggregateChannels") boolean aggregateChannels,
|
||||
@JsonProperty(value = "aggregationType") AggregationType aggregationType,
|
||||
@JsonProperty(value = "aggregations") List<Aggregation> aggregations,
|
||||
@ -98,19 +98,18 @@ public abstract class AbstractQuery implements Query {
|
||||
|
||||
if (binningStrategyEnum != null) {
|
||||
switch (binningStrategyEnum) {
|
||||
case bincount:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binDurationOrBinCount);
|
||||
case count:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
break;
|
||||
case lengthpulse:
|
||||
case lengthtime:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), binDurationOrBinCount);
|
||||
case length:
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), lengthOrCount);
|
||||
break;
|
||||
default:
|
||||
logger.warn("No binning strategy has been set. Selecting BinningStrategyBinCount.");
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binDurationOrBinCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
}
|
||||
} else {
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) binDurationOrBinCount);
|
||||
this.binningStrategy = BinningStrategyFactory.getBinningStrategy(getQueryRange(), (int) lengthOrCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,5 +9,8 @@ import ch.psi.daq.hazelcast.query.bin.BinningStrategy;
|
||||
*
|
||||
*/
|
||||
public enum BinningStrategyEnum {
|
||||
lengthpulse, lengthtime, bincount
|
||||
|
||||
length,
|
||||
|
||||
count
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
public void testPulseRangeQuery() throws Exception {
|
||||
QueryRange range = new QueryRangeImpl(100l, 101l);
|
||||
PulseRangeQuery request = new PulseRangeQuery(
|
||||
Ordering.DESC, //ordering
|
||||
Ordering.desc, //ordering
|
||||
Lists.newArrayList(), // channels, DummyQueryProcessor simply returns a fixed list
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES), // fields
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100,
|
||||
false,
|
||||
AggregationType.index,
|
||||
@ -66,10 +66,10 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
long endTime = startTime + TimeUnit.SECONDS.toMillis(1);
|
||||
QueryRange range = new QueryRangeImpl(startTime, 0, endTime, 0);
|
||||
TimeRangeQuery request = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList("test"),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100,
|
||||
false,
|
||||
AggregationType.index,
|
||||
@ -99,10 +99,10 @@ public class DaqRestControllerTest extends AbstractDaqRestTest {
|
||||
long endTime = startTime + TimeUnit.SECONDS.toMillis(1);
|
||||
QueryRange range = new QueryRangeImpl(startTime, 0, endTime, 0);
|
||||
TimeRangeQuery request = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList("test"),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100,
|
||||
false,
|
||||
AggregationType.index,
|
||||
|
@ -33,10 +33,10 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
QueryRange range = new QueryRangeImpl(startMillis, 0, endMillis, 0);
|
||||
|
||||
new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
null, // should throw exception
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
@ -55,10 +55,10 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
QueryRange range = new QueryRangeImpl(startMillis, 0, endMillis, 0);
|
||||
|
||||
new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(),
|
||||
null,
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
@ -76,7 +76,7 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
long endMillis = new Date().getTime() + TimeUnit.SECONDS.toMillis(10);
|
||||
QueryRange range = new QueryRangeImpl(startMillis, 0, endMillis, 0);
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
null,
|
||||
@ -99,10 +99,10 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
long endMillis = new Date().getTime() + TimeUnit.SECONDS.toMillis(10);
|
||||
QueryRange range = new QueryRangeImpl(startMillis, 0, endMillis, 0);
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.lengthpulse,
|
||||
BinningStrategyEnum.length,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
@ -122,10 +122,10 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
long endPulse = 105l;
|
||||
QueryRange range = new QueryRangeImpl(startPulse, endPulse);
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.lengthpulse,
|
||||
BinningStrategyEnum.length,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
@ -145,10 +145,10 @@ public class AbstractQueryTestTest extends AbstractQueryTest {
|
||||
long endMillis = new Date().getTime() + TimeUnit.SECONDS.toMillis(10);
|
||||
QueryRange range = new QueryRangeImpl(startMillis, 0, endMillis, 0);
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(),
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
|
@ -31,10 +31,10 @@ public class TimeRangeQueryTest extends AbstractQueryTest {
|
||||
QueryRange range = new QueryRangeImpl(-1, 0, -1, 0);
|
||||
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(), // DummyQueryProcessor simply returns a fixed list
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
@ -55,10 +55,10 @@ public class TimeRangeQueryTest extends AbstractQueryTest {
|
||||
String endDateTime = "2014/01/01 18:00:00.000";
|
||||
QueryRange range = new QueryRangeImpl(-1, 0, -1, 0);
|
||||
TimeRangeQuery query = new TimeRangeQuery(
|
||||
Ordering.ASC,
|
||||
Ordering.asc,
|
||||
Lists.newArrayList(), // DummyQueryProcessor simply returns a fixed list
|
||||
Sets.newLinkedHashSet(DEFAULT_PROPERTIES),
|
||||
BinningStrategyEnum.bincount,
|
||||
BinningStrategyEnum.count,
|
||||
100, // binDurationOrBincount : long
|
||||
false, // isAggregateChannels
|
||||
AggregationType.index,
|
||||
|
@ -8,7 +8,7 @@
|
||||
"fields": [
|
||||
"channel", "pulseId", "globalMillis", "globalNanos", "dbValueBytes"
|
||||
],
|
||||
"binningStrategy" : "bincount",
|
||||
"binningStrategy" : "count",
|
||||
"binDuration" : 100,
|
||||
"aggregateChannels":"false",
|
||||
"aggregationType": "index",
|
||||
@ -34,24 +34,34 @@ curl -v -X POST -H 'Content-Type: application/json' -d '{"queryType":"pulserange
|
||||
|
||||
{
|
||||
"queryType":"timerange",
|
||||
"ordering":"ASC",
|
||||
"channels":[
|
||||
"test1",
|
||||
"test2"
|
||||
"test"
|
||||
],
|
||||
"fields":[
|
||||
"channel",
|
||||
"pulseId"
|
||||
],
|
||||
"binningStrategy" : "duration",
|
||||
"binDuration" : 100,
|
||||
"aggregateChannels":false,
|
||||
"aggregationType":"index",
|
||||
"aggregations":null,
|
||||
"start":1434717654177,
|
||||
"startNanoOffset":0,
|
||||
"end":1434717655177,
|
||||
"endNanoOffset":0,
|
||||
"ordering":"DESC"
|
||||
"aggregations": [
|
||||
{
|
||||
"fieldRef" : "e_val",
|
||||
"type" : "max",
|
||||
"resultFieldName" : "maximum"
|
||||
},{
|
||||
"fieldRef" : "e_val",
|
||||
"type" : "min",
|
||||
"resultFieldName" : "minimum"
|
||||
}
|
||||
],
|
||||
"queryRange":{
|
||||
"startMillis":1435048390294,
|
||||
"startNanos":0,
|
||||
"endMillis":1435048391294,
|
||||
"endNanos":0
|
||||
},
|
||||
"binningStrategy":"count"
|
||||
}
|
||||
|
||||
curl -v -X POST -H 'Content-Type: application/json' -d '{"queryType":"timerange","channels":["test1","test2"],"fields":["channel","pulseId"],"binningStrategy":"duration","binDuration":100,"aggregateChannels":false,"aggregations":null,"start":1434717654177,"startNanoOffset":0,"end":1434717655177,"endNanoOffset":0,"aggregationType":"index","ordering":"DESC"}' http://localhost:8080/timerange
|
||||
|
Reference in New Issue
Block a user