Skip to content

Commit

Permalink
internal/fix-another-integration-tests (#312)
Browse files Browse the repository at this point in the history
* Set Default charset to UTF-8 in Integration tests

* Fixed test in the ExternalHandleRestRepositoryIT - problem was with encoding

* Fixed WorkspaceItemRestRepositoryIT#patchRejectLicenseTest - the configuration property that disable LicenseValidation was set to false.

* Fixed ClarinDiscoveryRestControllerIT.java#discoverFacetsDateTestWithLabels
FacetEntryMatcher.dateIssuedFacet(false), was missing

* Fixed ClarinDiscoveryRestControllerIT.java#discoverSearchObjectsTestWithBasicQuery missing FacetEntryMatcher.dateIssuedFacet(false),

* Fixed ClarinDiscoveryRestControllerIT tests by updating the discovery.xml

* Fixed MetadataExportSearchIT.exportMetadataSearchFilterDate - commented out the test for Date Issued date search filter which was removed from the discovery.xml

* test  (#317)

* Initial commit

* Fixed SystemWideAlertRestRepositoryIT - wrong Date comparing, the fix was copied from the upstream

* Copied fix from the upstream

* Enabled distribution license validation.
  • Loading branch information
milanmajchrak authored Jun 15, 2023
1 parent 9e1715f commit 6637456
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,17 @@ public void exportMetadataSearchFilter() throws Exception {
checkItemsPresentInFile(filename, itemsSubject1);
}

@Test
public void exportMetadataSearchFilterDate() throws Exception {
int result = runDSpaceScript(
"metadata-export-search", "-f", "dateIssued,equals=[2000 TO 2020]", "-n", filename
);

assertEquals(0, result);
checkItemsPresentInFile(filename, itemsSubject1);
}
// CLARIN - CLARIN-DSpace doesn't use DateIssues search filter (commented in the discovery.xml), so this test
// is failing
// @Test
// public void exportMetadataSearchFilterDate() throws Exception {
// int result = runDSpaceScript(
// "metadata-export-search", "-f", "dateIssued,equals=[2000 TO 2020]", "-n", filename
// );
//
// assertEquals(0, result);
// checkItemsPresentInFile(filename, itemsSubject1);
// }

@Test
public void exportMetadataSearchMultipleFilters() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class BitstreamFormatRestRepositoryIT extends AbstractControllerIntegrati
@Autowired
private BitstreamFormatConverter bitstreamFormatConverter;

private final int DEFAULT_AMOUNT_FORMATS = 81;
private final int DEFAULT_AMOUNT_FORMATS = 85;

@Test
public void findAllPaginationTest() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void findAllExternalHandles() throws Exception {

getClient().perform(get("/api/services/handles/magic"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().contentType(MediaType.valueOf("application/json;charset=UTF-8")))
.andExpect(jsonPath("$", ExternalHandleMatcher.matchListOfExternalHandles(
expectedExternalHandles
)))
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -127,6 +128,7 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
public void setUp() throws Exception {
super.setUp();
context.turnOffAuthorisationSystem();
Locale.setDefault(new Locale.Builder().setLanguage("en").setRegion("US").build());
this.groupService = EPersonServiceFactory.getInstance().getGroupService();

embargoedGroups = GroupBuilder.createGroup(context)
Expand Down Expand Up @@ -3748,6 +3750,8 @@ public void patchRejectLicenseTest() throws Exception {

//disable file upload mandatory
configurationService.setProperty("webui.submit.upload.required", false);
// enable distribution license validation
configurationService.setProperty("webui.submit.distribution.license.required", true);

context.restoreAuthSystemState();

Expand Down
4 changes: 2 additions & 2 deletions dspace/config/spring/api/discovery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<list>
<ref bean="searchFilterAuthor" />
<ref bean="searchFilterSubject" />
<ref bean="searchFilterIssued" />
<!-- <ref bean="searchFilterIssued" />-->
<ref bean="searchFilterRights" />
<ref bean="searchFilterLanguage" />
<ref bean="searchFilterContentInOriginalBundle"/>
Expand All @@ -186,7 +186,7 @@
<ref bean="searchFilterTitle" />
<ref bean="searchFilterAuthor" />
<ref bean="searchFilterSubject" />
<ref bean="searchFilterIssued" />
<!-- <ref bean="searchFilterIssued" />-->
<ref bean="searchFilterContentInOriginalBundle"/>
<ref bean="searchFilterFileNameInOriginalBundle" />
<ref bean="searchFilterFileDescriptionInOriginalBundle" />
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@
</property>
</activation>
<properties>
<test.argLine>-Xmx1024m</test.argLine>
<test.argLine>-Xmx1024m -Dfile.encoding=UTF-8</test.argLine>
</properties>
</profile>

Expand Down

0 comments on commit 6637456

Please sign in to comment.