Skip to content

Commit

Permalink
Merge pull request #63 from folio-org/EDGRTAC-81
Browse files Browse the repository at this point in the history
Add holdingsCopyNumber and ItemsCopyNumber to rtac response
  • Loading branch information
yusuf-murodov-epam authored Mar 6, 2024
2 parents 4fa1459 + 8b4e207 commit bfba49e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ramls/batch-holdings.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<xs:element name="tempLocation" type="xs:string" minOccurs="0"/>
<xs:element name="volume" type="xs:string" minOccurs="0"/>
<xs:element name="temporaryLoanType" type="xs:string" minOccurs="0"/>
<xs:element name="permanentLoanType" type="xs:string" minOccurs="0"/>
<xs:element name="holdingsCopyNumber" type="xs:string" minOccurs="0"/>
<xs:element name="itemCopyNumber" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
2 changes: 2 additions & 0 deletions ramls/holdings.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<xs:element name="dueDate" type="xs:string"/>
<xs:element name="tempLocation" type="xs:string" minOccurs="0"/>
<xs:element name="volume" type="xs:string" minOccurs="0"/>
<xs:element name="holdingsCopyNumber" type="xs:string" minOccurs="0"/>
<xs:element name="itemCopyNumber" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/folio/edge/rtac/model/Holding.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public final class Holding {
private final String temporaryLoanType;
@JsonProperty("permanentLoanType")
private final String permanentLoanType;
@JsonProperty("holdingsCopyNumber")
public final String holdingsCopyNumber;
@JsonProperty("itemCopyNumber")
public final String itemCopyNumber;

@Override
public boolean equals(Object o) {
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/org/folio/edge/rtac/MainVerticleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public void testRtacTitleFound(TestContext context) throws Exception {
assertEquals("PS3552.E796 D44x 1975", holdingRecord.getString("callNumber"));
assertEquals("Item in place", holdingRecord.getString("status"));
assertEquals("v.5:no.2-6", holdingRecord.getString("volume"));
assertEquals("101", holdingRecord.getString("holdingsCopyNumber"));
assertEquals("201", holdingRecord.getString("itemCopyNumber"));
}

// Unsuccessful searches result in a 200 OK status with an empty element in the
Expand Down Expand Up @@ -262,6 +264,10 @@ public void testRtacBatching(TestContext context) throws Exception {
assertEquals("Item in place", secondHoldings.getString("status"));
assertEquals("v.5:no.2-6", firstHoldings.getString("volume"));
assertEquals("v.5:no.2-6", secondHoldings.getString("volume"));
assertEquals("101", firstHoldings.getString("holdingsCopyNumber"));
assertEquals("101", secondHoldings.getString("holdingsCopyNumber"));
assertEquals("201", firstHoldings.getString("itemCopyNumber"));
assertEquals("201", secondHoldings.getString("itemCopyNumber"));
}

@Test
Expand Down Expand Up @@ -463,6 +469,8 @@ public void shouldRespondWithXMLWhenClientDoesNotStateAPreference() throws IOExc
assertEquals("PS3552.E796 D44x 1975", holding.callNumber);
assertEquals("Item in place", holding.status);
assertEquals("v.5:no.2-6", holding.volume);
assertEquals("101", holding.holdingsCopyNumber);
assertEquals("201", holding.itemCopyNumber);
}

@Test
Expand Down
14 changes: 13 additions & 1 deletion src/test/java/org/folio/edge/rtac/model/InstancesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,33 @@ public void setUp() throws Exception {
.status("Item in place")
.dueDate("")
.volume("v.10:no.2")
.itemCopyNumber("101")
.build();

Holding h2 = Holding.builder()
.id("99712686103569")
.callNumber("PS3552.E796 D44x 1975")
.location("LC General Collection Millersville University Library")
.status("Item in place")
.holdingsCopyNumber("201")
.dueDate("2018-04-23 12:00:00")
.build();

Holding h3 = Holding.builder()
.id("99712686103569")
.callNumber("PS3552.E796 D44x 1975")
.location("LC General Collection Millersville University Library")
.status("Item in place")
.itemCopyNumber("102")
.holdingsCopyNumber("202")
.dueDate("2018-04-23 12:00:00")
.build();

instances = new Instances();

final var holdings = new Holdings();
holdings.setInstanceId(INSTANCE_ID);
holdings.setHoldings(List.of(h1, h2));
holdings.setHoldings(List.of(h1, h2, h3));
instances.setHoldings(List.of(holdings));

SchemaFactory schemaFactory = SchemaFactory
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/folio/edge/rtac/utils/RtacMockOkapi.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public static Holdings getHoldings(String titleId) {
.tempLocation("")
.dueDate("")
.volume("v.5:no.2-6")
.holdingsCopyNumber("101")
.itemCopyNumber("201")
.build();

final var holdings = new Holdings();
Expand Down

0 comments on commit bfba49e

Please sign in to comment.