Index: branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitPartController.groovy =================================================================== diff -u -r9502 -r9546 --- branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitPartController.groovy (.../SampleKitPartController.groovy) (revision 9502) +++ branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitPartController.groovy (.../SampleKitPartController.groovy) (revision 9546) @@ -36,7 +36,7 @@ } private save(Integer id) { - Map values = request.JSON + Map values = request.JSON.SampleKitPart SampleKitPart sampleKitPart = sampleManagerService.saveSampleKitPart(values, id, auditUserName) if (sampleKitPart.hasErrors()) { render toJson(legacyPackage(errors: collectLegacyErrors(sampleKitPart))) } else { show(sampleKitPart.id) } Index: branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSamplePersistenceFunctionalSpec.groovy =================================================================== diff -u -r9529 -r9546 --- branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSamplePersistenceFunctionalSpec.groovy (.../SalesmanRepSamplePersistenceFunctionalSpec.groovy) (revision 9529) +++ branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSamplePersistenceFunctionalSpec.groovy (.../SalesmanRepSamplePersistenceFunctionalSpec.groovy) (revision 9546) @@ -14,7 +14,7 @@ def 'can create a valid salesman rep sample'() { given: - Map sample = [salesmanId: '02', sampleKitId: 8] + Map sample = [SalesmanRepSample: [salesmanId: '02', sampleKitId: 8]] path() ok() @@ -33,7 +33,7 @@ def 'can update a valid salesman rep sample'() { given: - String json = '{ "createdBy": "vramisetti" }' + String json = '{"SalesmanRepSample": { "createdBy": "vramisetti" }}' path(id) ok() Index: branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SalesmanRepSampleController.groovy =================================================================== diff -u -r9505 -r9546 --- branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SalesmanRepSampleController.groovy (.../SalesmanRepSampleController.groovy) (revision 9505) +++ branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SalesmanRepSampleController.groovy (.../SalesmanRepSampleController.groovy) (revision 9546) @@ -9,7 +9,6 @@ def sampleManagerService - def salesRepValidationService def ssrReporter @@ -81,7 +80,7 @@ } private save(Integer id) { - Map values = request.JSON + Map values = request.JSON.SalesmanRepSample SalesmanRepSample salesmanRepSample = sampleManagerService.saveSalesmanRepSample(values, id, auditUserName) if (!salesmanRepSample || salesmanRepSample.hasErrors()) { render toJson(legacyPackage(errors: (salesmanRepSample ? collectLegacyErrors(salesmanRepSample) : Index: branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSampleFunctionalSpec.groovy =================================================================== diff -u -r9529 -r9546 --- branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSampleFunctionalSpec.groovy (.../SalesmanRepSampleFunctionalSpec.groovy) (revision 9529) +++ branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SalesmanRepSampleFunctionalSpec.groovy (.../SalesmanRepSampleFunctionalSpec.groovy) (revision 9546) @@ -142,7 +142,7 @@ def 'can NOT create an invalid salesman rep sample'() { given: - String json = '{ }' + String json = '{"SalesmanRepSample": {} }' path() ok() @@ -161,7 +161,7 @@ def 'can NOT add a duplicate SalesmanRepSample'() { given: - String json = '{ "salesmanId": "02", "sampleKitId": 134 }' + String json = '{ "SalesmanRepSample": { "salesmanId": "02", "sampleKitId": 134 }}' path() ok() Index: branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitPartFunctionalSpec.groovy =================================================================== diff -u -r9529 -r9546 --- branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitPartFunctionalSpec.groovy (.../SampleKitPartFunctionalSpec.groovy) (revision 9529) +++ branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitPartFunctionalSpec.groovy (.../SampleKitPartFunctionalSpec.groovy) (revision 9546) @@ -15,8 +15,8 @@ final static int ALL_COLUMNS_SIZE = 12 Map createPart(String partNumber = '0011716') { - [quantity: 3, partNumber: partNumber, - sampleKitId: sampleKitId, description: 'stuff'] + [SampleKitPart: [quantity: 3, partNumber: partNumber, + sampleKitId: sampleKitId, description: 'stuff']] } def 'can find all sampleKitParts'() { @@ -136,9 +136,9 @@ def 'can update a valid SampleKitPart'() { given: Map part = createPart() - part.sampleKitPartId = partId - part.description = 'more stuff' - part.samplePrice = 19.99 + part.SampleKitPart.sampleKitPartId = partId + part.SampleKitPart.description = 'more stuff' + part.SampleKitPart.samplePrice = 19.99 path(partId) ok() Index: branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitFunctionalSpec.groovy =================================================================== diff -u -r9529 -r9546 --- branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitFunctionalSpec.groovy (.../SampleKitFunctionalSpec.groovy) (revision 9529) +++ branches/grails3_dealer-service/src/integration-test/groovy/com/lemans/samples/SampleKitFunctionalSpec.groovy (.../SampleKitFunctionalSpec.groovy) (revision 9546) @@ -120,7 +120,9 @@ def 'can NOT create an invalid new SampleKit'() { given: - String json = '{ "description": "test" }' + String json = ''' + {"SampleKit": { "description": "test" }} + ''' path() ok() @@ -139,7 +141,17 @@ def 'can NOT create a duplicate SampleKit'() { given: - String json = '{ "sampleKitName": "sample 4", "brandId": 345, "startDate": "01/01/2015", "sampleTypeId": 3 }' + String json = ''' + { + "SampleKit": + + { "sampleKitName": "sample 4", + "brandId": 345, + "startDate": "01/01/2015", + "sampleTypeId": 3 + } + } + ''' path() ok() @@ -160,11 +172,14 @@ given: String json = """ { + "SampleKit": + { "sampleKitName": "$randomSampleKitName", "description": "blah", "brandId": 1, "startDate": "$today", "sampleTypeId": 1 } + } """ path() ok() @@ -189,13 +204,16 @@ def 'can update a valid SampleKit'() { given: int id = 5 - String json = """ + String json = """ { + "SampleKit": + { "sampleKitName": "$randomSampleKitName", "description": "blah blah", "brandId": 1, "startDate": "$today", "sampleTypeId": 1 } + } """ path(id) ok() @@ -220,11 +238,14 @@ String description = 'blah blah'.padRight(201, '_') String json = """ { + "SampleKit": + { "sampleKitName": "$randomSampleKitName", "description": "$description", "brandId": 1, "startDate": "$today", "sampleTypeId": 1 } + } """ path(id) ok() Index: branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitController.groovy =================================================================== diff -u -r9502 -r9546 --- branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitController.groovy (.../SampleKitController.groovy) (revision 9502) +++ branches/grails3_dealer-service/grails-app/controllers/com/lemans/samples/SampleKitController.groovy (.../SampleKitController.groovy) (revision 9546) @@ -45,7 +45,7 @@ } private save(Integer id) { - Map values = request.JSON + Map values = request.JSON.SampleKit SampleKit sampleKit = sampleManagerService.saveSampleKit(values, id, auditUserName) if (sampleKit.hasErrors()) { render toJson(legacyPackage(errors: collectLegacyErrors(sampleKit))) } else { show(sampleKit.id) } Index: branches/grails3_dealer-service/grails-app/services/com/lemans/samples/SampleManagerService.groovy =================================================================== diff -u -r9528 -r9546 --- branches/grails3_dealer-service/grails-app/services/com/lemans/samples/SampleManagerService.groovy (.../SampleManagerService.groovy) (revision 9528) +++ branches/grails3_dealer-service/grails-app/services/com/lemans/samples/SampleManagerService.groovy (.../SampleManagerService.groovy) (revision 9546) @@ -60,7 +60,6 @@ SampleKit saveSampleKit(Map values, Integer id, String username) { SampleKit sampleKit = (id != null) ? findSampleKit(id) : new SampleKit() if (!sampleKit) { throw new IllegalStateException("No record found for SampleKit with Id: $id") } - applyValuesToDomain(values, sampleKit) Integer sampleTypeId = values.sampleTypeId if (sampleTypeId) { sampleKit.sampleType = findDomainObjectById(SampleType, sampleTypeId) }