Skip to content

Commit 14d6647

Browse files
committed
pull request fixation on Tests
1 parent c820f30 commit 14d6647

File tree

61 files changed

+6765
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6765
-224
lines changed

.github/disabled-workflows/deploy.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ jobs:
5757
working-directory: build-scripts/run/
5858
run: |
5959
./start.sh dspace-$INSTANCE
60+
cd ../..
61+
# use customized docker-compose file for the `85` port because the server is exposed with the namespace `repository`
62+
# `/repository/server`
63+
docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose-rest.yml -f /opt/dspace-envs/5/docker-compose.yml up -d --no-build
6064
6165
deploy-8:
6266
if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8'
@@ -147,7 +151,7 @@ jobs:
147151
playwright-after-deploy8:
148152
runs-on: ubuntu-latest
149153
needs: deploy-8
150-
timeout-minutes: 15
154+
timeout-minutes: 45
151155
if: '!inputs.IMPORT'
152156
steps:
153157
- name: run playwright
@@ -184,7 +188,7 @@ jobs:
184188
rest-tests-after-deploy8:
185189
runs-on: ubuntu-latest
186190
needs: playwright-after-deploy8
187-
timeout-minutes: 15
191+
timeout-minutes: 45
188192
steps:
189193
- name: run rest-tests
190194
run: |
@@ -219,7 +223,7 @@ jobs:
219223
runs-on: ubuntu-latest
220224
needs: import-8
221225
if: inputs.IMPORT
222-
timeout-minutes: 15
226+
timeout-minutes: 45
223227
steps:
224228
- name: run playwright
225229
run: |
@@ -256,7 +260,7 @@ jobs:
256260
rest-tests-after-import8:
257261
runs-on: ubuntu-latest
258262
needs: playwright-after-import8
259-
timeout-minutes: 15
263+
timeout-minutes: 45
260264
steps:
261265
- name: run rest-tests
262266
run: |

config/config.example.yml

+4
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,7 @@ vocabularies:
393393
comcolSelectionSort:
394394
sortField: 'dc.title'
395395
sortDirection: 'ASC'
396+
397+
matomo:
398+
hostUrl: http://localhost:8135/
399+
siteId: 1

cypress/e2e/submission-ui.cy.ts

-22
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,6 @@ describe('Create a new submission', () => {
230230
createItemProcess.showErrorNotSupportedLicense();
231231
});
232232

233-
// Author field should consist of two input fields
234-
it('Author field should consist of two input fields', {
235-
retries: {
236-
runMode: 6,
237-
openMode: 6,
238-
},
239-
defaultCommandTimeout: 10000
240-
},() => {
241-
createItemProcess.checkAuthorFirstnameField();
242-
createItemProcess.checkAuthorLastnameField();
243-
});
244-
245233
it('The submission should not have the Notice Step', {
246234
retries: {
247235
runMode: 6,
@@ -261,16 +249,6 @@ describe('Create a new submission in the clariah collection', () => {
261249
// This page is restricted, so we will be shown the login form. Fill it out & submit.
262250
cy.loginViaForm(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
263251
});
264-
265-
it('The submission should have the Notice Step', {
266-
retries: {
267-
runMode: 6,
268-
openMode: 6,
269-
},
270-
defaultCommandTimeout: 10000
271-
},() => {
272-
createItemProcess.checkClarinNoticeStep();
273-
});
274252
});
275253

276254
function addEUSponsor(euSponsorOrder) {

docker/docker-compose-rest.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ services:
6262
# BE server port
6363
- published: 808${INSTANCE}
6464
target: 8080
65-
host_ip: 127.0.0.1
65+
host_ip: ${HOST_IP:-127.0.0.1}
6666
# original debug port
6767
- published: 800${INSTANCE}
6868
target: 8000
69-
host_ip: 127.0.0.1
69+
host_ip: ${HOST_IP:-127.0.0.1}
7070
# handle binary port as per https://www.handle.net/hnr_support.html (5th paragraph)
7171
- published: 264${INSTANCE}
7272
target: 2641
@@ -92,6 +92,10 @@ services:
9292
entrypoint:
9393
- /bin/bash
9494
- '-c'
95+
# When customizing the namespace, add the following command to the entrypoint command below (after `while ...`):
96+
# `pushd ../webapps && unlink server && ln -s /dspace/webapps/server/ 'repository#server' && popd`
97+
# This will create a symlink from the webapps directory to the server directory with the custom namespace
98+
# (e.g. /dspace/webapps/server -> /dspace/webapps/repository#server)
9599
- |
96100
while (!</dev/tcp/dspacedb/543${INSTANCE}) > /dev/null 2>&1; do sleep 1; done;
97101
/dspace/bin/dspace database migrate force
@@ -111,7 +115,7 @@ services:
111115
ports:
112116
- published: 543${INSTANCE}
113117
target: 543${INSTANCE}
114-
host_ip: 127.0.0.1
118+
host_ip: ${HOST_IP:-127.0.0.1}
115119
stdin_open: true
116120
tty: true
117121
volumes:
@@ -132,7 +136,7 @@ services:
132136
ports:
133137
- published: 898${INSTANCE}
134138
target: 898${INSTANCE}
135-
host_ip: 127.0.0.1
139+
host_ip: ${HOST_IP:-127.0.0.1}
136140
stdin_open: true
137141
tty: true
138142
working_dir: /var/solr/data

docker/docker-compose.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ services:
1616
TZ: ${TIMEZONE:-Europe/Bratislava}
1717
DSPACE_UI_SSL: 'false'
1818
DSPACE_UI_HOST: dspace-angular
19+
# Use only `4000`, not the {UI_PORT} from the .env because in the container it is always `4000`
1920
DSPACE_UI_PORT: 4000
20-
DSPACE_UI_NAMESPACE: /
21+
DSPACE_UI_NAMESPACE: ${DSPACE_UI_NAMESPACE:-/}
2122
DSPACE_REST_SSL: ${DSPACE_SSL:-false}
2223
DSPACE_REST_HOST: ${DSPACE_HOST:-localhost}
23-
DSPACE_REST_PORT: ${DSPACE_REST_PORT}
24-
DSPACE_REST_NAMESPACE: /server
24+
DSPACE_REST_PORT: ${DSPACE_REST_PORT:-8080}
25+
DSPACE_REST_NAMESPACE: ${DSPACE_REST_NAMESPACE:-/server}
2526
image: ${DSPACE_UI_IMAGE:-ufal/dspace-angular:dspace-7_x}
2627
volumes:
2728
- ./config.prod.yml:/app/config/config.prod.yml
29+
# - ./aai.js:/app/dist/browser/aai.js
2830
# - ./dspace-ui.json:/app/docker/dspace-ui.json:rw
2931
build:
3032
context: ..
@@ -35,9 +37,9 @@ services:
3537
ports:
3638
- published: 400${INSTANCE}
3739
target: 4000
38-
host_ip: 127.0.0.1
40+
host_ip: ${HOST_IP:-127.0.0.1}
3941
- published: 987${INSTANCE}
4042
target: 987${INSTANCE}
41-
host_ip: 127.0.0.1
43+
host_ip: ${HOST_IP:-127.0.0.1}
4244
stdin_open: true
4345
tty: true

docker/matomo-settings.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Matomo settings for tracking statistics. This file could be mounted in the docker container.
3+
*/
4+
export const matomoSettings = {
5+
hostUrl: 'http://localhost:8135/',
6+
siteId: '1'
7+
};

src/aai/aai.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838

3939
if (redirectUrlFromLogin != null && redirectUrlFromLogin !== '') {
4040
// Redirect from the login page with retrieved redirect URL
41-
redirectUrl = window.location.origin + (namespace === '' ? namespace : '/' + namespace) + redirectUrlFromLogin;
41+
var baseUrl = window.location.origin + formatNamespace(namespace);
42+
var redirectPath = ensureLeadingSlash(redirectUrlFromLogin);
43+
44+
redirectUrl = baseUrl + redirectPath;
4245
}
4346

4447
// Encode the redirect URL
@@ -129,6 +132,20 @@
129132
var cookieString = name + '=' + value + ';expires=' + expirationDate.toUTCString() + ';path=/';
130133
document.cookie = cookieString;
131134
}
135+
136+
/**
137+
* Return empty string if namespace is empty, otherwise return namespace with leading slash.
138+
*/
139+
function formatNamespace(namespace) {
140+
return namespace === '' ? '' : ensureLeadingSlash(namespace);
141+
}
142+
143+
/**
144+
* Ensure that the path starts with a leading slash.
145+
*/
146+
function ensureLeadingSlash(path) {
147+
return path.startsWith('/') ? path : '/' + path;
148+
}
132149
}
133150

134151
if (!window.aai) {

src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h2 id="header" class="border-bottom pb-2">{{'clarin.license.agreement.title' |
1414
<div class="card bg-clarin-yellow border-clarin-yellow">
1515
<div class="card-body text-center">
1616
<a [href]="clarinLicense?.definition">{{clarinLicense?.name}}</a>
17-
<div *ngIf="clarinLicense?.name === LICENSE_NAME_SEZNAM && loadLicenseContentSeznam()"
17+
<div *ngIf="clarinLicense?.name === LICENSE_NAME_SEZNAM"
1818
class="pt-3"
1919
[innerHTML]="(licenseContentSeznam | async) | dsSafeHtml">
2020
</div>

src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.ts

+3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ export class ClarinLicenseAgreementPageComponent implements OnInit {
160160
// The user is signed in and has record in the userRegistration
161161
// Load userRegistration and userMetadata from userRegistration repository
162162
this.loadUserRegistrationAndUserMetadata();
163+
164+
// Load the Seznam dataset license content
165+
this.loadLicenseContentSeznam();
163166
}
164167

165168
/**

src/app/change-submitter-page/change-submitter-page.component.html

+25-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
<div class="container pt-2 pb-4" *ngVar="submitter | async as sub">
2-
<h3>{{'share.submission.page.title' | translate}}</h3>
3-
<span>{{'change.submitter.page.message' | translate}}</span>
4-
<span>{{getSubmitterName(sub)}}</span>
5-
<span> ({{sub?.email}})</span>
6-
<div class="pt-4">
7-
<button class="btn btn-info" (click)="changeSubmitter()">
2+
<div *ngVar="item | async as item" >
3+
<h3>{{'share.submission.page.title' | translate}}</h3>
4+
<div *ngIf="sub">
5+
<span>{{'change.submitter.page.message' | translate}}</span>
6+
<span class="font-weight-bold">{{getName(sub)}}</span>
7+
<span class="font-weight-bold"> ({{sub?.email}})</span>
8+
</div>
9+
<div *ngIf="sub == null">
10+
<span>{{'change.submitter.page.cannot.see.submitter.message' | translate}}</span>
11+
</div>
12+
13+
<div>
14+
<span>{{'change.submitter.page.items.handle.message' | translate}}</span>
15+
<span class="font-weight-bold">{{item?.handle}}</span>
16+
</div>
17+
<div>
18+
<span>{{'change.submitter.page.items.name.message' | translate}}</span>
19+
<span class="font-weight-bold">{{getName(item)}}</span>
20+
</div>
21+
22+
<div class="pt-4">
23+
<button class="btn btn-info" (click)="changeSubmitter()">
824
<span *ngIf="changeSubmitterSpinner"
925
class="spinner-border spinner-border-sm spinner-button mr-1" role="status" aria-hidden="true">
1026
</span>
11-
<span>{{'change.submitter.page.button.take-it' | translate}}</span>
12-
</button>
27+
<span>{{'change.submitter.page.button.take-it' | translate}}</span>
28+
</button>
29+
</div>
1330
</div>
1431
</div>
1532

src/app/change-submitter-page/change-submitter-page.component.ts

+48-12
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ import { isNullOrUndef } from 'chart.js/helpers';
1717
import { HALEndpointService } from '../core/shared/hal-endpoint.service';
1818
import { RemoteDataBuildService } from '../core/cache/builders/remote-data-build.service';
1919
import { RequestService } from '../core/data/request.service';
20-
import { PostRequest } from '../core/data/request.models';
20+
import { GetRequest } from '../core/data/request.models';
2121
import { RemoteData } from '../core/data/remote-data';
2222
import { NotificationsService } from '../shared/notifications/notifications.service';
2323
import { TranslateService } from '@ngx-translate/core';
24+
import { HttpHeaders } from '@angular/common/http';
25+
import { HttpOptions } from '../core/dspace-rest/dspace-rest.service';
26+
import { Item } from '../core/shared/item.model';
2427

2528
@Component({
2629
selector: 'ds-change-submitter-page',
@@ -34,11 +37,22 @@ export class ChangeSubmitterPageComponent implements OnInit {
3437
*/
3538
private shareToken = '';
3639

40+
/**
41+
* WorkspaceItem id from the url.
42+
* This id is used to get authorization rights to call REST API to change the submitter.
43+
*/
44+
private workspaceitemid = '';
45+
3746
/**
3847
* BehaviorSubject that contains the submitter of the WorkspaceItem.
3948
*/
4049
submitter: BehaviorSubject<EPerson> = new BehaviorSubject(null);
4150

51+
/**
52+
* BehaviorSubject that contains the Item.
53+
*/
54+
item: BehaviorSubject<Item> = new BehaviorSubject(null);
55+
4256
/**
4357
* BehaviorSubject that contains the WorkspaceItem.
4458
*/
@@ -61,6 +75,8 @@ export class ChangeSubmitterPageComponent implements OnInit {
6175
ngOnInit(): void {
6276
// Load `share_token` param value from the url
6377
this.shareToken = this.route.snapshot.queryParams.share_token;
78+
// Load `workspaceitem_id` param value from the url
79+
this.workspaceitemid = this.route.snapshot.queryParams.workspaceitemid;
6480
this.loadWorkspaceItemAndAssignSubmitter(this.shareToken);
6581
}
6682

@@ -70,17 +86,36 @@ export class ChangeSubmitterPageComponent implements OnInit {
7086
loadWorkspaceItemAndAssignSubmitter(shareToken: string) {
7187
this.findWorkspaceItemByShareToken(shareToken)?.subscribe((workspaceItem: WorkspaceItem) => {
7288
this.workspaceItem.next(workspaceItem);
89+
this.loadItemFromWorkspaceItem(workspaceItem);
7390
this.loadAndAssignSubmitter(workspaceItem);
7491
});
7592
}
7693

94+
/**
95+
* Load the Item from the WorkspaceItem and assign it to the item BehaviorSubject.
96+
*/
97+
loadItemFromWorkspaceItem(workspaceItem: WorkspaceItem) {
98+
if (workspaceItem.item instanceof Observable<Item>) {
99+
workspaceItem.item
100+
.pipe(getFirstSucceededRemoteDataPayload())
101+
.subscribe((item: Item) => {
102+
this.item.next(item);
103+
});
104+
}
105+
}
106+
77107
/**
78108
* Find a WorkspaceItem by its shareToken.
79109
*/
80110
findWorkspaceItemByShareToken(shareToken: string): Observable<WorkspaceItem> {
111+
let requestHeaders = new HttpHeaders();
112+
const requestOptions: HttpOptions = Object.create({});
113+
requestHeaders = requestHeaders.append('shareToken', shareToken);
114+
requestOptions.headers = requestHeaders;
115+
81116
return this.workspaceItemService.searchBy('shareToken', {
82117
searchParams: [Object.assign(new RequestParam('shareToken', shareToken))]
83-
}, false, false, followLink('submitter')).pipe(getFirstSucceededRemoteListPayload(),
118+
}, false, false, followLink('item'), followLink('submitter')).pipe(getFirstSucceededRemoteListPayload(),
84119
map((workspaceItems: WorkspaceItem[]) => workspaceItems?.[0]));
85120
}
86121

@@ -112,27 +147,28 @@ export class ChangeSubmitterPageComponent implements OnInit {
112147
}
113148

114149
/**
115-
* Get the name of the submitter using the DSONameService.
116-
* @param submitter
150+
* Get the name of the submitter or item using the DSONameService.
117151
*/
118-
getSubmitterName(submitter: EPerson): string {
119-
if (isNullOrUndef(submitter)) {
152+
getName(object: EPerson | Item) {
153+
if (isNullOrUndef(object)) {
120154
return '';
121155
}
122-
return this.dsoNameService.getName(submitter);
156+
return this.dsoNameService.getName(object);
123157
}
124158

125159
/**
126-
* Change the submitter of the WorkspaceItem using the shareToken. This will send a POST request to the backend when
160+
* Change the submitter of the WorkspaceItem using the shareToken. This will send a GET request to the backend when
127161
* the submitter of the Item is changed.
128162
*/
129163
changeSubmitter() {
130164
const requestId = this.requestService.generateRequestId();
131165

132-
const url = this.halService.getRootHref() + '/submission/setOwner?shareToken=' + this.shareToken;
133-
const postRequest = new PostRequest(requestId, url);
134-
// Send POST request
135-
this.requestService.send(postRequest);
166+
const url = this.halService.getRootHref() + '/submission/setOwner?shareToken=' + this.shareToken +
167+
'&workspaceitemid=' + this.workspaceitemid;
168+
169+
const getRequest = new GetRequest(requestId, url);
170+
// Send GET request
171+
this.requestService.send(getRequest);
136172
this.changeSubmitterSpinner = true;
137173
// Get response
138174
const response = this.rdbService.buildFromRequestUUID(requestId);

0 commit comments

Comments
 (0)