Skip to content

Commit 2957eac

Browse files
vins01-4scienceMicheleboychuk
authored andcommitted
Merged in task/dspace-cris-2024_02_x/DSC-2566 (pull request DSpace#4796)
DSC-2566 Approved-by: Mykhaylo Boychuk
2 parents 0fb79cf + d4eb887 commit 2957eac

File tree

3 files changed

+74
-10
lines changed

3 files changed

+74
-10
lines changed

bitbucket-pipelines.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
image: maven:3.9.8-eclipse-temurin-17-focal
1+
image: maven:3.9.11-eclipse-temurin-17
22

33
definitions:
4-
docker:
5-
memory: 4096 # increase memory for docker-in-docker from 1GB to 4GB
64
caches:
75
gradle-java17: ~/.gradle/caches
86
gradlewrapper-java17: ~/.gradle/wrapper
97
maven-java17: ~/.m2/repository
108
mvnVars:
11-
&setEnv export MAVEN_OPTS="-Xmx4096M" &&
12-
export MAVEN_ARGS="-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS"
9+
&setEnv export MAVEN_ARGS="-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS"
1310
steps:
1411
- step: &install
1512
runs-on:
@@ -26,7 +23,7 @@ definitions:
2623
- maven-java17
2724
script:
2825
- *setEnv
29-
- mvn install -ntp -T 1C -B -P-assembly,pipeline $MAVEN_ARGS
26+
- mvn install -ntp -T 1C -B -P-assembly,pipeline -Drun.jvmArguments="-XX:MaxRAMPercentage=50.0 -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" $MAVEN_ARGS
3027
artifacts:
3128
- target/local-repo/**
3229
- dspace-server-webapp/target/**
@@ -49,7 +46,7 @@ definitions:
4946
script:
5047
- *setEnv
5148
- cp -rf target/local-repo/** ~/.m2/repository/
52-
- mvn -T 1C test -B -pl dspace-api,dspace-server-webapp,dspace-services,dspace-oai -P-assembly -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=false -Dtest.argLine="-XX:MaxRAMPercentage=75 -XX:InitialRAMPercentage=60 -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError" -DskipUnitTests=false $MAVEN_ARGS
49+
- mvn -T 1C test -B -pl dspace-api,dspace-server-webapp,dspace-services,dspace-oai -P-assembly -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=false -Dtest.argLine="-XX:MaxMetaspaceSize=2g -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" -DskipUnitTests=false $MAVEN_ARGS
5350
artifacts:
5451
- dspace-api/target/surefire-reports/*-output.txt
5552
- dspace-server-webapp/target/surefire-reports/*-output.txt
@@ -76,7 +73,7 @@ definitions:
7673
script:
7774
- *setEnv
7875
- cp -rf target/local-repo/** ~/.m2/repository/
79-
- mvn verify -pl dspace-api -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=true -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:MaxRAMPercentage=75 -XX:InitialRAMPercentage=60 -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError" $MAVEN_ARGS
76+
- mvn verify -pl dspace-api -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=true -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:MaxMetaspaceSize=1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" $MAVEN_ARGS
8077
artifacts:
8178
- dspace-api/target/surefire-reports/*-output.txt
8279
- dspace-api/target/failsafe-reports/*-output.txt
@@ -98,7 +95,7 @@ definitions:
9895
- *setEnv
9996
- #- ./dspace-api/src/test/data/dspaceFolder/bin/install_grobid.sh
10097
- cp -rf target/local-repo/** ~/.m2/repository/
101-
- mvn verify -pl dspace-server-webapp -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=true -Dit.test=*IT,\!GenericAuthorizationFeatureIT,\!WorkspaceItemRestRepositoryIT,\!ItemImportIT,\!ItemRestRepositoryIT,\!LeftTiltedRelationshipRestRepositoryIT,\!RelationshipRestRepositoryIT,\!StatisticsRestRepositoryIT,\!DiscoveryRestControllerIT,\!PatchMetadataIT,\!VersionRestRepositoryIT,\!CollectionRestRepositoryIT,\!DiscoveryScopeBasedRestControllerIT,\!BrowsesResourceControllerIT,\!BitstreamRestRepositoryIT,\!RightTiltedRelationshipRestRepositoryIT,\!ResearcherProfileRestRepositoryIT,\!StatisticsRestSearchByCategoryRepositoryIT,\!TaskRestRepositoriesIT -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:+UseG1GC -XX:MaxRAMPercentage=75 -XX:InitialRAMPercentage=60 -XX:+HeapDumpOnOutOfMemoryError" $MAVEN_ARGS
98+
- mvn verify -pl dspace-server-webapp -nsu -ntp -Dmaven.main.skip -DuseIncrementalCompilation=true -Dit.test=*IT,\!GenericAuthorizationFeatureIT,\!WorkspaceItemRestRepositoryIT,\!ItemImportIT,\!ItemRestRepositoryIT,\!LeftTiltedRelationshipRestRepositoryIT,\!RelationshipRestRepositoryIT,\!StatisticsRestRepositoryIT,\!DiscoveryRestControllerIT,\!PatchMetadataIT,\!VersionRestRepositoryIT,\!CollectionRestRepositoryIT,\!DiscoveryScopeBasedRestControllerIT,\!BrowsesResourceControllerIT,\!BitstreamRestRepositoryIT,\!RightTiltedRelationshipRestRepositoryIT,\!ResearcherProfileRestRepositoryIT,\!StatisticsRestSearchByCategoryRepositoryIT,\!TaskRestRepositoriesIT -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:MaxMetaspaceSize=1g -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" $MAVEN_ARGS
10299
artifacts:
103100
- dspace-server-webapp/target/surefire-reports/*-output.txt
104101
- dspace-server-webapp/target/failsafe-reports/*-output.txt
@@ -119,7 +116,7 @@ definitions:
119116
script:
120117
- *setEnv
121118
- cp -rf target/local-repo/** ~/.m2/repository/
122-
- mvn verify -pl dspace-server-webapp -nsu -ntp -Dmaven.main.skip -Dit.test=GenericAuthorizationFeatureIT,WorkspaceItemRestRepositoryIT,ItemImportIT,ItemRestRepositoryIT,LeftTiltedRelationshipRestRepositoryIT,RelationshipRestRepositoryIT,StatisticsRestRepositoryIT,DiscoveryRestControllerIT,PatchMetadataIT,VersionRestRepositoryIT,CollectionRestRepositoryIT,DiscoveryScopeBasedRestControllerIT,BrowsesResourceControllerIT,BitstreamRestRepositoryIT,RightTiltedRelationshipRestRepositoryIT,ResearcherProfileRestRepositoryIT,StatisticsRestSearchByCategoryRepositoryIT,TaskRestRepositoriesIT -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:MaxRAMPercentage=75 -XX:InitialRAMPercentage=60 -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError" $MAVEN_ARGS
119+
- mvn verify -pl dspace-server-webapp -nsu -ntp -Dmaven.main.skip -Dit.test=GenericAuthorizationFeatureIT,WorkspaceItemRestRepositoryIT,ItemImportIT,ItemRestRepositoryIT,LeftTiltedRelationshipRestRepositoryIT,RelationshipRestRepositoryIT,StatisticsRestRepositoryIT,DiscoveryRestControllerIT,PatchMetadataIT,VersionRestRepositoryIT,CollectionRestRepositoryIT,DiscoveryScopeBasedRestControllerIT,BrowsesResourceControllerIT,BitstreamRestRepositoryIT,RightTiltedRelationshipRestRepositoryIT,ResearcherProfileRestRepositoryIT,StatisticsRestSearchByCategoryRepositoryIT,TaskRestRepositoriesIT -DskipUnitTests=true -DskipIntegrationTests=false -B -Dsurefire.rerunFailingTestsCount=2 -Dtest.argLine="-XX:MaxMetaspaceSize=1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:+HeapDumpOnOutOfMemoryError -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" $MAVEN_ARGS
123120
artifacts:
124121
- dspace-server-webapp/target/surefire-reports/*-output.txt
125122
- dspace-server-webapp/target/failsafe-reports/*-output.txt

dspace-server-webapp/src/test/java/org/dspace/app/rest/ZDBAuthorityIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
import org.hamcrest.Matchers;
1919
import org.junit.Test;
2020
import org.springframework.beans.factory.annotation.Autowired;
21+
import org.springframework.context.annotation.Import;
2122

2223
/**
2324
* This class handles ZDBAuthority related IT.
2425
*
2526
* @author Luca Giamminonni (luca.giamminonni at 4Science.it)
2627
*/
28+
@Import(ZDBAuthorityTestConfig.class)
2729
public class ZDBAuthorityIT extends AbstractControllerIntegrationTest {
2830

2931
@Autowired
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree and available online at
5+
*
6+
* http://www.dspace.org/license/
7+
*/
8+
package org.dspace.app.rest;
9+
10+
import java.io.IOException;
11+
import java.util.ArrayList;
12+
import java.util.List;
13+
14+
import org.dspace.content.authority.zdb.ZDBAuthorityValue;
15+
import org.dspace.content.authority.zdb.ZDBService;
16+
import org.mockito.Mockito;
17+
import org.springframework.context.annotation.Bean;
18+
import org.springframework.context.annotation.Configuration;
19+
import org.springframework.context.annotation.Primary;
20+
21+
@Configuration
22+
public class ZDBAuthorityTestConfig {
23+
24+
@Bean(name = "ZDBSource")
25+
@Primary
26+
public ZDBService zdbService() {
27+
ZDBService mock = Mockito.mock(ZDBService.class);
28+
try {
29+
Mockito.when(mock.list("Acta AND Mathematica AND informatica", 0, 10)).thenReturn(createMockResults());
30+
} catch (IOException e) {
31+
// Should not happen for mock
32+
}
33+
return mock;
34+
}
35+
36+
private List<ZDBAuthorityValue> createMockResults() {
37+
List<ZDBAuthorityValue> results = new ArrayList<>();
38+
// Create the first entry
39+
ZDBAuthorityValue zdb1 = new ZDBAuthorityValue();
40+
zdb1.setServiceId("1447228-4");
41+
zdb1.setValue("Acta mathematica et informatica");
42+
zdb1.addOtherMetadata("journalZDBID", "1447228-4");
43+
zdb1.addOtherMetadata("journalTitle", "Acta mathematica et informatica");
44+
45+
// Create the second entry
46+
ZDBAuthorityValue zdb2 = new ZDBAuthorityValue();
47+
zdb2.setServiceId("1194912-0");
48+
zdb2.setValue("Acta mathematica Universitatis Ostraviensis");
49+
zdb2.addOtherMetadata("journalZDBID", "1194912-0");
50+
zdb2.addOtherMetadata("journalTitle", "Acta mathematica Universitatis Ostraviensis");
51+
zdb2.addOtherMetadata("journalIssn", "1211-4774");
52+
53+
// Create the third entry
54+
ZDBAuthorityValue zdb3 = new ZDBAuthorityValue();
55+
zdb3.setServiceId("2618143-5");
56+
zdb3.setValue("Acta mathematica Universitatis Ostraviensis");
57+
zdb3.addOtherMetadata("journalZDBID", "2618143-5");
58+
zdb3.addOtherMetadata("journalTitle", "Acta mathematica Universitatis Ostraviensis");
59+
60+
results.add(zdb1);
61+
results.add(zdb2);
62+
results.add(zdb3);
63+
return results;
64+
}
65+
}

0 commit comments

Comments
 (0)