Skip to content

Commit cb38af8

Browse files
committed
Polishing.
Add author tags. Update copyright years. Tweak method names. Reformat code. Closes #600 Original pull request: #600
1 parent 20b0c7c commit cb38af8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

mongodb/aggregation/src/main/java/example/springdata/mongodb/aggregation/OrderRepository.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2019 the original author or authors.
2+
* Copyright 2013-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,12 +22,11 @@
2222
import org.springframework.data.repository.CrudRepository;
2323

2424
/**
25-
* A repository interface assembling CRUD functionality as well as the API to
26-
* invoke the methods implemented manually.
25+
* A repository interface assembling CRUD functionality as well as the API to invoke the methods implemented manually.
2726
*
2827
* @author Thomas Darimont
2928
* @author Oliver Gierke
30-
* @author Christoph Strobl
29+
* @author Divya Srivastava
3130
*/
3231
public interface OrderRepository extends CrudRepository<Order, String>, OrderRepositoryCustom {
3332

@@ -41,6 +40,6 @@ public interface OrderRepository extends CrudRepository<Order, String>, OrderRep
4140
"{ $project : { id : 1 , customerId : 1 , items : 1 , lineTotal : { $multiply: [ '$items.price' , '$items.quantity' ] } } }",
4241
"{ $group : { '_id' : '$_id' , 'netAmount' : { $sum : '$lineTotal' } , 'items' : { $addToSet : '$items' } } }",
4342
"{ $project : { 'orderId' : '$_id' , 'items' : 1 , 'netAmount' : 1 , 'taxAmount' : { $multiply: [ '$netAmount' , 0.19 ] } , 'totalAmount' : { $multiply: [ '$netAmount' , 1.19 ] } } }" })
44-
Invoice getInvoiceForOrderDeclarative(String orderId);
43+
Invoice aggregateInvoiceForOrder(String orderId);
4544

4645
}

mongodb/aggregation/src/test/java/example/springdata/mongodb/aggregation/OrderRepositoryIntegrationTests.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
3434
* @author Thomas Darimont
3535
* @author Oliver Gierke
3636
* @author Christoph Strobl
37+
* @author Divya Srivastava
3738
*/
3839
@RunWith(SpringRunner.class)
3940
@SpringBootTest
@@ -51,7 +52,7 @@ public void setup() {
5152
}
5253

5354
@Test
54-
public void createsInvoiceViaAggregationProgrammatic() {
55+
public void createsInvoiceViaProgrammaticAggregation() {
5556

5657
Order order = new Order("c42", new Date()).//
5758
addItem(product1).addItem(product2).addItem(product3);
@@ -65,15 +66,15 @@ public void createsInvoiceViaAggregationProgrammatic() {
6566
assertThat(invoice.getTaxAmount()).isCloseTo(1.577D, offset(0.00001));
6667
assertThat(invoice.getTotalAmount()).isCloseTo(9.877, offset(0.00001));
6768
}
68-
69+
6970
@Test
70-
public void createsInvoiceViaAggregationDeclarative() {
71+
public void createsInvoiceViaDeclarativeAggregation() {
7172

7273
Order order = new Order("c42", new Date()).//
7374
addItem(product1).addItem(product2).addItem(product3);
7475
order = repository.save(order);
7576

76-
Invoice invoice = repository.getInvoiceForOrderDeclarative(order.getId());
77+
Invoice invoice = repository.aggregateInvoiceForOrder(order.getId());
7778

7879
assertThat(invoice).isNotNull();
7980
assertThat(invoice.getOrderId()).isEqualTo(order.getId());
@@ -110,5 +111,5 @@ public void multiStageDeclarativeAggregation() {
110111

111112
assertThat(repository.totalOrdersForCustomer("c42")).isEqualTo(3);
112113
}
113-
114+
114115
}

0 commit comments

Comments
 (0)