Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
carts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
systems
sock-shop
carts
Commits
efc12f93
Commit
efc12f93
authored
8 years ago
by
Pid
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api-spec/cart.json
+0
-9
0 additions, 9 deletions
api-spec/cart.json
api-spec/hooks.js
+11
-11
11 additions, 11 deletions
api-spec/hooks.js
src/test/java/works/weave/socks/cart/controllers/UnitHealthCheckController.java
+18
-6
18 additions, 6 deletions
...ave/socks/cart/controllers/UnitHealthCheckController.java
with
29 additions
and
26 deletions
api-spec/cart.json
+
0
−
9
View file @
efc12f93
...
...
@@ -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"
,
...
...
This diff is collapsed.
Click to expand it.
api-spec/hooks.js
+
11
−
11
View file @
efc12f93
...
...
@@ -5,16 +5,16 @@ const ObjectID = require('mongodb').ObjectID;
let
db
;
const
address
=
[
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651bd
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Address
"
,
"
number
"
:
"
69
"
,
"
street
"
:
"
Wilson Street
"
,
"
city
"
:
"
Hartlepool
"
,
"
postcode
"
:
"
TS26 8JU
"
,
"
country
"
:
"
United Kingdom
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c0
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Address
"
,
"
number
"
:
"
122
"
,
"
street
"
:
"
Radstone WayNet
"
,
"
city
"
:
"
Northampton
"
,
"
postcode
"
:
"
NN2 8NT
"
,
"
country
"
:
"
United Kingdom
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c3
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Address
"
,
"
number
"
:
"
3
"
,
"
street
"
:
"
Radstone Way
"
,
"
city
"
:
"
Northampton
"
,
"
postcode
"
:
"
NN2 8NT
"
,
"
country
"
:
"
United Kingdom
"
}
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651bd
"
),
"
_class
"
:
"
works.weave.socks.
user
s.entities.Address
"
,
"
number
"
:
"
69
"
,
"
street
"
:
"
Wilson Street
"
,
"
city
"
:
"
Hartlepool
"
,
"
postcode
"
:
"
TS26 8JU
"
,
"
country
"
:
"
United Kingdom
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c0
"
),
"
_class
"
:
"
works.weave.socks.
user
s.entities.Address
"
,
"
number
"
:
"
122
"
,
"
street
"
:
"
Radstone WayNet
"
,
"
city
"
:
"
Northampton
"
,
"
postcode
"
:
"
NN2 8NT
"
,
"
country
"
:
"
United Kingdom
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c3
"
),
"
_class
"
:
"
works.weave.socks.
user
s.entities.Address
"
,
"
number
"
:
"
3
"
,
"
street
"
:
"
Radstone Way
"
,
"
city
"
:
"
Northampton
"
,
"
postcode
"
:
"
NN2 8NT
"
,
"
country
"
:
"
United Kingdom
"
}
];
const
card
=
[
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651be
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Card
"
,
"
longNum
"
:
"
8575776807334952
"
,
"
expires
"
:
"
08/19
"
,
"
ccv
"
:
"
014
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c1
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Card
"
,
"
longNum
"
:
"
8918468841895184
"
,
"
expires
"
:
"
08/19
"
,
"
ccv
"
:
"
597
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c4
"
),
"
_class
"
:
"
works.weave.socks.
account
s.entities.Card
"
,
"
longNum
"
:
"
6426429851404909
"
,
"
expires
"
:
"
08/19
"
,
"
ccv
"
:
"
381
"
}
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651be
"
),
"
_class
"
:
"
works.weave.socks.
user
s.entities.Card
"
,
"
longNum
"
:
"
8575776807334952
"
,
"
expires
"
:
"
08/19
"
,
"
ccv
"
:
"
014
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c1
"
),
"
_class
"
:
"
works.weave.socks.
user
s.entities.Card
"
,
"
longNum
"
:
"
8918468841895184
"
,
"
expires
"
:
"
08/19
"
,
"
ccv
"
:
"
597
"
},
{
"
_id
"
:
ObjectID
(
"
579f21ae98684924944651c4
"
),
"
_class
"
:
"
works.weave.socks.
user
s.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.
account
s.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.
user
s.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.
account
s.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.
account
s.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.
user
s.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.
user
s.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;
...
...
This diff is collapsed.
Click to expand it.
src/test/java/works/weave/socks/cart/controllers/UnitHealthCheckController.java
+
18
−
6
View file @
efc12f93
...
...
@@ -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
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment