mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-5537] Rename rest services to data services
This commit is contained in:
@@ -13,7 +13,7 @@ import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceEventRestService } from './quality-assurance-event-rest.service';
|
||||
import { QualityAssuranceEventDataService } from './quality-assurance-event-data.service';
|
||||
import {
|
||||
qualityAssuranceEventObjectMissingPid,
|
||||
qualityAssuranceEventObjectMissingPid2,
|
||||
@@ -23,9 +23,9 @@ import { ReplaceOperation } from 'fast-json-patch';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
|
||||
describe('QualityAssuranceEventRestService', () => {
|
||||
describe('QualityAssuranceEventDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: QualityAssuranceEventRestService;
|
||||
let service: QualityAssuranceEventDataService;
|
||||
let serviceASAny: any;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let responseCacheEntryB: RequestEntry;
|
||||
@@ -100,7 +100,7 @@ describe('QualityAssuranceEventRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceEventRestService(
|
||||
service = new QualityAssuranceEventDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
@@ -31,7 +31,7 @@ import { DeleteByIDRequest, PostRequest } from '../../../data/request.models';
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_EVENT_OBJECT)
|
||||
export class QualityAssuranceEventRestService extends IdentifiableDataService<QualityAssuranceEventObject> {
|
||||
export class QualityAssuranceEventDataService extends IdentifiableDataService<QualityAssuranceEventObject> {
|
||||
|
||||
private createData: CreateData<QualityAssuranceEventObject>;
|
||||
private searchData: SearchData<QualityAssuranceEventObject>;
|
@@ -18,11 +18,11 @@ import {
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
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 service: QualityAssuranceSourceRestService;
|
||||
let service: QualityAssuranceSourceDataService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
@@ -72,7 +72,7 @@ describe('QualityAssuranceSourceRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceSourceRestService(
|
||||
service = new QualityAssuranceSourceDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
@@ -80,15 +80,15 @@ describe('QualityAssuranceSourceRestService', () => {
|
||||
notificationsService
|
||||
);
|
||||
|
||||
spyOn((service as any), 'findListByHref').and.callThrough();
|
||||
spyOn((service as any), 'findByHref').and.callThrough();
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
spyOn((service as any), 'findById').and.callThrough();
|
||||
});
|
||||
|
||||
describe('getSources', () => {
|
||||
it('should call findListByHref', (done) => {
|
||||
it('should call findAll', (done) => {
|
||||
service.getSources().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findListByHref).toHaveBeenCalledWith(endpointURL, {}, true, true);
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
@@ -104,10 +104,10 @@ describe('QualityAssuranceSourceRestService', () => {
|
||||
});
|
||||
|
||||
describe('getSource', () => {
|
||||
it('should call findByHref', (done) => {
|
||||
it('should call findById', (done) => {
|
||||
service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceSourceObjectMorePid.id, true, true);
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceSourceObjectMorePid.id, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
@@ -1,8 +1,6 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.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 { FindListOptions } from '../../../data/find-list-options.model';
|
||||
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.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_SOURCE_OBJECT)
|
||||
export class QualityAssuranceSourceRestService extends IdentifiableDataService<QualityAssuranceSourceObject> {
|
||||
export class QualityAssuranceSourceDataService extends IdentifiableDataService<QualityAssuranceSourceObject> {
|
||||
|
||||
private findAllData: FindAllData<QualityAssuranceSourceObject>;
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
@@ -41,23 +42,24 @@ export class QualityAssuranceSourceRestService extends IdentifiableDataService<Q
|
||||
protected notificationsService: NotificationsService
|
||||
) {
|
||||
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.
|
||||
*
|
||||
* @param options
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @param options Find list options object.
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @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>>>
|
||||
* The list of Quality Assurance source.
|
||||
*/
|
||||
public getSources(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> {
|
||||
return this.getBrowseEndpoint(options).pipe(
|
||||
take(1),
|
||||
mergeMap((href: string) => this.findListByHref(href, options, true, true, ...linksToFollow)),
|
||||
);
|
||||
public getSources(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,18 +72,16 @@ export class QualityAssuranceSourceRestService extends IdentifiableDataService<Q
|
||||
/**
|
||||
* Return a single Quality Assurance source.
|
||||
*
|
||||
* @param id
|
||||
* The Quality Assurance source id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<QualityAssuranceSourceObject>>
|
||||
* The Quality Assurance source.
|
||||
* @param id The Quality Assurance source id
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @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<QualityAssuranceSourceObject>> The Quality Assurance source.
|
||||
*/
|
||||
public getSource(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> {
|
||||
const options = {};
|
||||
return this.getBrowseEndpoint(options, 'qualityassurancesources').pipe(
|
||||
take(1),
|
||||
mergeMap((href: string) => this.findByHref(href + '/' + id, true, true, ...linksToFollow))
|
||||
);
|
||||
public getSource(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> {
|
||||
return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
}
|
@@ -13,16 +13,16 @@ import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceTopicRestService } from './quality-assurance-topic-rest.service';
|
||||
import { QualityAssuranceTopicDataService } from './quality-assurance-topic-data.service';
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
|
||||
describe('QualityAssuranceTopicRestService', () => {
|
||||
describe('QualityAssuranceTopicDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: QualityAssuranceTopicRestService;
|
||||
let service: QualityAssuranceTopicDataService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
@@ -72,7 +72,7 @@ describe('QualityAssuranceTopicRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new QualityAssuranceTopicRestService(
|
||||
service = new QualityAssuranceTopicDataService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
@@ -80,15 +80,15 @@ describe('QualityAssuranceTopicRestService', () => {
|
||||
notificationsService
|
||||
);
|
||||
|
||||
spyOn((service as any), 'findListByHref').and.callThrough();
|
||||
spyOn((service as any), 'findByHref').and.callThrough();
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
spyOn((service as any), 'findById').and.callThrough();
|
||||
});
|
||||
|
||||
describe('getTopics', () => {
|
||||
it('should call findListByHref', (done) => {
|
||||
service.getTopics().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findListByHref).toHaveBeenCalledWith(endpointURL, {}, true, true);
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
||||
@@ -107,7 +107,7 @@ describe('QualityAssuranceTopicRestService', () => {
|
||||
it('should call findByHref', (done) => {
|
||||
service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceTopicObjectMorePid.id, true, true);
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceTopicObjectMorePid.id, true, true);
|
||||
}
|
||||
);
|
||||
done();
|
@@ -1,7 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.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 { dataService } from '../../../data/base/data-service.decorator';
|
||||
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.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(QUALITY_ASSURANCE_TOPIC_OBJECT)
|
||||
export class QualityAssuranceTopicRestService extends IdentifiableDataService<QualityAssuranceTopicObject> {
|
||||
export class QualityAssuranceTopicDataService extends IdentifiableDataService<QualityAssuranceTopicObject> {
|
||||
|
||||
private findAllData: FindAllData<QualityAssuranceTopicObject>;
|
||||
|
||||
/**
|
||||
* Initialize service variables
|
||||
@@ -40,23 +42,24 @@ export class QualityAssuranceTopicRestService extends IdentifiableDataService<Qu
|
||||
protected notificationsService: NotificationsService
|
||||
) {
|
||||
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.
|
||||
*
|
||||
* @param options
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @param options Find list options object.
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @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>>>
|
||||
* The list of Quality Assurance topics.
|
||||
*/
|
||||
public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
|
||||
return this.getBrowseEndpoint(options).pipe(
|
||||
take(1),
|
||||
mergeMap((href: string) => this.findListByHref(href, options, true, true, ...linksToFollow)),
|
||||
);
|
||||
public getTopics(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
|
||||
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,18 +72,17 @@ export class QualityAssuranceTopicRestService extends IdentifiableDataService<Qu
|
||||
/**
|
||||
* Return a single Quality Assurance topic.
|
||||
*
|
||||
* @param id
|
||||
* The Quality Assurance topic id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @param id The Quality Assurance topic id
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @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>>
|
||||
* The Quality Assurance topic.
|
||||
*/
|
||||
public getTopic(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> {
|
||||
const options = {};
|
||||
return this.getBrowseEndpoint(options).pipe(
|
||||
take(1),
|
||||
mergeMap((href: string) => this.findByHref(href + '/' + id, true, true, ...linksToFollow))
|
||||
);
|
||||
public getTopic(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> {
|
||||
return this.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
}
|
@@ -1,9 +1,17 @@
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { ResourceType } from '../../core/shared/resource-type';
|
||||
import { QualityAssuranceTopicObject } from '../../core/suggestion-notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceEventObject } from '../../core/suggestion-notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceTopicRestService } from '../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
import { QualityAssuranceEventRestService } from '../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service';
|
||||
import {
|
||||
QualityAssuranceTopicObject
|
||||
} from '../../core/suggestion-notifications/qa/models/quality-assurance-topic.model';
|
||||
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 { Item } from '../../core/shared/item.model';
|
||||
import {
|
||||
@@ -12,7 +20,9 @@ import {
|
||||
createSuccessfulRemoteDataObject$
|
||||
} from '../remote-data.utils';
|
||||
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 ---------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -1814,30 +1824,30 @@ export function getMockNotificationsStateService(): any {
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[QualityAssuranceSourceRestService]]
|
||||
* Mock for [[QualityAssuranceSourceDataService]]
|
||||
*/
|
||||
export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceSourceRestService', {
|
||||
export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicDataService {
|
||||
return jasmine.createSpyObj('QualityAssuranceSourceDataService', {
|
||||
getSources: jasmine.createSpy('getSources'),
|
||||
getSource: jasmine.createSpy('getSource'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[QualityAssuranceTopicRestService]]
|
||||
* Mock for [[QualityAssuranceTopicDataService]]
|
||||
*/
|
||||
export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceTopicRestService', {
|
||||
export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicDataService {
|
||||
return jasmine.createSpyObj('QualityAssuranceTopicDataService', {
|
||||
getTopics: jasmine.createSpy('getTopics'),
|
||||
getTopic: jasmine.createSpy('getTopic'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[QualityAssuranceEventRestService]]
|
||||
* Mock for [[QualityAssuranceEventDataService]]
|
||||
*/
|
||||
export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceEventRestService', {
|
||||
export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventDataService {
|
||||
return jasmine.createSpyObj('QualityAssuranceEventDataService', {
|
||||
getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
|
||||
getEvent: jasmine.createSpy('getEvent'),
|
||||
patchEvent: jasmine.createSpy('patchEvent'),
|
||||
@@ -1848,7 +1858,7 @@ export function getMockQualityAssuranceEventRestService(): QualityAssuranceEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[QualityAssuranceEventRestService]]
|
||||
* Mock for [[QualityAssuranceEventDataService]]
|
||||
*/
|
||||
export function getMockSuggestionsService(): any {
|
||||
return jasmine.createSpyObj('SuggestionsService', {
|
||||
|
@@ -6,8 +6,8 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
QualityAssuranceEventRestService
|
||||
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service';
|
||||
QualityAssuranceEventDataService
|
||||
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
|
||||
import {
|
||||
getMockQualityAssuranceEventRestService,
|
||||
@@ -113,7 +113,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
|
||||
{ provide: QualityAssuranceEventRestService, useValue: qualityAssuranceEventRestServiceStub },
|
||||
{ provide: QualityAssuranceEventDataService, useValue: qualityAssuranceEventRestServiceStub },
|
||||
{ provide: NgbModal, useValue: modalStub },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
{ provide: TranslateService, useValue: getMockTranslateService() },
|
||||
|
@@ -14,8 +14,8 @@ import {
|
||||
QualityAssuranceEventObject
|
||||
} from '../../../core/suggestion-notifications/qa/models/quality-assurance-event.model';
|
||||
import {
|
||||
QualityAssuranceEventRestService
|
||||
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service';
|
||||
QualityAssuranceEventDataService
|
||||
} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
@@ -110,7 +110,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
* @param {ActivatedRoute} activatedRoute
|
||||
* @param {NgbModal} modalService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {QualityAssuranceEventRestService} qualityAssuranceEventRestService
|
||||
* @param {QualityAssuranceEventDataService} qualityAssuranceEventRestService
|
||||
* @param {PaginationService} paginationService
|
||||
* @param {TranslateService} translateService
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private modalService: NgbModal,
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceEventRestService: QualityAssuranceEventRestService,
|
||||
private qualityAssuranceEventRestService: QualityAssuranceEventDataService,
|
||||
private paginationService: PaginationService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
|
@@ -19,8 +19,8 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
QualityAssuranceSourceRestService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
|
||||
|
||||
/**
|
||||
* Provides effect methods for the Quality Assurance source actions.
|
||||
@@ -79,7 +79,7 @@ export class QualityAssuranceSourceEffects {
|
||||
* @param {TranslateService} translate
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
|
||||
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceDataService
|
||||
* @param {QualityAssuranceSourceDataService} qualityAssuranceSourceDataService
|
||||
*/
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
@@ -87,7 +87,7 @@ export class QualityAssuranceSourceEffects {
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService
|
||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@@ -12,13 +12,13 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {
|
||||
QualityAssuranceSourceRestService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('QualityAssuranceSourceService', () => {
|
||||
let service: QualityAssuranceSourceService;
|
||||
let restService: QualityAssuranceSourceRestService;
|
||||
let restService: QualityAssuranceSourceDataService;
|
||||
let serviceAsAny: any;
|
||||
let restServiceAsAny: any;
|
||||
|
||||
@@ -32,14 +32,14 @@ describe('QualityAssuranceSourceService', () => {
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: QualityAssuranceSourceRestService, useClass: getMockQualityAssuranceSourceRestService },
|
||||
{ provide: QualityAssuranceSourceDataService, useClass: getMockQualityAssuranceSourceRestService },
|
||||
{ provide: QualityAssuranceSourceService, useValue: service }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
restService = TestBed.get(QualityAssuranceSourceRestService);
|
||||
restService = TestBed.inject(QualityAssuranceSourceDataService);
|
||||
restServiceAsAny = restService;
|
||||
restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD));
|
||||
service = new QualityAssuranceSourceService(restService);
|
||||
|
@@ -4,8 +4,8 @@ import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
QualityAssuranceSourceRestService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
@@ -23,10 +23,10 @@ export class QualityAssuranceSourceService {
|
||||
|
||||
/**
|
||||
* Initialize the service variables.
|
||||
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceRestService
|
||||
* @param {QualityAssuranceSourceDataService} qualityAssuranceSourceRestService
|
||||
*/
|
||||
constructor(
|
||||
private qualityAssuranceSourceRestService: QualityAssuranceSourceRestService
|
||||
private qualityAssuranceSourceRestService: QualityAssuranceSourceDataService
|
||||
) {
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
QualityAssuranceTopicRestService
|
||||
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
|
||||
/**
|
||||
* Provides effect methods for the Quality Assurance topics actions.
|
||||
@@ -79,7 +79,7 @@ export class QualityAssuranceTopicsEffects {
|
||||
* @param {TranslateService} translate
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {QualityAssuranceTopicsService} qualityAssuranceTopicService
|
||||
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicDataService
|
||||
* @param {QualityAssuranceTopicDataService} qualityAssuranceTopicDataService
|
||||
*/
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
@@ -87,6 +87,6 @@ export class QualityAssuranceTopicsEffects {
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceTopicService: QualityAssuranceTopicsService,
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicRestService
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService
|
||||
) { }
|
||||
}
|
||||
|
@@ -2,7 +2,9 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
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 {
|
||||
getMockQualityAssuranceTopicRestService,
|
||||
@@ -17,7 +19,7 @@ import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('QualityAssuranceTopicsService', () => {
|
||||
let service: QualityAssuranceTopicsService;
|
||||
let restService: QualityAssuranceTopicRestService;
|
||||
let restService: QualityAssuranceTopicDataService;
|
||||
let serviceAsAny: any;
|
||||
let restServiceAsAny: any;
|
||||
|
||||
@@ -31,14 +33,14 @@ describe('QualityAssuranceTopicsService', () => {
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: QualityAssuranceTopicRestService, useClass: getMockQualityAssuranceTopicRestService },
|
||||
{ provide: QualityAssuranceTopicDataService, useClass: getMockQualityAssuranceTopicRestService },
|
||||
{ provide: QualityAssuranceTopicsService, useValue: service }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
restService = TestBed.get(QualityAssuranceTopicRestService);
|
||||
restService = TestBed.inject(QualityAssuranceTopicDataService);
|
||||
restServiceAsAny = restService;
|
||||
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
|
||||
service = new QualityAssuranceTopicsService(restService);
|
||||
|
@@ -2,8 +2,8 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import {
|
||||
QualityAssuranceTopicRestService
|
||||
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
@@ -22,10 +22,10 @@ export class QualityAssuranceTopicsService {
|
||||
|
||||
/**
|
||||
* Initialize the service variables.
|
||||
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicRestService
|
||||
* @param {QualityAssuranceTopicDataService} qualityAssuranceTopicRestService
|
||||
*/
|
||||
constructor(
|
||||
private qualityAssuranceTopicRestService: QualityAssuranceTopicRestService
|
||||
private qualityAssuranceTopicRestService: QualityAssuranceTopicDataService
|
||||
) { }
|
||||
|
||||
/**
|
||||
|
@@ -13,19 +13,19 @@ import { suggestionNotificationsReducers, SuggestionNotificationsState } from '.
|
||||
import { suggestionNotificationsEffects } from './suggestion-notifications-effects';
|
||||
import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
|
||||
import {
|
||||
QualityAssuranceTopicRestService
|
||||
} from '../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../core/suggestion-notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import {
|
||||
QualityAssuranceEventRestService
|
||||
} from '../core/suggestion-notifications/qa/events/quality-assurance-event-rest.service';
|
||||
QualityAssuranceEventDataService
|
||||
} 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 { TranslateModule } from '@ngx-translate/core';
|
||||
import { SearchModule } from '../shared/search/search.module';
|
||||
import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component';
|
||||
import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service';
|
||||
import {
|
||||
QualityAssuranceSourceRestService
|
||||
} from '../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../core/suggestion-notifications/qa/source/quality-assurance-source-data.service';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
@@ -53,9 +53,9 @@ const PROVIDERS = [
|
||||
SuggestionNotificationsStateService,
|
||||
QualityAssuranceTopicsService,
|
||||
QualityAssuranceSourceService,
|
||||
QualityAssuranceTopicRestService,
|
||||
QualityAssuranceSourceRestService,
|
||||
QualityAssuranceEventRestService
|
||||
QualityAssuranceTopicDataService,
|
||||
QualityAssuranceSourceDataService,
|
||||
QualityAssuranceEventDataService
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
Reference in New Issue
Block a user