DATAMONGO-1133 - Fixed broken tests,
AggregationTests.shouldHonorFieldAliasesForFieldReferences() now correctly sets up 3 different instances of MeterData and correctly calculates the aggreated counter values. Original pull request: #279.
This commit is contained in:
committed by
Oliver Gierke
parent
1c6ab25253
commit
b887fa70a5
@@ -1057,8 +1057,7 @@ public class AggregationTests {
|
||||
|
||||
TypedAggregation<MeterData> agg = newAggregation(MeterData.class, //
|
||||
match(where("resourceId").is("m1")), //
|
||||
group("counterName").sum("counterVolume").as("totalValue") //
|
||||
);
|
||||
group("counterName").sum("counterVolume").as("totalValue"));
|
||||
|
||||
AggregationResults<DBObject> results = mongoTemplate.aggregate(agg, DBObject.class);
|
||||
|
||||
@@ -1066,7 +1065,7 @@ public class AggregationTests {
|
||||
DBObject result = results.getMappedResults().get(0);
|
||||
|
||||
assertThat(result.get("_id"), is(equalTo((Object) "counter1")));
|
||||
assertThat(result.get("totalValue"), is(equalTo((Object) 42.0)));
|
||||
assertThat(result.get("totalValue"), is(equalTo((Object) 100.0)));
|
||||
}
|
||||
|
||||
private void assertLikeStats(LikeStats like, String id, long count) {
|
||||
|
||||
@@ -23,12 +23,11 @@ import org.springframework.data.mongodb.core.mapping.Field;
|
||||
*/
|
||||
public class MeterData {
|
||||
|
||||
@Id String resourceId;
|
||||
@Id String id;
|
||||
String resourceId;
|
||||
@Field("counter_name") String counterName;
|
||||
double counterVolume;
|
||||
|
||||
public MeterData() {}
|
||||
|
||||
public MeterData(String resourceId, String counterName, double counterVolume) {
|
||||
|
||||
this.resourceId = resourceId;
|
||||
|
||||
Reference in New Issue
Block a user