From dee63e3f3bbbd28f644ab407189396f20477dd81 Mon Sep 17 00:00:00 2001 From: davidcanonieto Date: Mon, 8 Apr 2019 15:23:46 +0100 Subject: [PATCH] [ADF-3887] Different local storages for different ADF apps (#4539) * [ADF-3887] Different local storages for different ADF apps * [ADF-3887] Add documentation * [ADF-3887] Add unit tests and improve code * [ADF-3887] Add unit tests * [ADF-3887] Fix e2e tests * fix test * fix test * Update storage.service.md --- demo-shell/src/app.config.json | 1 + docs/core/services/storage.service.md | 17 +++ .../services/document-actions.service.spec.ts | 4 +- .../services/document-list.service.spec.ts | 4 +- .../services/folder-actions.service.spec.ts | 4 +- lib/core/app-config/app-config.service.ts | 3 +- .../app-config/debug-app-config.service.ts | 13 ++- .../node-favorite.directive.spec.ts | 3 +- lib/core/mock/alfresco-api.service.mock.ts | 6 +- lib/core/services/alfresco-api.service.ts | 4 +- lib/core/services/storage.service.spec.ts | 100 ++++++++++++++++++ lib/core/services/storage.service.ts | 33 ++++-- lib/core/services/user-preferences.service.ts | 1 + .../process-list-cloud.service.spec.ts | 4 +- .../task/services/task-cloud.service.spec.ts | 4 +- .../services/task-list-cloud.service.spec.ts | 4 +- lib/process-services/karma.conf.js | 1 + .../services/process-filter.service.spec.ts | 4 +- .../services/process.service.spec.ts | 4 +- .../services/task-filter.service.spec.ts | 4 +- .../services/tasklist.service.spec.ts | 4 +- .../actions/testing-alfresco-api.service.ts | 2 +- 22 files changed, 181 insertions(+), 43 deletions(-) create mode 100644 lib/core/services/storage.service.spec.ts diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index 239c7fb63b..75d013078a 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -23,6 +23,7 @@ "redirectUriLogout": "/logout" }, "application": { + "storagePrefix": "ADF", "name": "Alfresco ADF Application", "copyright": "© 2016 - 2018 Alfresco Software, Inc. All Rights Reserved." }, diff --git a/docs/core/services/storage.service.md b/docs/core/services/storage.service.md index 90435c6731..1b904d49c4 100644 --- a/docs/core/services/storage.service.md +++ b/docs/core/services/storage.service.md @@ -44,6 +44,23 @@ more widely supported by browsers and can be set to expire after a certain date. If local storage is not available then non-persistent memory storage within the app is used instead. +## Storage specific to an ADF app + +If you are using multiple ADF apps, you might want to set the following configuration so that the apps have specific storages and are independent of others when setting and getting data from the local storage. + +In order to achieve this, you will only need to set your app identifier under the `storagePrefix` property of the app in your `app.config.json` file. + +```json +"application": { + "storagePrefix": "ADF_Identifier", + "name": "Your app name", + "copyright": "Your copyright message" +} +``` + +**Important note** +This identifier must be unique to the app to guarantee that it has its own storage. + ## See also - [Cookie service](cookie.service.md) diff --git a/lib/content-services/document-list/services/document-actions.service.spec.ts b/lib/content-services/document-list/services/document-actions.service.spec.ts index 67e9e8d7d6..1cca686419 100644 --- a/lib/content-services/document-list/services/document-actions.service.spec.ts +++ b/lib/content-services/document-list/services/document-actions.service.spec.ts @@ -16,7 +16,7 @@ */ import { AlfrescoApiServiceMock, AppConfigService, ContentService, - StorageService, setupTestBed, CoreModule, TranslationMock + setupTestBed, CoreModule, TranslationMock } from '@alfresco/adf-core'; import { FileNode, FolderNode } from '../../mock'; import { ContentActionHandler } from '../models/content-action.model'; @@ -37,7 +37,7 @@ describe('DocumentActionsService', () => { beforeEach(() => { const contentService = new ContentService(null, null, null, null); - const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); + const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null)); documentListService = new DocumentListService(contentService, alfrescoApiService, null, null); service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService); diff --git a/lib/content-services/document-list/services/document-list.service.spec.ts b/lib/content-services/document-list/services/document-list.service.spec.ts index 403f0788e7..a57edea050 100644 --- a/lib/content-services/document-list/services/document-list.service.spec.ts +++ b/lib/content-services/document-list/services/document-list.service.spec.ts @@ -16,7 +16,7 @@ */ import { AlfrescoApiServiceMock, AlfrescoApiService, - AppConfigService, StorageService, ContentService, setupTestBed, CoreModule, LogService, AppConfigServiceMock } from '@alfresco/adf-core'; + AppConfigService, ContentService, setupTestBed, CoreModule, LogService, AppConfigServiceMock } from '@alfresco/adf-core'; import { DocumentListService } from './document-list.service'; import { CustomResourcesService } from './custom-resources.service'; @@ -70,7 +70,7 @@ describe('DocumentListService', () => { beforeEach(() => { const logService = new LogService(new AppConfigServiceMock(null)); const contentService = new ContentService(null, null, null, null); - alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); + alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null)); const customActionService = new CustomResourcesService(alfrescoApiService, logService); service = new DocumentListService(contentService, alfrescoApiService, logService, customActionService); jasmine.Ajax.install(); diff --git a/lib/content-services/document-list/services/folder-actions.service.spec.ts b/lib/content-services/document-list/services/folder-actions.service.spec.ts index badb07cd34..544af2bd20 100644 --- a/lib/content-services/document-list/services/folder-actions.service.spec.ts +++ b/lib/content-services/document-list/services/folder-actions.service.spec.ts @@ -16,7 +16,7 @@ */ import { TestBed } from '@angular/core/testing'; -import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService, setupTestBed, CoreModule, TranslationMock } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, AppConfigService, ContentService, setupTestBed, CoreModule, TranslationMock } from '@alfresco/adf-core'; import { Observable } from 'rxjs'; import { FileNode, FolderNode } from '../../mock'; import { ContentActionHandler } from '../models/content-action.model'; @@ -39,7 +39,7 @@ describe('FolderActionsService', () => { appConfig.config.ecmHost = 'http://localhost:9876/ecm'; const contentService = new ContentService(null, null, null, null); - const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); + const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null)); documentListService = new DocumentListService(contentService, alfrescoApiService, null, null); service = new FolderActionsService(null, documentListService, contentService, new TranslationMock()); }); diff --git a/lib/core/app-config/app-config.service.ts b/lib/core/app-config/app-config.service.ts index 005560c3c9..e7e08cf4c4 100644 --- a/lib/core/app-config/app-config.service.ts +++ b/lib/core/app-config/app-config.service.ts @@ -37,7 +37,8 @@ export enum AppConfigValues { LOG_LEVEL = 'logLevel', LOGIN_ROUTE = 'loginRoute', DISABLECSRF = 'disableCSRF', - AUTH_WITH_CREDENTIALS = 'auth.withCredentials' + AUTH_WITH_CREDENTIALS = 'auth.withCredentials', + APPLICATION = 'application' } export enum Status { diff --git a/lib/core/app-config/debug-app-config.service.ts b/lib/core/app-config/debug-app-config.service.ts index bd049a443e..f9566dc676 100644 --- a/lib/core/app-config/debug-app-config.service.ts +++ b/lib/core/app-config/debug-app-config.service.ts @@ -17,21 +17,26 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { StorageService } from '../services/storage.service'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; @Injectable() export class DebugAppConfigService extends AppConfigService { - constructor(private storage: StorageService, http: HttpClient) { + constructor(http: HttpClient) { super(http); } /** @override */ get(key: string, defaultValue?: T): T { if (key === AppConfigValues.OAUTHCONFIG) { - return (JSON.parse(this.storage.getItem(key)) || super.get(key, defaultValue)); + return (JSON.parse(this.getItem(key)) || super.get(key, defaultValue)); + } else if (key === AppConfigValues.APPLICATION) { + return undefined; } else { - return ( this.storage.getItem(key) || super.get(key, defaultValue)); + return ( this.getItem(key) || super.get(key, defaultValue)); } } + + getItem(key: string): string | null { + return localStorage.getItem(key); + } } diff --git a/lib/core/directives/node-favorite.directive.spec.ts b/lib/core/directives/node-favorite.directive.spec.ts index 94c27e9f46..4b2e321fd0 100644 --- a/lib/core/directives/node-favorite.directive.spec.ts +++ b/lib/core/directives/node-favorite.directive.spec.ts @@ -20,7 +20,6 @@ import { fakeAsync, tick } from '@angular/core/testing'; import { NodeFavoriteDirective } from './node-favorite.directive'; import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; import { AppConfigService } from '../app-config/app-config.service'; -import { StorageService } from '../services/storage.service'; import { setupTestBed } from '../testing/setupTestBed'; import { CoreTestingModule } from '../testing/core.testing.module'; @@ -34,7 +33,7 @@ describe('NodeFavoriteDirective', () => { }); beforeEach(() => { - alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); + alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null)); directive = new NodeFavoriteDirective( alfrescoApiService); }); diff --git a/lib/core/mock/alfresco-api.service.mock.ts b/lib/core/mock/alfresco-api.service.mock.ts index 8eccd59d01..89f408ccc1 100644 --- a/lib/core/mock/alfresco-api.service.mock.ts +++ b/lib/core/mock/alfresco-api.service.mock.ts @@ -17,16 +17,14 @@ import { Injectable } from '@angular/core'; import { AppConfigService } from '../app-config/app-config.service'; -import { StorageService } from '../services/storage.service'; import { AlfrescoApiService } from '../services/alfresco-api.service'; /* tslint:disable:adf-file-name */ @Injectable() export class AlfrescoApiServiceMock extends AlfrescoApiService { - constructor(protected appConfig: AppConfigService, - protected storage: StorageService) { - super(appConfig, storage); + constructor(protected appConfig: AppConfigService) { + super(appConfig); if (!this.alfrescoApi) { this.initAlfrescoApi(); } diff --git a/lib/core/services/alfresco-api.service.ts b/lib/core/services/alfresco-api.service.ts index 5e0421685f..b6d3200981 100644 --- a/lib/core/services/alfresco-api.service.ts +++ b/lib/core/services/alfresco-api.service.ts @@ -25,7 +25,6 @@ import { } from '@alfresco/js-api'; import { AlfrescoApiCompatibility, AlfrescoApiConfig } from '@alfresco/js-api'; import { AppConfigService, AppConfigValues } from '../app-config/app-config.service'; -import { StorageService } from './storage.service'; import { Subject } from 'rxjs'; import { OauthConfigModel } from '../models/oauth-config.model'; @@ -96,8 +95,7 @@ export class AlfrescoApiService { return this.getInstance().core.groupsApi; } - constructor(protected appConfig: AppConfigService, - protected storage: StorageService) { + constructor(protected appConfig: AppConfigService) { } async load() { diff --git a/lib/core/services/storage.service.spec.ts b/lib/core/services/storage.service.spec.ts new file mode 100644 index 0000000000..f9c2b8c377 --- /dev/null +++ b/lib/core/services/storage.service.spec.ts @@ -0,0 +1,100 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { TestBed } from '@angular/core/testing'; +import { AppConfigService } from '../app-config/app-config.service'; +import { StorageService } from './storage.service'; +import { setupTestBed } from '../testing/setupTestBed'; +import { CoreTestingModule } from '../testing/core.testing.module'; +import { AppConfigServiceMock } from '../mock/app-config.service.mock'; + +describe('StorageService', () => { + + let storage: StorageService; + let appConfig: AppConfigServiceMock; + const key = 'test_key'; + const value = 'test_value'; + + setupTestBed({ + imports: [CoreTestingModule], + providers: [ + { provide: AppConfigService, useClass: AppConfigServiceMock } + ] + }); + + beforeEach(() => { + appConfig = TestBed.get(AppConfigService); + appConfig.config = { + application: { + storagePrefix: 'ADF_APP' + } + }; + storage = TestBed.get(StorageService); + }); + + it('should get the prefix for the storage from app config', (done) => { + appConfig.load().then(() => { + expect(storage.storagePrefix).toBe('ADF_APP_'); + done(); + }); + }); + + it('should set an empty prefix when the it is not defined in the app config', (done) => { + appConfig.config.application.storagePrefix = ''; + appConfig.load().then(() => { + expect(storage.storagePrefix).toBe(''); + done(); + }); + }); + + it('should set a property with the prefix in the local storage', (done) => { + storage.clear(); + + appConfig.load().then(() => { + storage.setItem(key, value); + const storageKey = localStorage.key(0); + expect(storageKey).toBe('ADF_APP_' + key); + expect(localStorage.getItem(storageKey)).toBe(value); + done(); + }); + }); + + it('should set a property without a prefix in the local storage', (done) => { + storage.clear(); + appConfig.config.application.storagePrefix = ''; + + appConfig.load().then(() => { + storage.setItem(key, value); + + const storageKey = localStorage.key(0); + expect(storageKey).toBe(key); + expect(localStorage.getItem(storageKey)).toBe(value); + done(); + }); + }); + + it('should be able to get a property from the local storage', (done) => { + storage.clear(); + + appConfig.load().then(() => { + storage.setItem(key, value); + + expect(storage.getItem(key)).toBe(value); + done(); + }); + }); +}); diff --git a/lib/core/services/storage.service.ts b/lib/core/services/storage.service.ts index 35ace886f8..f8979ae6e7 100644 --- a/lib/core/services/storage.service.ts +++ b/lib/core/services/storage.service.ts @@ -16,6 +16,7 @@ */ import { Injectable } from '@angular/core'; +import { AppConfigService } from '../app-config/app-config.service'; @Injectable({ providedIn: 'root' @@ -24,9 +25,11 @@ export class StorageService { private memoryStore: { [key: string]: any } = {}; private useLocalStorage: boolean = false; + storagePrefix: string; - constructor() { + constructor(private appConfigService: AppConfigService) { this.useLocalStorage = this.storageAvailable('localStorage'); + this.appConfigService.onLoad.subscribe(this.getAppPrefix.bind(this)); } /** @@ -36,9 +39,9 @@ export class StorageService { */ getItem(key: string): string | null { if (this.useLocalStorage) { - return localStorage.getItem(key); + return localStorage.getItem(this.storagePrefix + key); } else { - return this.memoryStore.hasOwnProperty(key) ? this.memoryStore[key] : null; + return this.memoryStore.hasOwnProperty(this.storagePrefix + key) ? this.memoryStore[this.storagePrefix + key] : null; } } @@ -49,9 +52,9 @@ export class StorageService { */ setItem(key: string, data: string) { if (this.useLocalStorage) { - localStorage.setItem(key, data); + localStorage.setItem(this.storagePrefix + key, data); } else { - this.memoryStore[key] = data.toString(); + this.memoryStore[this.storagePrefix + key] = data.toString(); } } @@ -70,9 +73,9 @@ export class StorageService { */ removeItem(key: string) { if (this.useLocalStorage) { - localStorage.removeItem(key); + localStorage.removeItem(this.storagePrefix + key); } else { - delete this.memoryStore[key]; + delete this.memoryStore[this.storagePrefix + key]; } } @@ -83,7 +86,7 @@ export class StorageService { */ hasItem(key: string): boolean { if (this.useLocalStorage) { - return localStorage.getItem(key) ? true : false; + return localStorage.getItem(this.storagePrefix + key) ? true : false; } else { return this.memoryStore.hasOwnProperty(key); } @@ -101,4 +104,18 @@ export class StorageService { } } + /** + * Sets the prefix that is used for the local storage of the app + * It assigns the string that is defined i the app config, + * empty prefix otherwise. + */ + getAppPrefix() { + const appConfiguration = this.appConfigService.get('application'); + if (appConfiguration && appConfiguration.storagePrefix) { + this.storagePrefix = appConfiguration.storagePrefix + '_'; + } else { + this.storagePrefix = ''; + } + } + } diff --git a/lib/core/services/user-preferences.service.ts b/lib/core/services/user-preferences.service.ts index 5cd8a9c29c..507be375db 100644 --- a/lib/core/services/user-preferences.service.ts +++ b/lib/core/services/user-preferences.service.ts @@ -153,6 +153,7 @@ export class UserPreferencesService { */ setStoragePrefix(value: string) { this.storage.setItem('USER_PROFILE', value || 'GUEST'); + this.initUserPreferenceStatus(); } /** diff --git a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts index 27d380a3d1..03fd9d492c 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts @@ -17,7 +17,7 @@ import { async } from '@angular/core/testing'; import { setupTestBed } from '@alfresco/adf-core'; import { fakeProcessCloudList } from '../mock/process-list-service.mock'; -import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, LogService, AppConfigService, CoreModule } from '@alfresco/adf-core'; import { ProcessListCloudService } from './process-list-cloud.service'; import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model'; @@ -62,7 +62,7 @@ describe('Activiti ProcessList Cloud Service', () => { }); beforeEach(async(() => { - alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()); + alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null)); service = new ProcessListCloudService(alfrescoApiMock, new AppConfigService(null), new LogService(new AppConfigService(null))); diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts index 30bf8eb1e0..ae1d8f9aef 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts @@ -17,7 +17,7 @@ import { async, TestBed } from '@angular/core/testing'; import { setupTestBed, IdentityUserService } from '@alfresco/adf-core'; -import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, LogService, AppConfigService, CoreModule } from '@alfresco/adf-core'; import { TaskCloudService } from './task-cloud.service'; import { taskCompleteCloudMock } from '../task-header/mocks/fake-complete-task.mock'; import { taskDetailsCloudMock } from '../task-header/mocks/task-details-cloud.mock'; @@ -68,7 +68,7 @@ describe('Task Cloud Service', () => { }); beforeEach(async(() => { - alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ); + alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null)); identityUserService = TestBed.get(IdentityUserService); spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(cloudMockUser); service = new TaskCloudService(alfrescoApiMock, diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts index 07b327b681..3a381eea6d 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts @@ -18,7 +18,7 @@ import { async } from '@angular/core/testing'; import { setupTestBed } from '@alfresco/adf-core'; import { fakeTaskCloudList } from '../mock/fakeTaskResponseMock'; -import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, LogService, AppConfigService, CoreModule } from '@alfresco/adf-core'; import { TaskListCloudService } from './task-list-cloud.service'; import { TaskQueryCloudRequestModel } from '../models/filter-cloud-model'; @@ -64,7 +64,7 @@ describe('Activiti TaskList Cloud Service', () => { }); beforeEach(async(() => { - alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ); + alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null)); service = new TaskListCloudService(alfrescoApiMock, new AppConfigService(null), new LogService(new AppConfigService(null))); diff --git a/lib/process-services/karma.conf.js b/lib/process-services/karma.conf.js index d5ecb25724..9a103b046e 100644 --- a/lib/process-services/karma.conf.js +++ b/lib/process-services/karma.conf.js @@ -43,6 +43,7 @@ module.exports = function (config) { '/assets/': '/base/lib/process-services/assets/', '/base/assets/': '/base/lib/process-services/assets/', '/assets/adf-core/i18n/en.json': '/base/lib/core/i18n/en.json', + '/assets/adf-core/i18n/en.json': '/base/lib/core/i18n/en.json', '/assets/adf-content-services/i18n/en.json': '/base/lib/content-services/i18n/en.json', '/assets/adf-process-services/i18n/en-GB.json': '/base/lib/process-services/i18n/en.json', '/app.config.json': '/base/lib/config/app.config.json' diff --git a/lib/process-services/process-list/services/process-filter.service.spec.ts b/lib/process-services/process-list/services/process-filter.service.spec.ts index 71a9e71a68..61e05841f9 100644 --- a/lib/process-services/process-list/services/process-filter.service.spec.ts +++ b/lib/process-services/process-list/services/process-filter.service.spec.ts @@ -19,7 +19,7 @@ import { async } from '@angular/core/testing'; import { mockError, fakeProcessFilters } from '../../mock'; import { FilterProcessRepresentationModel } from '../models/filter-process.model'; import { ProcessFilterService } from './process-filter.service'; -import { AlfrescoApiServiceMock, AlfrescoApiService, AppConfigService, StorageService, setupTestBed, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, AlfrescoApiService, AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core'; declare let jasmine: any; @@ -36,7 +36,7 @@ describe('Process filter', () => { }); beforeEach(() => { - apiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ); + apiService = new AlfrescoApiServiceMock(new AppConfigService(null)); service = new ProcessFilterService(apiService); alfrescoApi = apiService.getInstance(); }); diff --git a/lib/process-services/process-list/services/process.service.spec.ts b/lib/process-services/process-list/services/process.service.spec.ts index aa195a3cf2..1fe11c0122 100644 --- a/lib/process-services/process-list/services/process.service.spec.ts +++ b/lib/process-services/process-list/services/process.service.spec.ts @@ -21,7 +21,7 @@ import { mockError, fakeProcessDef, fakeTasksList } from '../../mock'; import { ProcessFilterParamRepresentationModel } from '../models/filter-process.model'; import { ProcessInstanceVariable } from '../models/process-instance-variable.model'; import { ProcessService } from './process.service'; -import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigService, StorageService, setupTestBed, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core'; declare let moment: any; @@ -38,7 +38,7 @@ describe('ProcessService', () => { }); beforeEach(() => { - apiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ); + apiService = new AlfrescoApiServiceMock(new AppConfigService(null)); service = new ProcessService(apiService); alfrescoApi = apiService.getInstance(); }); diff --git a/lib/process-services/task-list/services/task-filter.service.spec.ts b/lib/process-services/task-list/services/task-filter.service.spec.ts index 31d0a940b0..cf6d9b5591 100644 --- a/lib/process-services/task-list/services/task-filter.service.spec.ts +++ b/lib/process-services/task-list/services/task-filter.service.spec.ts @@ -19,7 +19,7 @@ import { async } from '@angular/core/testing'; import { fakeAppFilter, fakeAppPromise, fakeFilters } from '../../mock'; import { FilterRepresentationModel } from '../models/filter.model'; import { TaskFilterService } from './task-filter.service'; -import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService, setupTestBed, CoreModule } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, LogService, AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core'; declare let jasmine: any; @@ -34,7 +34,7 @@ describe('Activiti Task filter Service', () => { }); beforeEach(async(() => { - service = new TaskFilterService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null))); + service = new TaskFilterService(new AlfrescoApiServiceMock(new AppConfigService(null)), new LogService(new AppConfigService(null))); jasmine.Ajax.install(); })); diff --git a/lib/process-services/task-list/services/tasklist.service.spec.ts b/lib/process-services/task-list/services/tasklist.service.spec.ts index 0c7f545c40..575e611cae 100644 --- a/lib/process-services/task-list/services/tasklist.service.spec.ts +++ b/lib/process-services/task-list/services/tasklist.service.spec.ts @@ -35,7 +35,7 @@ import { import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model'; import { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './tasklist.service'; -import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService } from '@alfresco/adf-core'; +import { AlfrescoApiServiceMock, LogService, AppConfigService } from '@alfresco/adf-core'; declare let jasmine: any; @@ -50,7 +50,7 @@ describe('Activiti TaskList Service', () => { }); beforeEach(async(() => { - service = new TaskListService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ), new LogService(new AppConfigService(null))); + service = new TaskListService(new AlfrescoApiServiceMock(new AppConfigService(null)), new LogService(new AppConfigService(null))); jasmine.Ajax.install(); })); diff --git a/lib/testing/src/lib/process-services-cloud/actions/testing-alfresco-api.service.ts b/lib/testing/src/lib/process-services-cloud/actions/testing-alfresco-api.service.ts index b6c9d50c0e..186abbc7f2 100644 --- a/lib/testing/src/lib/process-services-cloud/actions/testing-alfresco-api.service.ts +++ b/lib/testing/src/lib/process-services-cloud/actions/testing-alfresco-api.service.ts @@ -26,7 +26,7 @@ export class TestingAlfrescoApiService extends AlfrescoApiService { }; constructor(public appConfig: AppConfigService) { - super(null, null); + super(null); const oauth = Object.assign({}, this.appConfig.get(AppConfigValues.OAUTHCONFIG, null)); this.config = new AlfrescoApiConfig({ provider: this.appConfig.get(AppConfigValues.PROVIDERS),