Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@article{Smith_Red_2018, title={Publication title}, volume={V01}, ISBN={11-22-33}, url={http://localhost:4000/handle/123456789/0001}, DOI={10.1000/182}, number={3}, publisher={Publisher}, author={Smith, John and Red, Edward}, editor={EditorEditor}, year={2018}, month={May}}
@book{White_2020, title={Another Publication title}, url={http://localhost:4000/handle/123456789/0002}, DOI={10.1000/183}, author={White, Walter}, year={2020}, month={Jan}}
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,55 @@ public void testMutlipleItemsApaDisseminate() throws Exception {
}
}

@Test
public void testMultipleItemsBibtexDisseminate() throws Exception {
context.turnOffAuthorisationSystem();

Item item = createItem(context, collection)
.withEntityType("Publication")
.withType("Controlled Vocabulary for Resource Type Genres::text::periodical::journal")
.withLanguage("en")
.withDoiIdentifier("10.1000/182")
.withIsbnIdentifier("11-22-33")
.withIssnIdentifier("0002")
.withSubject("publication")
.withPublisher("Publisher")
.withVolume("V01")
.withIssue("03")
.withRelationConference("Conference")
.withTitle("Publication title")
.withIssueDate("2018-05-17")
.withAuthor("Smith, John")
.withAuthor("Red, Edward")
.withEditor("Editor")
.withHandle("123456789/0001")
.build();

Item anotherItem = createItem(context, collection)
.withEntityType("Publication")
.withType("Controlled Vocabulary for Resource Type Genres::text::book")
.withLanguage("en")
.withDoiIdentifier("10.1000/183")
.withTitle("Another Publication title")
.withIssueDate("2020-01-01")
.withAuthor("White, Walter")
.withHandle("123456789/0002")
.build();

context.restoreAuthSystemState();

StreamDisseminationCrosswalk crosswalk = crosswalkMapper.getByType("bibtex");
assertThat(crosswalk, notNullValue());

ByteArrayOutputStream out = new ByteArrayOutputStream();
crosswalk.disseminate(context, Arrays.asList(item, anotherItem).iterator(), out);

try (FileInputStream fis = getFileInputStream("publications.bib")) {
String expectedContent = IOUtils.toString(fis, Charset.defaultCharset());
compareEachLine(out.toString(), expectedContent, true);
}
}

private void compareEachLine(String result, String expectedResult, boolean skipId) {

String[] resultLines = result.split("\n");
Expand Down
2 changes: 1 addition & 1 deletion dspace/config/spring/api/crosswalks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<property name="mimeType" value="application/x-bibtex; charset=UTF-8"/>
<property name="format" value="text"/>
<property name="fileName" value="references.bib"/>
<property name="crosswalkMode" value="#{T(org.dspace.content.crosswalk.CrosswalkMode).SINGLE}"/>
<property name="crosswalkMode" value="#{T(org.dspace.content.crosswalk.CrosswalkMode).SINGLE_AND_MULTIPLE}"/>
</bean>

<bean class="org.dspace.content.integration.crosswalks.CSLItemDataCrosswalk" id="cslItemDataCrosswalkApa">
Expand Down