Enhanced curl commands

Fixed SpringFox/SwaggerUI issue with CustomerController
This commit is contained in:
Chris Richardson
2016-02-12 17:55:20 -08:00
parent 92526f2780
commit a217f1b1e6
3 changed files with 57 additions and 2 deletions

View File

@@ -31,9 +31,9 @@ public class CustomerController {
}
@RequestMapping(value = "/{id}/toaccounts", method = RequestMethod.POST)
public Observable<ResponseEntity<?>> addToAccount(@PathVariable String id, @Validated @RequestBody ToAccountInfo request) {
public Observable<String> addToAccount(@PathVariable String id, @Validated @RequestBody ToAccountInfo request) {
return customerService.addToAccount(id, request)
.map(entityAndEventInfo -> ResponseEntity.ok().build());
.map(entityAndEventInfo -> entityAndEventInfo.entityVersion().asString());
}
}

View File

@@ -0,0 +1,55 @@
#! /bin/bash -e
# Create a customer
customer=$(curl -v --data '{
"address": {
"city": "Oakland",
"state": "CA",
"street1": "1 High Street",
"zipCode": "12345"
},
"email": "foo@bar.com",
"name": {
"firstName": "John",
"lastName": "Doe"
},
"phoneNumber": "415551212",
"ssn": "123-45-6789"
}' -H "content-type: application/json" http://${DOCKER_HOST_IP?}:8083/customers)
customerId=$(echo $customer | jq -r .id)
echo customerId=$customerId
# Create account 1
account1=$(curl -v --data "{\"initialBalance\" : 500, \"customerId\" : \"$customerId\"}" -H "content-type: application/json" http://${DOCKER_HOST_IP?}:8080/accounts)
accountId1=$(echo $account1 | jq -r ".accountId")
curl -v http://${DOCKER_HOST_IP?}:8081/accounts/$accountId1
echo accountId1=$accountId1
# Create account 2
account2=$(curl -v --data "{\"initialBalance\" : 300, \"customerId\" : \"$customerId\"}" -H "content-type: application/json" http://${DOCKER_HOST_IP?}:8080/accounts)
accountId2=$(echo $account2 | jq -r ".accountId")
curl -v http://${DOCKER_HOST_IP?}:8081/accounts/$accountId2
echo accountId2=$accountId2
#
transfer=$(curl -v --data "{\"amount\" : 150,
\"fromAccountId\" : \"$accountId1\", \"toAccountId\" : \"$accountId2\"
}" -H "content-type: application/json" http://${DOCKER_HOST_IP?}:8082/transfers)
echo transfer=$transfer