Skip to content
Snippets Groups Projects
Commit efc12f93 authored by Pid's avatar Pid Committed by GitHub
Browse files

Merge pull request #13 from microservices-demo/remove_accounts_reference

Remove reference to accounts
parents 6ca5b493 12d44d9d
No related branches found
No related tags found
No related merge requests found
......@@ -19,11 +19,6 @@
"application/json;charset=UTF-8",
"text/plain"
],
"produces": [
"application/json;charset=UTF-8",
"text/plain"
],
"paths": {
"/carts/{customerId}": {
"get": {
......@@ -53,9 +48,6 @@
"delete": {
"description": "",
"operationId": "Delete cart",
"produces": [
"application/json;charset=UTF-8"
],
"parameters": [
{
"name": "customerId",
......@@ -144,7 +136,6 @@
"delete": {
"description": "Delete cart item",
"operationId": "delete",
"parameters": [
{
"name": "itemId",
......
......@@ -5,16 +5,16 @@ const ObjectID = require('mongodb').ObjectID;
let db;
const address = [
{"_id":ObjectID("579f21ae98684924944651bd"),"_class":"works.weave.socks.accounts.entities.Address","number":"69","street":"Wilson Street","city":"Hartlepool","postcode":"TS26 8JU","country":"United Kingdom"},
{"_id":ObjectID("579f21ae98684924944651c0"),"_class":"works.weave.socks.accounts.entities.Address","number":"122","street":"Radstone WayNet","city":"Northampton","postcode":"NN2 8NT","country":"United Kingdom"},
{"_id":ObjectID("579f21ae98684924944651c3"),"_class":"works.weave.socks.accounts.entities.Address","number":"3","street":"Radstone Way","city":"Northampton","postcode":"NN2 8NT","country":"United Kingdom"}
{"_id":ObjectID("579f21ae98684924944651bd"),"_class":"works.weave.socks.users.entities.Address","number":"69","street":"Wilson Street","city":"Hartlepool","postcode":"TS26 8JU","country":"United Kingdom"},
{"_id":ObjectID("579f21ae98684924944651c0"),"_class":"works.weave.socks.users.entities.Address","number":"122","street":"Radstone WayNet","city":"Northampton","postcode":"NN2 8NT","country":"United Kingdom"},
{"_id":ObjectID("579f21ae98684924944651c3"),"_class":"works.weave.socks.users.entities.Address","number":"3","street":"Radstone Way","city":"Northampton","postcode":"NN2 8NT","country":"United Kingdom"}
];
const card = [
{"_id":ObjectID("579f21ae98684924944651be"),"_class":"works.weave.socks.accounts.entities.Card","longNum":"8575776807334952","expires":"08/19","ccv":"014"},
{"_id":ObjectID("579f21ae98684924944651c1"),"_class":"works.weave.socks.accounts.entities.Card","longNum":"8918468841895184","expires":"08/19","ccv":"597"},
{"_id":ObjectID("579f21ae98684924944651c4"),"_class":"works.weave.socks.accounts.entities.Card","longNum":"6426429851404909","expires":"08/19","ccv":"381"}
{"_id":ObjectID("579f21ae98684924944651be"),"_class":"works.weave.socks.users.entities.Card","longNum":"8575776807334952","expires":"08/19","ccv":"014"},
{"_id":ObjectID("579f21ae98684924944651c1"),"_class":"works.weave.socks.users.entities.Card","longNum":"8918468841895184","expires":"08/19","ccv":"597"},
{"_id":ObjectID("579f21ae98684924944651c4"),"_class":"works.weave.socks.users.entities.Card","longNum":"6426429851404909","expires":"08/19","ccv":"381"}
];
const cart = [
......@@ -29,10 +29,10 @@ const item = [
const customer = [
{"_id":"579f21ae98684924944651bf","_class":"works.weave.socks.accounts.entities.Customer","firstName":"Eve","lastName":"Berger","username":"Eve_Berger","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651bd")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651be")}]
{"_id":"579f21ae98684924944651bf","_class":"works.weave.socks.users.entities.Customer","firstName":"Eve","lastName":"Berger","username":"Eve_Berger","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651bd")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651be")}]
},
{"_id":"579f21ae98684924944651c2","_class":"works.weave.socks.accounts.entities.Customer","firstName":"User","lastName":"Name","username":"user","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651c0")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651c1")}]},
{"_id":"579f21ae98684924944651c5","_class":"works.weave.socks.accounts.entities.Customer","firstName":"User1","lastName":"Name1","username":"user1","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651c3")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651c4")}]}
{"_id":"579f21ae98684924944651c2","_class":"works.weave.socks.users.entities.Customer","firstName":"User","lastName":"Name","username":"user","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651c0")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651c1")}]},
{"_id":"579f21ae98684924944651c5","_class":"works.weave.socks.users.entities.Customer","firstName":"User1","lastName":"Name1","username":"user1","addresses":[{"$ref":"address","$id":ObjectID("579f21ae98684924944651c3")}],"cards":[{"$ref":"card","$id":ObjectID("579f21ae98684924944651c4")}]}
];
......@@ -63,7 +63,7 @@ hooks.beforeEach((transaction, done) => {
done();
});
})
});
......@@ -80,7 +80,7 @@ hooks.before("/carts/{customerId}/items > POST", function(transaction, done) {
done();
});
// TODO: Can't make POST and PUT work, skipping for now
// TODO: Can't make POST and PUT work, skipping for now
// hooks.before("/carts/{customerId}/items > POST", function(transaction, done) {
// transaction.skip = true;
......
......@@ -5,18 +5,16 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.*;
import works.weave.socks.cart.entities.HealthCheck;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
......@@ -33,7 +31,21 @@ public class UnitHealthCheckController {
@Test
public void shouldGetHealth() {
Map<String, List<HealthCheck>> results = healthCheckController.getHealth();
Map<String, List<HealthCheck>> results = this.healthCheckController.getHealth();
assertThat(results.get("health").size(), is(equalTo(2)));
}
@Configuration
static class HealthCheckControllerTestConfiguration {
@Bean
public HealthCheckController healthCheckController() {
return new HealthCheckController();
}
@Bean
public MongoTemplate mongoTemplate() {
MongoTemplate mongoTemplate = mock(MongoTemplate.class);
return mongoTemplate;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment