From 93a9306a85422a880ab56c7364c4d192f9d2e40c Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Wed, 16 Jun 2010 04:39:47 +0000 Subject: [PATCH] CSPACE-2136: Updated Loans In (aka Loan In) schema at the services layer to the Limited for 0.8 schema. Made the lenders field non-repeatable, which may have a salutary impact on as many as four currently open JIRAs. --- .../main/config/services/tenant-bindings.xml | 4 ++-- .../main/resources/schemas/loansin_common.xsd | 8 +------- .../client/test/LoaninAuthRefsTest.java | 20 ++++++++++++++----- .../client/test/LoaninServiceTest.java | 8 +------- .../src/main/resources/loansin-common.xsd | 8 +------- 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/services/common/src/main/config/services/tenant-bindings.xml b/services/common/src/main/config/services/tenant-bindings.xml index 087088613..57aa34d80 100644 --- a/services/common/src/main/config/services/tenant-bindings.xml +++ b/services/common/src/main/config/services/tenant-bindings.xml @@ -176,7 +176,7 @@ versionable="true" auditable="false" label="loansin_common" updated="" order="1"> - + authReflender authReflendersAuthorizer authReflendersContact authRefloanInContact @@ -1222,7 +1222,7 @@ versionable="true" auditable="false" label="loansin_common" updated="" order="1"> - + authReflender authReflendersAuthorizer authReflendersContact authRefloanInContact diff --git a/services/loanin/3rdparty/nuxeo-platform-cs-loanin/src/main/resources/schemas/loansin_common.xsd b/services/loanin/3rdparty/nuxeo-platform-cs-loanin/src/main/resources/schemas/loansin_common.xsd index fe0cdb1cf..c3bfb213e 100644 --- a/services/loanin/3rdparty/nuxeo-platform-cs-loanin/src/main/resources/schemas/loansin_common.xsd +++ b/services/loanin/3rdparty/nuxeo-platform-cs-loanin/src/main/resources/schemas/loansin_common.xsd @@ -22,13 +22,7 @@ - - - - - - - + diff --git a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java index 6845b0537..e51422ae0 100644 --- a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java +++ b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java @@ -72,12 +72,13 @@ public class LoaninAuthRefsTest extends BaseServiceTest { private List loaninIdsCreated = new ArrayList(); private List personIdsCreated = new ArrayList(); private String personAuthCSID = null; + private String lenderRefName = null; private String lendersAuthorizerRefName = null; private String lendersContactRefName = null; private String loanInContactRefName = null; // FIXME: May change when repeatable / multivalue 'lenders' field is added // to tenant-bindings.xml - private final int NUM_AUTH_REFS_EXPECTED = 3; + private final int NUM_AUTH_REFS_EXPECTED = 4; /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() @@ -122,6 +123,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest { MultipartOutput multipart = createLoaninInstance( "loanInNumber-" + identifier, "returnDate-" + identifier, + lenderRefName, lendersAuthorizerRefName, lendersContactRefName, loanInContactRefName); @@ -177,6 +179,10 @@ public class LoaninAuthRefsTest extends BaseServiceTest { // Create temporary Person resources, and their corresponding refNames // by which they can be identified. + lenderRefName = + PersonAuthorityClientUtils.createPersonRefName(authRefName, "Linus Lender", true); + personIdsCreated.add(createPerson("Linus", "Lender", lenderRefName)); + lendersAuthorizerRefName = PersonAuthorityClientUtils.createPersonRefName(authRefName, "Art Lendersauthorizor", true); personIdsCreated.add(createPerson("Art", "Lendersauthorizor", lendersAuthorizerRefName)); @@ -245,7 +251,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest { logger.debug(objectAsXmlString(loanin, LoansinCommon.class)); } // Check a couple of fields - // FIXME + Assert.assertEquals(loanin.getLender(), lenderRefName); Assert.assertEquals(loanin.getLendersAuthorizer(), lendersAuthorizerRefName); Assert.assertEquals(loanin.getLendersContact(), lendersContactRefName); Assert.assertEquals(loanin.getLoanInContact(), loanInContactRefName); @@ -269,9 +275,6 @@ public class LoaninAuthRefsTest extends BaseServiceTest { logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED + " authority references, found " + numAuthRefsFound); } - Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED, - "Did not find all expected authority references! " + - "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound); // Optionally output additional data about list members for debugging. boolean iterateThroughList = true; @@ -289,6 +292,11 @@ public class LoaninAuthRefsTest extends BaseServiceTest { i++; } } + + Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED, + "Did not find all expected authority references! " + + "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound); + } @@ -351,12 +359,14 @@ public class LoaninAuthRefsTest extends BaseServiceTest { private MultipartOutput createLoaninInstance(String loaninNumber, String returnDate, + String lender, String lendersAuthorizer, String lendersContact, String loaninContact) { LoansinCommon loanin = new LoansinCommon(); loanin.setLoanInNumber(loaninNumber); loanin.setLoanInNumber(returnDate); + loanin.setLender(lender); loanin.setLendersAuthorizer(lendersAuthorizer); loanin.setLendersContact(lendersContact); loanin.setLoanInContact(loaninContact); diff --git a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java index 29fcb4a3b..93d22ec17 100644 --- a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java +++ b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java @@ -32,7 +32,6 @@ import org.collectionspace.services.client.LoaninClient; import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.loanin.LoansinCommon; import org.collectionspace.services.loanin.LoansinCommonList; -import org.collectionspace.services.loanin.LenderList; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; @@ -774,12 +773,7 @@ public class LoaninServiceTest extends AbstractServiceTestImpl { LoansinCommon loanin = new LoansinCommon(); loanin.setLoanInNumber(loaninNumber); loanin.setLoanReturnDate(returnDate); - LenderList lenderList = new LenderList(); - lenderList.getLender().add( - "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Harry Lender)'Harry Lender'"); - lenderList.getLender().add( - "urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Sally Lender)'Sally Lender'"); - loanin.setLenders(lenderList); + loanin.setLender("urn:cspace:org.collectionspace.demo:personauthority:name(TestPersonAuth):person:name(Harry Lender)'Harry Lender'"); loanin.setLoanPurpose("For Surfboards of the 1960s exhibition."); MultipartOutput multipart = new MultipartOutput(); OutputPart commonPart = diff --git a/services/loanin/jaxb/src/main/resources/loansin-common.xsd b/services/loanin/jaxb/src/main/resources/loansin-common.xsd index 5cda41333..ae65cf10c 100644 --- a/services/loanin/jaxb/src/main/resources/loansin-common.xsd +++ b/services/loanin/jaxb/src/main/resources/loansin-common.xsd @@ -33,7 +33,7 @@ - + @@ -47,12 +47,6 @@ - - - - - - -- 2.47.3