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