From 4f6ceccd68adf4495d67a42620f6b5c5036777f9 Mon Sep 17 00:00:00 2001 From: Zellweger Christof Ralf Date: Mon, 22 Jun 2015 11:58:41 +0200 Subject: [PATCH] - rename hazelcast.common --- build.gradle | 2 +- .../psi/daq/rest/queries/AbstractQuery.java | 22 ++++++------------- .../psi/daq/rest/queries/PulseRangeQuery.java | 13 ++++++++--- .../psi/daq/rest/queries/TimeRangeQuery.java | 13 ++++++++--- .../rest/controller/DaqControllerTest.java | 9 ++++---- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index d495adc..755793a 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ applicationDefaultJvmArgs = [ dependencies { compile (project(':ch.psi.daq.cassandra')) - compile (project(':ch.psi.daq.hazelcast.common')) + compile (project(':ch.psi.daq.hazelcast')) compile 'org.springframework.boot:spring-boot-starter-web:1.2.4.RELEASE' compile 'com.google.code.gson:gson:2+' compile 'org.apache.commons:commons-lang3:3.4' diff --git a/src/main/java/ch/psi/daq/rest/queries/AbstractQuery.java b/src/main/java/ch/psi/daq/rest/queries/AbstractQuery.java index 396efe9..62e3be3 100644 --- a/src/main/java/ch/psi/daq/rest/queries/AbstractQuery.java +++ b/src/main/java/ch/psi/daq/rest/queries/AbstractQuery.java @@ -9,8 +9,8 @@ import org.springframework.util.Assert; import ch.psi.daq.cassandra.reader.Ordering; import ch.psi.daq.hazelcast.common.query.Aggregation; +import ch.psi.daq.hazelcast.common.query.AggregationType; import ch.psi.daq.hazelcast.common.query.Query; -import ch.psi.daq.hazelcast.common.query.ValueAggregation; import ch.psi.daq.hazelcast.common.query.bin.BinIntervalCalculator; import com.fasterxml.jackson.annotation.JsonCreator; @@ -41,7 +41,7 @@ public abstract class AbstractQuery implements Query { private List aggregations; - private ValueAggregation valueAggregation; + private AggregationType aggregationType; private boolean aggregateChannels; @@ -62,12 +62,12 @@ public abstract class AbstractQuery implements Query { @JsonProperty(value = "channels") List channelIds, @JsonProperty(value = "fields") LinkedHashSet fields, @JsonProperty(value = "aggregateChannels") boolean aggregateChannels, - @JsonProperty(value = "aggregationType") ValueAggregation valueAggregation, + @JsonProperty(value = "aggregationType") AggregationType aggregationType, @JsonProperty(value = "aggregations") List aggregations) { this.ordering = ordering; this.aggregateChannels = aggregateChannels; - this.valueAggregation = valueAggregation; + this.aggregationType = aggregationType; if (channelIds == null || fields == null) { throw new IllegalArgumentException("sourceIds and/or fields cannot be null."); @@ -100,21 +100,13 @@ public abstract class AbstractQuery implements Query { * {@inheritDoc} */ @Override - public ValueAggregation getValueAggregation() { - return valueAggregation; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean aggregateChannels() { - return isAggregateChannels(); + public AggregationType getAggregationType() { + return aggregationType; } @Override public BinIntervalCalculator getBinIntervalCalculator() { - // TODO Auto-generated method stub + // TODO return null; } diff --git a/src/main/java/ch/psi/daq/rest/queries/PulseRangeQuery.java b/src/main/java/ch/psi/daq/rest/queries/PulseRangeQuery.java index 134d85a..fb33172 100644 --- a/src/main/java/ch/psi/daq/rest/queries/PulseRangeQuery.java +++ b/src/main/java/ch/psi/daq/rest/queries/PulseRangeQuery.java @@ -7,7 +7,8 @@ import org.apache.commons.lang.builder.ToStringBuilder; import ch.psi.daq.cassandra.reader.Ordering; import ch.psi.daq.hazelcast.common.query.Aggregation; -import ch.psi.daq.hazelcast.common.query.ValueAggregation; +import ch.psi.daq.hazelcast.common.query.AggregationType; +import ch.psi.daq.hazelcast.common.query.range.QueryRange; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -28,13 +29,13 @@ public class PulseRangeQuery extends AbstractQuery { @JsonProperty(value = "channels") List channels, @JsonProperty(value = "fields") LinkedHashSet fields, @JsonProperty(value = "aggregateChannels") boolean aggregateChannels, - @JsonProperty(value = "aggregationType") ValueAggregation valueAggregation, + @JsonProperty(value = "aggregationType") AggregationType aggregationType, @JsonProperty(value = "aggregations") List aggregations, @JsonProperty(value = "startPulseId") long startPulseId, @JsonProperty(value = "endPulseId") long endPulseId) { - super(ordering, channels, fields, aggregateChannels, valueAggregation, aggregations); + super(ordering, channels, fields, aggregateChannels, aggregationType, aggregations); this.startPulseId = startPulseId; this.endPulseId = endPulseId; @@ -64,4 +65,10 @@ public class PulseRangeQuery extends AbstractQuery { return ToStringBuilder.reflectionToString(this); } + @Override + public QueryRange getQueryRange() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/main/java/ch/psi/daq/rest/queries/TimeRangeQuery.java b/src/main/java/ch/psi/daq/rest/queries/TimeRangeQuery.java index cbac26d..7edbebc 100644 --- a/src/main/java/ch/psi/daq/rest/queries/TimeRangeQuery.java +++ b/src/main/java/ch/psi/daq/rest/queries/TimeRangeQuery.java @@ -14,7 +14,8 @@ import org.slf4j.LoggerFactory; import ch.psi.daq.cassandra.reader.Ordering; import ch.psi.daq.hazelcast.common.query.Aggregation; -import ch.psi.daq.hazelcast.common.query.ValueAggregation; +import ch.psi.daq.hazelcast.common.query.AggregationType; +import ch.psi.daq.hazelcast.common.query.range.QueryRange; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -56,7 +57,7 @@ public class TimeRangeQuery extends AbstractQuery { @JsonProperty(value = "channels") List channels, @JsonProperty(value = "fields") LinkedHashSet fields, @JsonProperty(value = "aggregateChannels") boolean aggregateChannels, - @JsonProperty(value = "aggregationType") ValueAggregation valueAggregation, + @JsonProperty(value = "aggregationType") AggregationType aggregationType, @JsonProperty(value = "aggregations") List aggregations, @JsonProperty(value = "start") long startMillis, @JsonProperty(value = "startNanoOffset") long startNanoOffset, @@ -65,7 +66,7 @@ public class TimeRangeQuery extends AbstractQuery { @JsonProperty(value = "endNanoOffset") long endNanoOffset, @JsonProperty(value = "endDateTime") String endDateTime) { - super(ordering, channels, fields, aggregateChannels, valueAggregation, aggregations); + super(ordering, channels, fields, aggregateChannels, aggregationType, aggregations); this.start = startMillis; this.startNanoOffset = startNanoOffset; @@ -129,5 +130,11 @@ public class TimeRangeQuery extends AbstractQuery { return ToStringBuilder.reflectionToString(this); } + @Override + public QueryRange getQueryRange() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/test/java/ch/psi/daq/test/rest/controller/DaqControllerTest.java b/src/test/java/ch/psi/daq/test/rest/controller/DaqControllerTest.java index 96bc9f7..924b32b 100644 --- a/src/test/java/ch/psi/daq/test/rest/controller/DaqControllerTest.java +++ b/src/test/java/ch/psi/daq/test/rest/controller/DaqControllerTest.java @@ -11,7 +11,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import ch.psi.daq.cassandra.reader.Ordering; -import ch.psi.daq.hazelcast.common.query.ValueAggregation; +import ch.psi.daq.hazelcast.common.query.AggregationType; import ch.psi.daq.rest.queries.PulseRangeQuery; import ch.psi.daq.rest.queries.TimeRangeQuery; import ch.psi.daq.test.rest.AbstractDaqRestTest; @@ -33,7 +33,7 @@ public class DaqControllerTest extends AbstractDaqRestTest { Lists.newArrayList(), // DummyQueryProcessor simply returns a fixed list Sets.newLinkedHashSet(DEFAULT_PROPERTIES), false, - ValueAggregation.index, + AggregationType.index, null, 100l, 101l @@ -64,15 +64,14 @@ public class DaqControllerTest extends AbstractDaqRestTest { Lists.newArrayList(), // DummyQueryProcessor simply returns a fixed list Sets.newLinkedHashSet(DEFAULT_PROPERTIES), false, - ValueAggregation.index, + AggregationType.index, null, // aggregations startTime, // startMillis 0, null, endTime, 0, - null - ); + null); String content = mapper.writeValueAsString(request); System.out.println(content);