Added tests and comments

This commit is contained in:
Giuseppe Digilio
2019-04-02 18:29:44 +02:00
parent 49aee1898b
commit 080e0bee73
14 changed files with 475 additions and 13 deletions

View File

@@ -14,12 +14,37 @@ import { NormalizedObjectBuildService } from '../cache/builders/normalized-objec
import { ObjectCacheService } from '../cache/object-cache.service';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
import { ProcessTaskResponse } from './models/process-task-response';
/**
* The service handling all REST requests for PoolTask
*/
@Injectable()
export class PoolTaskDataService extends TasksService<PoolTask> {
/**
* The endpoint link name
*/
protected linkPath = 'pooltasks';
/**
* When true, a new request is always dispatched
*/
protected forceBypassCache = true;
/**
* Initialize instance variables
*
* @param {RequestService} requestService
* @param {RemoteDataBuildService} rdbService
* @param {NormalizedObjectBuildService} dataBuildService
* @param {Store<CoreState>} store
* @param {ObjectCacheService} objectCache
* @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService
* @param {HttpClient} http
* @param {DSOChangeAnalyzer<ClaimedTask} comparator
*/
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
@@ -33,7 +58,15 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
super();
}
public claimTask(scopeId: string): Observable<any> {
/**
* Make a request to claim the given task
*
* @param scopeId
* The task id
* @return {Observable<ProcessTaskResponse>}
* Emit the server response
*/
public claimTask(scopeId: string): Observable<ProcessTaskResponse> {
return this.postToEndpoint(this.linkPath, {}, scopeId, this.makeHttpOptions());
}
}