[CST-5537] Rename rest services to data services

This commit is contained in:
Giuseppe Digilio
2022-11-17 11:45:59 +01:00
parent b8880091e6
commit 625409cbb0
16 changed files with 139 additions and 125 deletions

View File

@@ -13,7 +13,7 @@ import { PageInfo } from '../../../shared/page-info.model';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
import { QualityAssuranceEventRestService } from './quality-assurance-event-rest.service'; import { QualityAssuranceEventDataService } from './quality-assurance-event-data.service';
import { import {
qualityAssuranceEventObjectMissingPid, qualityAssuranceEventObjectMissingPid,
qualityAssuranceEventObjectMissingPid2, qualityAssuranceEventObjectMissingPid2,
@@ -23,9 +23,9 @@ import { ReplaceOperation } from 'fast-json-patch';
import { RequestEntry } from '../../../data/request-entry.model'; import { RequestEntry } from '../../../data/request-entry.model';
import { FindListOptions } from '../../../data/find-list-options.model'; import { FindListOptions } from '../../../data/find-list-options.model';
describe('QualityAssuranceEventRestService', () => { describe('QualityAssuranceEventDataService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: QualityAssuranceEventRestService; let service: QualityAssuranceEventDataService;
let serviceASAny: any; let serviceASAny: any;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let responseCacheEntryB: RequestEntry; let responseCacheEntryB: RequestEntry;
@@ -100,7 +100,7 @@ describe('QualityAssuranceEventRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new QualityAssuranceEventRestService( service = new QualityAssuranceEventDataService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,

View File

@@ -31,7 +31,7 @@ import { DeleteByIDRequest, PostRequest } from '../../../data/request.models';
*/ */
@Injectable() @Injectable()
@dataService(QUALITY_ASSURANCE_EVENT_OBJECT) @dataService(QUALITY_ASSURANCE_EVENT_OBJECT)
export class QualityAssuranceEventRestService extends IdentifiableDataService<QualityAssuranceEventObject> { export class QualityAssuranceEventDataService extends IdentifiableDataService<QualityAssuranceEventObject> {
private createData: CreateData<QualityAssuranceEventObject>; private createData: CreateData<QualityAssuranceEventObject>;
private searchData: SearchData<QualityAssuranceEventObject>; private searchData: SearchData<QualityAssuranceEventObject>;

View File

@@ -18,11 +18,11 @@ import {
qualityAssuranceSourceObjectMorePid qualityAssuranceSourceObjectMorePid
} from '../../../../shared/mocks/notifications.mock'; } from '../../../../shared/mocks/notifications.mock';
import { RequestEntry } from '../../../data/request-entry.model'; import { RequestEntry } from '../../../data/request-entry.model';
import { QualityAssuranceSourceRestService } from './quality-assurance-source-rest.service'; import { QualityAssuranceSourceDataService } from './quality-assurance-source-data.service';
describe('QualityAssuranceSourceRestService', () => { describe('QualityAssuranceSourceDataService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: QualityAssuranceSourceRestService; let service: QualityAssuranceSourceDataService;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let requestService: RequestService; let requestService: RequestService;
let rdbService: RemoteDataBuildService; let rdbService: RemoteDataBuildService;
@@ -72,7 +72,7 @@ describe('QualityAssuranceSourceRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new QualityAssuranceSourceRestService( service = new QualityAssuranceSourceDataService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,
@@ -80,15 +80,15 @@ describe('QualityAssuranceSourceRestService', () => {
notificationsService notificationsService
); );
spyOn((service as any), 'findListByHref').and.callThrough(); spyOn((service as any).findAllData, 'findAll').and.callThrough();
spyOn((service as any), 'findByHref').and.callThrough(); spyOn((service as any), 'findById').and.callThrough();
}); });
describe('getSources', () => { describe('getSources', () => {
it('should call findListByHref', (done) => { it('should call findAll', (done) => {
service.getSources().subscribe( service.getSources().subscribe(
(res) => { (res) => {
expect((service as any).findListByHref).toHaveBeenCalledWith(endpointURL, {}, true, true); expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
} }
); );
done(); done();
@@ -104,10 +104,10 @@ describe('QualityAssuranceSourceRestService', () => {
}); });
describe('getSource', () => { describe('getSource', () => {
it('should call findByHref', (done) => { it('should call findById', (done) => {
service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe( service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
(res) => { (res) => {
expect((service as any).findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceSourceObjectMorePid.id, true, true); expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceSourceObjectMorePid.id, true, true);
} }
); );
done(); done();

View File

@@ -1,8 +1,6 @@
/* eslint-disable max-classes-per-file */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { mergeMap, take } from 'rxjs/operators';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
@@ -17,13 +15,16 @@ import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.mo
import { PaginatedList } from '../../../data/paginated-list.model'; import { PaginatedList } from '../../../data/paginated-list.model';
import { FindListOptions } from '../../../data/find-list-options.model'; import { FindListOptions } from '../../../data/find-list-options.model';
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service'; import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
/** /**
* The service handling all Quality Assurance source REST requests. * The service handling all Quality Assurance source REST requests.
*/ */
@Injectable() @Injectable()
@dataService(QUALITY_ASSURANCE_SOURCE_OBJECT) @dataService(QUALITY_ASSURANCE_SOURCE_OBJECT)
export class QualityAssuranceSourceRestService extends IdentifiableDataService<QualityAssuranceSourceObject> { export class QualityAssuranceSourceDataService extends IdentifiableDataService<QualityAssuranceSourceObject> {
private findAllData: FindAllData<QualityAssuranceSourceObject>;
/** /**
* Initialize service variables * Initialize service variables
@@ -41,23 +42,24 @@ export class QualityAssuranceSourceRestService extends IdentifiableDataService<Q
protected notificationsService: NotificationsService protected notificationsService: NotificationsService
) { ) {
super('qualityassurancesources', requestService, rdbService, objectCache, halService); super('qualityassurancesources', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
} }
/** /**
* Return the list of Quality Assurance source. * Return the list of Quality Assurance source.
* *
* @param options * @param options Find list options object.
* Find list options object. * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* @param linksToFollow * no valid cached version. Defaults to true
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * @param reRequestOnStale Whether or not the request should automatically be re-
* requested after the response becomes stale
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
*
* @return Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> * @return Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>>
* The list of Quality Assurance source. * The list of Quality Assurance source.
*/ */
public getSources(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> { public getSources(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> {
return this.getBrowseEndpoint(options).pipe( return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
take(1),
mergeMap((href: string) => this.findListByHref(href, options, true, true, ...linksToFollow)),
);
} }
/** /**
@@ -70,18 +72,16 @@ export class QualityAssuranceSourceRestService extends IdentifiableDataService<Q
/** /**
* Return a single Quality Assurance source. * Return a single Quality Assurance source.
* *
* @param id * @param id The Quality Assurance source id
* The Quality Assurance source id * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* @param linksToFollow * no valid cached version. Defaults to true
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * @param reRequestOnStale Whether or not the request should automatically be re-
* @return Observable<RemoteData<QualityAssuranceSourceObject>> * requested after the response becomes stale
* The Quality Assurance source. * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
*
* @return Observable<RemoteData<QualityAssuranceSourceObject>> The Quality Assurance source.
*/ */
public getSource(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> { public getSource(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> {
const options = {}; return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
return this.getBrowseEndpoint(options, 'qualityassurancesources').pipe(
take(1),
mergeMap((href: string) => this.findByHref(href + '/' + id, true, true, ...linksToFollow))
);
} }
} }

View File

@@ -13,16 +13,16 @@ import { PageInfo } from '../../../shared/page-info.model';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
import { QualityAssuranceTopicRestService } from './quality-assurance-topic-rest.service'; import { QualityAssuranceTopicDataService } from './quality-assurance-topic-data.service';
import { import {
qualityAssuranceTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
qualityAssuranceTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../../../../shared/mocks/notifications.mock'; } from '../../../../shared/mocks/notifications.mock';
import { RequestEntry } from '../../../data/request-entry.model'; import { RequestEntry } from '../../../data/request-entry.model';
describe('QualityAssuranceTopicRestService', () => { describe('QualityAssuranceTopicDataService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: QualityAssuranceTopicRestService; let service: QualityAssuranceTopicDataService;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let requestService: RequestService; let requestService: RequestService;
let rdbService: RemoteDataBuildService; let rdbService: RemoteDataBuildService;
@@ -72,7 +72,7 @@ describe('QualityAssuranceTopicRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new QualityAssuranceTopicRestService( service = new QualityAssuranceTopicDataService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,
@@ -80,15 +80,15 @@ describe('QualityAssuranceTopicRestService', () => {
notificationsService notificationsService
); );
spyOn((service as any), 'findListByHref').and.callThrough(); spyOn((service as any).findAllData, 'findAll').and.callThrough();
spyOn((service as any), 'findByHref').and.callThrough(); spyOn((service as any), 'findById').and.callThrough();
}); });
describe('getTopics', () => { describe('getTopics', () => {
it('should call findListByHref', (done) => { it('should call findListByHref', (done) => {
service.getTopics().subscribe( service.getTopics().subscribe(
(res) => { (res) => {
expect((service as any).findListByHref).toHaveBeenCalledWith(endpointURL, {}, true, true); expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
} }
); );
done(); done();
@@ -107,7 +107,7 @@ describe('QualityAssuranceTopicRestService', () => {
it('should call findByHref', (done) => { it('should call findByHref', (done) => {
service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe( service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
(res) => { (res) => {
expect((service as any).findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceTopicObjectMorePid.id, true, true); expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceTopicObjectMorePid.id, true, true);
} }
); );
done(); done();

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { mergeMap, take } from 'rxjs/operators';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
@@ -16,13 +15,16 @@ import { FindListOptions } from '../../../data/find-list-options.model';
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service'; import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
import { dataService } from '../../../data/base/data-service.decorator'; import { dataService } from '../../../data/base/data-service.decorator';
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type'; import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
/** /**
* The service handling all Quality Assurance topic REST requests. * The service handling all Quality Assurance topic REST requests.
*/ */
@Injectable() @Injectable()
@dataService(QUALITY_ASSURANCE_TOPIC_OBJECT) @dataService(QUALITY_ASSURANCE_TOPIC_OBJECT)
export class QualityAssuranceTopicRestService extends IdentifiableDataService<QualityAssuranceTopicObject> { export class QualityAssuranceTopicDataService extends IdentifiableDataService<QualityAssuranceTopicObject> {
private findAllData: FindAllData<QualityAssuranceTopicObject>;
/** /**
* Initialize service variables * Initialize service variables
@@ -40,23 +42,24 @@ export class QualityAssuranceTopicRestService extends IdentifiableDataService<Qu
protected notificationsService: NotificationsService protected notificationsService: NotificationsService
) { ) {
super('qualityassurancetopics', requestService, rdbService, objectCache, halService); super('qualityassurancetopics', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
} }
/** /**
* Return the list of Quality Assurance topics. * Return the list of Quality Assurance topics.
* *
* @param options * @param options Find list options object.
* Find list options object. * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* @param linksToFollow * no valid cached version. Defaults to true
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * @param reRequestOnStale Whether or not the request should automatically be re-
* requested after the response becomes stale
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
*
* @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> * @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>
* The list of Quality Assurance topics. * The list of Quality Assurance topics.
*/ */
public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> { public getTopics(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
return this.getBrowseEndpoint(options).pipe( return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
take(1),
mergeMap((href: string) => this.findListByHref(href, options, true, true, ...linksToFollow)),
);
} }
/** /**
@@ -69,18 +72,17 @@ export class QualityAssuranceTopicRestService extends IdentifiableDataService<Qu
/** /**
* Return a single Quality Assurance topic. * Return a single Quality Assurance topic.
* *
* @param id * @param id The Quality Assurance topic id
* The Quality Assurance topic id * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* @param linksToFollow * no valid cached version. Defaults to true
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * @param reRequestOnStale Whether or not the request should automatically be re-
* requested after the response becomes stale
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
*
* @return Observable<RemoteData<QualityAssuranceTopicObject>> * @return Observable<RemoteData<QualityAssuranceTopicObject>>
* The Quality Assurance topic. * The Quality Assurance topic.
*/ */
public getTopic(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> { public getTopic(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> {
const options = {}; return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
return this.getBrowseEndpoint(options).pipe(
take(1),
mergeMap((href: string) => this.findByHref(href + '/' + id, true, true, ...linksToFollow))
);
} }
} }

View File

@@ -1,9 +1,17 @@
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { ResourceType } from '../../core/shared/resource-type'; import { ResourceType } from '../../core/shared/resource-type';
import { QualityAssuranceTopicObject } from '../../core/suggestion-notifications/qa/models/quality-assurance-topic.model'; import {
import { QualityAssuranceEventObject } from '../../core/suggestion-notifications/qa/models/quality-assurance-event.model'; QualityAssuranceTopicObject
import { QualityAssuranceTopicRestService } from '../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service'; } from '../../core/suggestion-notifications/qa/models/quality-assurance-topic.model';
import { QualityAssuranceEventRestService } from '../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service'; import {
QualityAssuranceEventObject
} from '../../core/suggestion-notifications/qa/models/quality-assurance-event.model';
import {
QualityAssuranceTopicDataService
} from '../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
import {
QualityAssuranceEventDataService
} from '../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
import { import {
@@ -12,7 +20,9 @@ import {
createSuccessfulRemoteDataObject$ createSuccessfulRemoteDataObject$
} from '../remote-data.utils'; } from '../remote-data.utils';
import { SearchResult } from '../search/models/search-result.model'; import { SearchResult } from '../search/models/search-result.model';
import { QualityAssuranceSourceObject } from '../../core/suggestion-notifications/qa/models/quality-assurance-source.model'; import {
QualityAssuranceSourceObject
} from '../../core/suggestion-notifications/qa/models/quality-assurance-source.model';
// REST Mock --------------------------------------------------------------------- // REST Mock ---------------------------------------------------------------------
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@@ -1814,30 +1824,30 @@ export function getMockNotificationsStateService(): any {
} }
/** /**
* Mock for [[QualityAssuranceSourceRestService]] * Mock for [[QualityAssuranceSourceDataService]]
*/ */
export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicRestService { export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicDataService {
return jasmine.createSpyObj('QualityAssuranceSourceRestService', { return jasmine.createSpyObj('QualityAssuranceSourceDataService', {
getSources: jasmine.createSpy('getSources'), getSources: jasmine.createSpy('getSources'),
getSource: jasmine.createSpy('getSource'), getSource: jasmine.createSpy('getSource'),
}); });
} }
/** /**
* Mock for [[QualityAssuranceTopicRestService]] * Mock for [[QualityAssuranceTopicDataService]]
*/ */
export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicRestService { export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicDataService {
return jasmine.createSpyObj('QualityAssuranceTopicRestService', { return jasmine.createSpyObj('QualityAssuranceTopicDataService', {
getTopics: jasmine.createSpy('getTopics'), getTopics: jasmine.createSpy('getTopics'),
getTopic: jasmine.createSpy('getTopic'), getTopic: jasmine.createSpy('getTopic'),
}); });
} }
/** /**
* Mock for [[QualityAssuranceEventRestService]] * Mock for [[QualityAssuranceEventDataService]]
*/ */
export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventRestService { export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventDataService {
return jasmine.createSpyObj('QualityAssuranceEventRestService', { return jasmine.createSpyObj('QualityAssuranceEventDataService', {
getEventsByTopic: jasmine.createSpy('getEventsByTopic'), getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
getEvent: jasmine.createSpy('getEvent'), getEvent: jasmine.createSpy('getEvent'),
patchEvent: jasmine.createSpy('patchEvent'), patchEvent: jasmine.createSpy('patchEvent'),
@@ -1848,7 +1858,7 @@ export function getMockQualityAssuranceEventRestService(): QualityAssuranceEvent
} }
/** /**
* Mock for [[QualityAssuranceEventRestService]] * Mock for [[QualityAssuranceEventDataService]]
*/ */
export function getMockSuggestionsService(): any { export function getMockSuggestionsService(): any {
return jasmine.createSpyObj('SuggestionsService', { return jasmine.createSpyObj('SuggestionsService', {

View File

@@ -6,8 +6,8 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { import {
QualityAssuranceEventRestService QualityAssuranceEventDataService
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service'; } from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
import { QualityAssuranceEventsComponent } from './quality-assurance-events.component'; import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
import { import {
getMockQualityAssuranceEventRestService, getMockQualityAssuranceEventRestService,
@@ -113,7 +113,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
], ],
providers: [ providers: [
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
{ provide: QualityAssuranceEventRestService, useValue: qualityAssuranceEventRestServiceStub }, { provide: QualityAssuranceEventDataService, useValue: qualityAssuranceEventRestServiceStub },
{ provide: NgbModal, useValue: modalStub }, { provide: NgbModal, useValue: modalStub },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: NotificationsService, useValue: new NotificationsServiceStub() },
{ provide: TranslateService, useValue: getMockTranslateService() }, { provide: TranslateService, useValue: getMockTranslateService() },

View File

@@ -14,8 +14,8 @@ import {
QualityAssuranceEventObject QualityAssuranceEventObject
} from '../../../core/suggestion-notifications/qa/models/quality-assurance-event.model'; } from '../../../core/suggestion-notifications/qa/models/quality-assurance-event.model';
import { import {
QualityAssuranceEventRestService QualityAssuranceEventDataService
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service'; } from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { Metadata } from '../../../core/shared/metadata.utils'; import { Metadata } from '../../../core/shared/metadata.utils';
import { followLink } from '../../../shared/utils/follow-link-config.model'; import { followLink } from '../../../shared/utils/follow-link-config.model';
@@ -110,7 +110,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
* @param {ActivatedRoute} activatedRoute * @param {ActivatedRoute} activatedRoute
* @param {NgbModal} modalService * @param {NgbModal} modalService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {QualityAssuranceEventRestService} qualityAssuranceEventRestService * @param {QualityAssuranceEventDataService} qualityAssuranceEventRestService
* @param {PaginationService} paginationService * @param {PaginationService} paginationService
* @param {TranslateService} translateService * @param {TranslateService} translateService
*/ */
@@ -118,7 +118,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private modalService: NgbModal, private modalService: NgbModal,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private qualityAssuranceEventRestService: QualityAssuranceEventRestService, private qualityAssuranceEventRestService: QualityAssuranceEventDataService,
private paginationService: PaginationService, private paginationService: PaginationService,
private translateService: TranslateService private translateService: TranslateService
) { ) {

View File

@@ -19,8 +19,8 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
import { QualityAssuranceSourceService } from './quality-assurance-source.service'; import { QualityAssuranceSourceService } from './quality-assurance-source.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { import {
QualityAssuranceSourceRestService QualityAssuranceSourceDataService
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service'; } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
/** /**
* Provides effect methods for the Quality Assurance source actions. * Provides effect methods for the Quality Assurance source actions.
@@ -79,7 +79,7 @@ export class QualityAssuranceSourceEffects {
* @param {TranslateService} translate * @param {TranslateService} translate
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService * @param {QualityAssuranceSourceService} qualityAssuranceSourceService
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceDataService * @param {QualityAssuranceSourceDataService} qualityAssuranceSourceDataService
*/ */
constructor( constructor(
private actions$: Actions, private actions$: Actions,
@@ -87,7 +87,7 @@ export class QualityAssuranceSourceEffects {
private translate: TranslateService, private translate: TranslateService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private qualityAssuranceSourceService: QualityAssuranceSourceService, private qualityAssuranceSourceService: QualityAssuranceSourceService,
private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService
) { ) {
} }
} }

View File

@@ -12,13 +12,13 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { import {
QualityAssuranceSourceRestService QualityAssuranceSourceDataService
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service'; } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
import { FindListOptions } from '../../../core/data/find-list-options.model'; import { FindListOptions } from '../../../core/data/find-list-options.model';
describe('QualityAssuranceSourceService', () => { describe('QualityAssuranceSourceService', () => {
let service: QualityAssuranceSourceService; let service: QualityAssuranceSourceService;
let restService: QualityAssuranceSourceRestService; let restService: QualityAssuranceSourceDataService;
let serviceAsAny: any; let serviceAsAny: any;
let restServiceAsAny: any; let restServiceAsAny: any;
@@ -32,14 +32,14 @@ describe('QualityAssuranceSourceService', () => {
beforeEach(async () => { beforeEach(async () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{ provide: QualityAssuranceSourceRestService, useClass: getMockQualityAssuranceSourceRestService }, { provide: QualityAssuranceSourceDataService, useClass: getMockQualityAssuranceSourceRestService },
{ provide: QualityAssuranceSourceService, useValue: service } { provide: QualityAssuranceSourceService, useValue: service }
] ]
}).compileComponents(); }).compileComponents();
}); });
beforeEach(() => { beforeEach(() => {
restService = TestBed.get(QualityAssuranceSourceRestService); restService = TestBed.inject(QualityAssuranceSourceDataService);
restServiceAsAny = restService; restServiceAsAny = restService;
restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD)); restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD));
service = new QualityAssuranceSourceService(restService); service = new QualityAssuranceSourceService(restService);

View File

@@ -4,8 +4,8 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { import {
QualityAssuranceSourceRestService QualityAssuranceSourceDataService
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service'; } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { RemoteData } from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
@@ -23,10 +23,10 @@ export class QualityAssuranceSourceService {
/** /**
* Initialize the service variables. * Initialize the service variables.
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceRestService * @param {QualityAssuranceSourceDataService} qualityAssuranceSourceRestService
*/ */
constructor( constructor(
private qualityAssuranceSourceRestService: QualityAssuranceSourceRestService private qualityAssuranceSourceRestService: QualityAssuranceSourceDataService
) { ) {
} }

View File

@@ -19,8 +19,8 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { import {
QualityAssuranceTopicRestService QualityAssuranceTopicDataService
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service'; } from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
/** /**
* Provides effect methods for the Quality Assurance topics actions. * Provides effect methods for the Quality Assurance topics actions.
@@ -79,7 +79,7 @@ export class QualityAssuranceTopicsEffects {
* @param {TranslateService} translate * @param {TranslateService} translate
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {QualityAssuranceTopicsService} qualityAssuranceTopicService * @param {QualityAssuranceTopicsService} qualityAssuranceTopicService
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicDataService * @param {QualityAssuranceTopicDataService} qualityAssuranceTopicDataService
*/ */
constructor( constructor(
private actions$: Actions, private actions$: Actions,
@@ -87,6 +87,6 @@ export class QualityAssuranceTopicsEffects {
private translate: TranslateService, private translate: TranslateService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private qualityAssuranceTopicService: QualityAssuranceTopicsService, private qualityAssuranceTopicService: QualityAssuranceTopicsService,
private qualityAssuranceTopicDataService: QualityAssuranceTopicRestService private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService
) { } ) { }
} }

View File

@@ -2,7 +2,9 @@ import { TestBed } from '@angular/core/testing';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { QualityAssuranceTopicRestService } from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service'; import {
QualityAssuranceTopicDataService
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
import { PageInfo } from '../../../core/shared/page-info.model'; import { PageInfo } from '../../../core/shared/page-info.model';
import { import {
getMockQualityAssuranceTopicRestService, getMockQualityAssuranceTopicRestService,
@@ -13,11 +15,11 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { RequestParam } from '../../../core/cache/models/request-param.model'; import { RequestParam } from '../../../core/cache/models/request-param.model';
import {FindListOptions} from '../../../core/data/find-list-options.model'; import { FindListOptions } from '../../../core/data/find-list-options.model';
describe('QualityAssuranceTopicsService', () => { describe('QualityAssuranceTopicsService', () => {
let service: QualityAssuranceTopicsService; let service: QualityAssuranceTopicsService;
let restService: QualityAssuranceTopicRestService; let restService: QualityAssuranceTopicDataService;
let serviceAsAny: any; let serviceAsAny: any;
let restServiceAsAny: any; let restServiceAsAny: any;
@@ -31,14 +33,14 @@ describe('QualityAssuranceTopicsService', () => {
beforeEach(async () => { beforeEach(async () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{ provide: QualityAssuranceTopicRestService, useClass: getMockQualityAssuranceTopicRestService }, { provide: QualityAssuranceTopicDataService, useClass: getMockQualityAssuranceTopicRestService },
{ provide: QualityAssuranceTopicsService, useValue: service } { provide: QualityAssuranceTopicsService, useValue: service }
] ]
}).compileComponents(); }).compileComponents();
}); });
beforeEach(() => { beforeEach(() => {
restService = TestBed.get(QualityAssuranceTopicRestService); restService = TestBed.inject(QualityAssuranceTopicDataService);
restServiceAsAny = restService; restServiceAsAny = restService;
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD)); restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
service = new QualityAssuranceTopicsService(restService); service = new QualityAssuranceTopicsService(restService);

View File

@@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { import {
QualityAssuranceTopicRestService QualityAssuranceTopicDataService
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service'; } from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { RemoteData } from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
@@ -22,10 +22,10 @@ export class QualityAssuranceTopicsService {
/** /**
* Initialize the service variables. * Initialize the service variables.
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicRestService * @param {QualityAssuranceTopicDataService} qualityAssuranceTopicRestService
*/ */
constructor( constructor(
private qualityAssuranceTopicRestService: QualityAssuranceTopicRestService private qualityAssuranceTopicRestService: QualityAssuranceTopicDataService
) { } ) { }
/** /**

View File

@@ -13,19 +13,19 @@ import { suggestionNotificationsReducers, SuggestionNotificationsState } from '.
import { suggestionNotificationsEffects } from './suggestion-notifications-effects'; import { suggestionNotificationsEffects } from './suggestion-notifications-effects';
import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service'; import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
import { import {
QualityAssuranceTopicRestService QualityAssuranceTopicDataService
} from '../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service'; } from '../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
import { import {
QualityAssuranceEventRestService QualityAssuranceEventDataService
} from '../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service'; } from '../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component'; import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { SearchModule } from '../shared/search/search.module'; import { SearchModule } from '../shared/search/search.module';
import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component'; import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component';
import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service'; import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service';
import { import {
QualityAssuranceSourceRestService QualityAssuranceSourceDataService
} from '../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service'; } from '../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
const MODULES = [ const MODULES = [
CommonModule, CommonModule,
@@ -53,9 +53,9 @@ const PROVIDERS = [
SuggestionNotificationsStateService, SuggestionNotificationsStateService,
QualityAssuranceTopicsService, QualityAssuranceTopicsService,
QualityAssuranceSourceService, QualityAssuranceSourceService,
QualityAssuranceTopicRestService, QualityAssuranceTopicDataService,
QualityAssuranceSourceRestService, QualityAssuranceSourceDataService,
QualityAssuranceEventRestService QualityAssuranceEventDataService
]; ];
@NgModule({ @NgModule({