fixed issues after merging

This commit is contained in:
lotte
2019-05-27 15:09:51 +02:00
parent a0a0830e5f
commit 35f73708ef
7 changed files with 148 additions and 80 deletions

View File

@@ -35,95 +35,103 @@ describe('AuthResponseParsingService', () => {
}); });
describe('parse', () => { describe('parse', () => {
const validRequest = new AuthPostRequest( let validRequest;
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb', let validRequest2;
'https://rest.api/dspace-spring-rest/api/authn/login', let validResponse;
'password=test&user=myself@testshib.org'); let validResponse1;
let validResponse2;
beforeEach(() => {
const validRequest2 = new AuthGetRequest( validRequest = new AuthPostRequest(
'69f375b5-19f4-4453-8c7a-7dc5c55aafbb', '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
'https://rest.api/dspace-spring-rest/api/authn/status'); 'https://rest.api/dspace-spring-rest/api/authn/login',
'password=test&user=myself@testshib.org');
const validResponse = { validRequest2 = new AuthGetRequest(
payload: { '69f375b5-19f4-4453-8c7a-7dc5c55aafbb',
authenticated: true, 'https://rest.api/dspace-spring-rest/api/authn/status');
id: null,
okay: true,
token: {
accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
expires: 1526318322000
},
} as AuthStatus,
statusCode: 200,
statusText: '200'
};
const validResponse1 = { validResponse = {
payload: {}, payload: {
statusCode: 404, authenticated: true,
statusText: '404' id: null,
}; okay: true,
token: {
accessToken: 'eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI0ZGM3MGFiNS1jZDczLTQ5MmYtYjAwNy0zMTc5ZDJkOTI5NmIiLCJzZyI6W10sImV4cCI6MTUyNjMxODMyMn0.ASmvcbJFBfzhN7D5ncloWnaVZr5dLtgTuOgHaCKiimc',
expires: 1526318322000
},
} as AuthStatus,
statusCode: 200,
statusText: '200'
};
const validResponse2 = { validResponse1 = {
payload: { payload: {},
authenticated: true, statusCode: 404,
id: null, statusText: '404'
okay: true, };
type: 'status',
_embedded: { validResponse2 = {
eperson: { payload: {
canLogIn: true, authenticated: true,
email: 'myself@testshib.org', id: null,
groups: [], okay: true,
handle: null, type: 'status',
id: '4dc70ab5-cd73-492f-b007-3179d2d9296b', _embedded: {
lastActive: '2018-05-14T17:03:31.277+0000', eperson: {
metadata: { canLogIn: true,
'eperson.firstname': [ email: 'myself@testshib.org',
{ groups: [],
language: null, handle: null,
value: 'User' id: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
lastActive: '2018-05-14T17:03:31.277+0000',
metadata: {
'eperson.firstname': [
{
language: null,
value: 'User'
}
],
'eperson.lastname': [
{
language: null,
value: 'Test'
}
],
'eperson.language': [
{
language: null,
value: 'en'
}
]
},
name: 'User Test',
netid: 'myself@testshib.org',
requireCertificate: false,
selfRegistered: false,
type: 'eperson',
uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
_links: {
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
} }
],
'eperson.lastname': [
{
language: null,
value: 'Test'
}
],
'eperson.language': [
{
language: null,
value: 'en'
}
]
},
name: 'User Test',
netid: 'myself@testshib.org',
requireCertificate: false,
selfRegistered: false,
type: 'eperson',
uuid: '4dc70ab5-cd73-492f-b007-3179d2d9296b',
_links: {
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
} }
} }
},
_links: {
eperson: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
},
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
}
} }
}, },
_links: { statusCode: 200,
eperson: { statusText: '200'
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/eperson/epersons/4dc70ab5-cd73-492f-b007-3179d2d9296b'
},
self: {
href: 'https://hasselt-dspace.dev01.4science.it/dspace-spring-rest/api/authn/status'
}
}
},
statusCode: 200,
statusText: '200'
}; };
});
it('should return a AuthStatusResponse if data contains a valid AuthStatus object as payload', () => { it('should return a AuthStatusResponse if data contains a valid AuthStatus object as payload', () => {
const response = service.parse(validRequest, validResponse); const response = service.parse(validRequest, validResponse);

View File

@@ -107,6 +107,12 @@ import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing
import { ClaimedTaskDataService } from './tasks/claimed-task-data.service'; import { ClaimedTaskDataService } from './tasks/claimed-task-data.service';
import { PoolTaskDataService } from './tasks/pool-task-data.service'; import { PoolTaskDataService } from './tasks/pool-task-data.service';
import { TaskResponseParsingService } from './tasks/task-response-parsing.service'; import { TaskResponseParsingService } from './tasks/task-response-parsing.service';
import { NormalizedClaimedTask } from './tasks/models/normalized-claimed-task-object.model';
import { NormalizedTaskObject } from './tasks/models/normalized-task-object.model';
import { NormalizedPoolTask } from './tasks/models/normalized-pool-task-object.model';
import { NormalizedRelationship } from './cache/models/items/normalized-relationship.model';
import { NormalizedRelationshipType } from './cache/models/items/normalized-relationship-type.model';
import { NormalizedItemType } from './cache/models/items/normalized-item-type.model';
const IMPORTS = [ const IMPORTS = [
CommonModule, CommonModule,
@@ -227,7 +233,13 @@ export const normalizedModels =
NormalizedSubmissionSectionModel, NormalizedSubmissionSectionModel,
NormalizedAuthStatus, NormalizedAuthStatus,
NormalizedAuthorityValue, NormalizedAuthorityValue,
BrowseEntry BrowseEntry,
NormalizedClaimedTask,
NormalizedTaskObject,
NormalizedPoolTask,
NormalizedRelationship,
NormalizedRelationshipType,
NormalizedItemType
]; ];
@NgModule({ @NgModule({

View File

@@ -31,6 +31,20 @@ export class NormalizedClaimedTask extends NormalizedTaskObject<ClaimedTask> {
@autoserialize @autoserialize
action: string; action: string;
/**
* The eperson object for this task
*/
@autoserialize
@relationship(ResourceType.EPerson, false)
eperson: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/** /**
* The workflowitem object whom this task is related * The workflowitem object whom this task is related
*/ */

View File

@@ -31,6 +31,13 @@ export class NormalizedPoolTask extends NormalizedTaskObject<PoolTask> {
@autoserialize @autoserialize
action: string; action: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/** /**
* The workflowitem object whom this task is related * The workflowitem object whom this task is related
*/ */

View File

@@ -30,6 +30,20 @@ export abstract class NormalizedTaskObject<T extends DSpaceObject> extends Norma
@autoserialize @autoserialize
action: string; action: string;
/**
* The eperson object for this task
*/
@autoserialize
@relationship(ResourceType.EPerson, false)
eperson: string;
/**
* The group object for this task
*/
@autoserialize
@relationship(ResourceType.Group, false)
group: string;
/** /**
* The workflowitem object whom this task is related * The workflowitem object whom this task is related
*/ */

View File

@@ -5,6 +5,8 @@ import { DSpaceObject } from '../../shared/dspace-object.model';
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model'; import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
import { RemoteData } from '../../data/remote-data'; import { RemoteData } from '../../data/remote-data';
import { WorkflowItem } from '../../submission/models/workflowitem.model'; import { WorkflowItem } from '../../submission/models/workflowitem.model';
import { Group } from '../../eperson/models/group.model';
import { EPerson } from '../../eperson/models/eperson.model';
/** /**
* An abstract model class for a TaskObject. * An abstract model class for a TaskObject.
@@ -26,6 +28,16 @@ export class TaskObject extends DSpaceObject implements CacheableObject, Listabl
*/ */
action: string; action: string;
/**
* The group of this task
*/
eperson: Observable<RemoteData<EPerson>>;
/**
* The group of this task
*/
group: Observable<RemoteData<Group>>;
/** /**
* The workflowitem object whom this task is related * The workflowitem object whom this task is related
*/ */

View File

@@ -10,6 +10,7 @@ import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/cla
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model'; import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
import { RemoteData } from '../../../../core/data/remote-data'; import { RemoteData } from '../../../../core/data/remote-data';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type'; import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
let component: ClaimedMyDSpaceResultListElementComponent; let component: ClaimedMyDSpaceResultListElementComponent;
let fixture: ComponentFixture<ClaimedMyDSpaceResultListElementComponent>; let fixture: ComponentFixture<ClaimedMyDSpaceResultListElementComponent>;