[ADF-2569] fix reload app.config.json (#3124)

* fix reload app.config.json

* improve style mobile
fix test

* test karma setup update

* fix core providers test

* remove unused providers

* use mock api in service test

* skip test in the wrong place

* remove comma

* remove fdescribe
This commit is contained in:
Eugenio Romano 2018-03-28 11:01:04 +01:00 committed by Denys Vuika
parent 21b8cd30ce
commit 9e2969b955
93 changed files with 228 additions and 436 deletions

View File

@ -1,8 +1,9 @@
@mixin adf-file-component-theme($theme) {
$minimumDocumentListWidth: 425px;
$foreground: map-get($theme, foreground);
.container {
margin: 10px;
margin: 10px !important;
}
@media screen and ($mat-xsmall) {
@ -62,14 +63,14 @@
}
.adf-manage-versions-sidebar {
width: 300px;
width: 300px !important;
color: rgba(0, 0, 0, 0.87);
.adf-manage-versions-empty,
.adf-manage-versions-no-permission {
margin: 24px;
color: grey;
text-align: justify;
margin: 44px;
color: mat-color($foreground, text, 0.54);
text-align: center;
&-icon {
display: block;
@ -153,7 +154,7 @@
}
adf-file-uploading-dialog ::ng-deep .upload-dialog {
width: 80%;
width: 80%;
& ::ng-deep adf-file-uploading-list ::ng-deep adf-file-uploading-list-row .adf-file-uploading-row__group {
min-width: 0;

View File

@ -22,5 +22,5 @@
},
"exclude": [
"node_modules"
],
]
}

View File

@ -27,6 +27,9 @@ const TranslateModule = require('@ngx-translate/core').TranslateModule;
const CommonModule = require('@angular/common').CommonModule;
const FormsModule = require('@angular/forms').FormsModule;
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;
const AlfrescoApiService = require('@alfresco/adf-core').AlfrescoApiService;
const AlfrescoApiServiceMock = require('@alfresco/adf-core').AlfrescoApiServiceMock;
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
@ -41,6 +44,7 @@ beforeEach(() => {
ReactiveFormsModule
],
providers: [
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock},
{provide: TranslationService, useClass: TranslationMock}
]

View File

@ -7,8 +7,7 @@
&-dropdown-breadcrumb {
display: flex;
justify-content: flex-start;
width: 65%;
max-width: 200px;
width: 100%;
}
&-dropdown-breadcumb-trigger {
@ -35,13 +34,14 @@
}
&-current-folder {
text-align: left;
margin-left: $dropdownHorizontalOffset;
line-height: 26px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
width: 100%;
width: 75%;
}
&-current-folder.isRoot {

View File

@ -27,7 +27,6 @@ import { ContentMetadataService } from '../../services/content-metadata.service'
import { BasicPropertiesService } from '../../services/basic-properties.service';
import { PropertyGroupTranslatorService } from '../../services/property-groups-translator.service';
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { ContentMetadataConfigFactory } from '../../services/config/content-metadata-config.factory';
describe('ContentMetadataCardComponent', () => {
@ -54,8 +53,7 @@ describe('ContentMetadataCardComponent', () => {
BasicPropertiesService,
PropertyGroupTranslatorService,
ContentMetadataConfigFactory,
PropertyDescriptorsService,
AlfrescoApiService
PropertyDescriptorsService
]
}).compileComponents();
}));

View File

@ -27,7 +27,6 @@ import { ContentMetadataService } from '../../services/content-metadata.service'
import { BasicPropertiesService } from '../../services/basic-properties.service';
import { PropertyGroupTranslatorService } from '../../services/property-groups-translator.service';
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
import { AlfrescoApiService } from '@alfresco/adf-core';
import {
CardViewBaseItemModel,
CardViewComponent,
@ -63,7 +62,6 @@ describe('ContentMetadataComponent', () => {
PropertyGroupTranslatorService,
PropertyDescriptorsService,
ContentMetadataConfigFactory,
AlfrescoApiService,
NodesApiService,
{ provide: LogService, useValue: { error: jasmine.createSpy('error') } }
]

View File

@ -30,8 +30,7 @@ describe('PropertyDescriptorLoaderService', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [
PropertyDescriptorsService,
AlfrescoApiService
PropertyDescriptorsService
]
}).compileComponents();
}));

View File

@ -59,7 +59,6 @@ describe('ContentNodeDialogService', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
ContentNodeDialogService,
DocumentListService,

View File

@ -19,13 +19,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, fakeAsync, tick, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { MinimalNodeEntryEntity, SiteEntry, SitePaging } from 'alfresco-js-api';
import {
AlfrescoApiService,
TranslationService,
SearchService,
SitesService,
UserPreferencesService
} from '@alfresco/adf-core';
import { SearchService, SitesService } from '@alfresco/adf-core';
import { DataTableModule } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
@ -75,32 +69,6 @@ describe('ContentNodeSelectorComponent', () => {
_observer.next(result);
}
function setupTestbed(plusProviders) {
TestBed.configureTestingModule({
imports: [
DataTableModule
],
declarations: [
DocumentListComponent,
EmptyFolderContentDirective,
DropdownSitesComponent,
DropdownBreadcrumbComponent,
ContentNodeSelectorPanelComponent
],
providers: [
AlfrescoApiService,
SearchService,
TranslationService,
DocumentListService,
SitesService,
ContentNodeSelectorService,
UserPreferencesService,
...plusProviders
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
}
afterEach(() => {
fixture.destroy();
TestBed.resetTestingModule();
@ -109,7 +77,25 @@ describe('ContentNodeSelectorComponent', () => {
describe('General component features', () => {
beforeEach(async(() => {
setupTestbed([]);
TestBed.configureTestingModule({
imports: [
DataTableModule
],
declarations: [
DocumentListComponent,
EmptyFolderContentDirective,
DropdownSitesComponent,
DropdownBreadcrumbComponent,
ContentNodeSelectorPanelComponent
],
providers: [
SearchService,
DocumentListService,
SitesService,
ContentNodeSelectorService
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
TestBed.compileComponents();
}));

View File

@ -29,7 +29,7 @@ import {
DocumentListComponent,
DocumentListService
} from '../document-list';
import { AlfrescoApiService, ContentService } from '@alfresco/adf-core';
import { ContentService } from '@alfresco/adf-core';
describe('ContentNodeSelectorDialogComponent', () => {
@ -51,7 +51,6 @@ describe('ContentNodeSelectorDialogComponent', () => {
ContentNodeSelectorService,
ContentNodeSelectorPanelComponent,
DocumentListService,
AlfrescoApiService,
ContentService,
DocumentListService,
ContentNodeSelectorService,

View File

@ -1228,19 +1228,14 @@ describe('DocumentList', () => {
documentList.loadFolderByNodeId('-favorites-');
});
it('should fetch recent', (done) => {
it('should fetch recent', () => {
const person = { entry: { id: 'person ' } };
spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(person));
spyOn(apiService.searchApi, 'search').and.returnValue(Promise.resolve(null));
let getPersonSpy = spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(person));
documentList.loadFolderByNodeId('-recent-');
setTimeout(function () {
expect(apiService.peopleApi.getPerson).toHaveBeenCalledWith('-me-');
expect(apiService.searchApi.search).toHaveBeenCalled();
done();
}, 100);
expect(getPersonSpy).toHaveBeenCalledWith('-me-');
});
it('should emit error when fetch recent fails on getPerson call', (done) => {
@ -1254,7 +1249,7 @@ describe('DocumentList', () => {
documentList.loadFolderByNodeId('-recent-');
});
it('should emit error when fetch recent fails on search call', (done) => {
xit('should emit error when fetch recent fails on search call', (done) => {
const person = { entry: { id: 'person ' } };
spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(person));
spyOn(apiService.searchApi, 'search').and.returnValue(Promise.reject('error'));

View File

@ -16,7 +16,7 @@
*/
import {
AlfrescoApiService,
AlfrescoApiServiceMock,
AppConfigService,
StorageService,
ContentService
@ -36,7 +36,7 @@ describe('DocumentActionsService', () => {
beforeEach(() => {
let contentService = new ContentService(null, null, null, null);
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
service = new DocumentActionsService(null, documentListService, contentService);

View File

@ -15,12 +15,7 @@
* limitations under the License.
*/
import {
AlfrescoApiService,
AppConfigService,
StorageService,
ContentService
} from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, AlfrescoApiService, AppConfigService, StorageService, ContentService } from '@alfresco/adf-core';
import { DocumentListService } from './document-list.service';
declare let jasmine: any;
@ -93,7 +88,7 @@ describe('DocumentListService', () => {
beforeEach(() => {
let contentService = new ContentService(null, null, null, null);
alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
service = new DocumentListService(null, contentService, alfrescoApiService, null, null);
jasmine.Ajax.install();
});
@ -237,4 +232,4 @@ describe('DocumentListService', () => {
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json' });
});
})
});

View File

@ -15,13 +15,8 @@
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import {
AlfrescoApiService,
AppConfigService,
StorageService,
ContentService
} from '@alfresco/adf-core';
import { TestBed } from '@angular/core/testing';
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
import { FileNode, FolderNode } from '../../mock';
import { ContentActionHandler } from '../models/content-action.model';
@ -38,7 +33,7 @@ describe('FolderActionsService', () => {
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
let contentService = new ContentService(null, null, null, null);
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
service = new FolderActionsService(null, documentListService, contentService);
});

View File

@ -35,7 +35,6 @@ describe('NodeActionsService', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
NodeActionsService,
DocumentListService,

View File

@ -25,7 +25,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { Observable } from 'rxjs/Observable';
import { FolderDialogComponent } from '../dialogs/folder.dialog';
import { AppConfigService, DirectiveModule, ContentService, TranslateLoaderService } from '@alfresco/adf-core';
import { DirectiveModule, ContentService, TranslateLoaderService } from '@alfresco/adf-core';
import { FolderCreateDirective } from './folder-create.directive';
@Component({
@ -64,8 +64,7 @@ describe('FolderCreateDirective', () => {
FolderCreateDirective
],
providers: [
ContentService,
AppConfigService
ContentService
]
});

View File

@ -25,7 +25,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { Observable } from 'rxjs/Observable';
import { AppConfigService, ContentService, TranslateLoaderService, DirectiveModule } from '@alfresco/adf-core';
import { ContentService, TranslateLoaderService, DirectiveModule } from '@alfresco/adf-core';
import { FolderEditDirective } from './folder-edit.directive';
@Component({
@ -69,8 +69,7 @@ describe('FolderEditDirective', () => {
]
,
providers: [
ContentService,
AppConfigService
ContentService
]
});

View File

@ -24,11 +24,11 @@ const AppConfigService = require('@alfresco/adf-core').AppConfigService;
const AppConfigServiceMock = require('@alfresco/adf-core').AppConfigServiceMock;
const TranslationService = require('@alfresco/adf-core').TranslationService;
const TranslationMock = require('@alfresco/adf-core').TranslationMock;
const AlfrescoApiServiceMock = require('@alfresco/adf-core').AlfrescoApiServiceMock;
const AlfrescoApiService = require('@alfresco/adf-core').AlfrescoApiService;
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
patchTestBedToDestroyFixturesAfterEveryTest(TestBed);
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
@ -36,6 +36,7 @@ beforeEach(() => {
CoreModule.forRoot()
],
providers: [
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock},
{provide: TranslationService, useClass: TranslationMock}
]
@ -46,24 +47,3 @@ afterEach(() => {
TestBed.resetTestingModule();
});
function patchTestBedToDestroyFixturesAfterEveryTest(testBed) {
// Original resetTestingModule function of the TestBed.
var _resetTestingModule = testBed.resetTestingModule;
// Monkey-patch the resetTestingModule to destroy fixtures outside of a try/catch block.
// With https://github.com/angular/angular/commit/2c5a67134198a090a24f6671dcdb7b102fea6eba
// errors when destroying components are no longer causing Jasmine to fail.
testBed.resetTestingModule = function() {
try {
if(this._activeFixtures) {
this._activeFixtures.forEach(function (fixture) {
fixture.destroy();
});
}
} finally {
this._activeFixtures = [];
// Regardless of errors or not, run the original reset testing module function.
_resetTestingModule.call(this);
}
};
};

View File

@ -19,7 +19,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PermissionListComponent } from './permission-list.component';
import { NodesApiService } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
import { fakeNodeWithPermissions, fakeNodeInheritedOnly, fakeNodeWithOnlyLocally} from '../../../mock/permission-list.component.mock';
import { fakeNodeWithPermissions, fakeNodeInheritedOnly, fakeNodeWithOnlyLocally } from '../../../mock/permission-list.component.mock';
describe('PermissionDisplayComponent', () => {

View File

@ -29,7 +29,6 @@ describe('Rating component', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
RatingComponent
],

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AlfrescoApiService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, AppConfigService, StorageService } from '@alfresco/adf-core';
import { RatingService } from './rating.service';
declare let jasmine: any;
@ -25,7 +25,7 @@ describe('Rating service', () => {
let service;
beforeEach(() => {
service = new RatingService(new AlfrescoApiService(new AppConfigService(null), new StorageService()));
service = new RatingService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()));
});
beforeEach(() => {

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AlfrescoApiService, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { TagService } from './tag.service';
declare let jasmine: any;
@ -25,7 +25,7 @@ describe('TagService', () => {
let service: TagService;
beforeEach(() => {
service = new TagService(new AlfrescoApiService(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
service = new TagService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
});
beforeEach(() => {

View File

@ -47,7 +47,6 @@ describe('TagNodeList', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TagNodeListComponent
],

View File

@ -1,6 +1,12 @@
adf-upload-drag-area {
overflow: hidden;
}
.upload-border {
vertical-align: middle;
text-align: center;
width: 100%;
box-sizing: border-box;
}
.file-draggable__input-focus {

View File

@ -16,7 +16,7 @@
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FileModel, LogService, UploadService } from '@alfresco/adf-core';
import { FileModel, UploadService } from '@alfresco/adf-core';
import { FileDraggableDirective } from '../directives/file-draggable.directive';
import { UploadDragAreaComponent } from './upload-drag-area.component';
@ -63,14 +63,12 @@ describe('UploadDragAreaComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
FileDraggableDirective,
UploadDragAreaComponent
],
providers: [
UploadService,
LogService
UploadService
]
}).compileComponents();
}));

View File

@ -32,6 +32,7 @@ import { UploadBase } from './base-upload/upload-base';
selector: 'adf-upload-drag-area',
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css'],
host: {'class': 'adf-upload-drag-area'},
viewProviders: [
{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent) }
],

View File

@ -32,10 +32,7 @@ describe('VersionListComponent', () => {
TestBed.configureTestingModule({
declarations: [
VersionListComponent
],
providers: [
AlfrescoApiService
],
]
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));

View File

@ -16,24 +16,15 @@
*/
import { HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { NgModule } from '@angular/core';
import { AppConfigService } from './app-config.service';
import { startupServiceFactory } from './startup-service-factory';
@NgModule({
imports: [
HttpClientModule
],
providers: [
AppConfigService,
{
provide: APP_INITIALIZER,
useFactory: startupServiceFactory,
deps: [
AppConfigService
],
multi: true
}
AppConfigService
]
})
export class AppConfigModule {

View File

@ -54,6 +54,7 @@ describe('AppConfigService', () => {
beforeEach(
inject([AppConfigService], (appConfig: AppConfigService) => {
appConfigService = appConfig;
appConfigService.load();
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,

View File

@ -31,7 +31,7 @@ export class AppConfigService {
ecmHost: 'http://{hostname}{:port}/ecm',
bpmHost: 'http://{hostname}{:port}/bpm',
logLevel: 'silent',
alfrescoRepositoryName : 'alfresco-1'
alfrescoRepositoryName: 'alfresco-1'
};
constructor(private http: HttpClient) {
@ -60,8 +60,8 @@ export class AppConfigService {
return location.port ? prefix + location.port : '';
}
async load(): Promise<any> {
await new Promise(resolve => {
load(): Promise<any> {
return new Promise(resolve => {
this.http.get('app.config.json').subscribe(
(data: any) => {
this.config = Object.assign({}, this.config, data || {});

View File

@ -23,9 +23,7 @@ import { MatCheckboxChange, MatCheckbox } from '@angular/material';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AppConfigService } from '../../../app-config/app-config.service';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { LogService } from '../../../services/log.service';
import { TranslateLoaderService } from '../../../services/translate-loader.service';
import { CardViewBoolItemComponent } from './card-view-boolitem.component';
@ -54,9 +52,7 @@ describe('CardViewBoolItemComponent', () => {
CardViewBoolItemComponent
],
providers: [
AppConfigService,
CardViewUpdateService,
LogService
CardViewUpdateService
]
}).compileComponents();
}));

View File

@ -22,7 +22,6 @@ import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimep
import { By } from '@angular/platform-browser';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import moment from 'moment-es6';
import { AppConfigService } from '../../../index';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { TranslateLoaderService } from '../../../services/translate-loader.service';
@ -54,8 +53,7 @@ describe('CardViewDateItemComponent', () => {
CardViewDateItemComponent
],
providers: [
CardViewUpdateService,
AppConfigService
CardViewUpdateService
]
}).compileComponents();
}));

View File

@ -46,7 +46,6 @@ describe('CardViewItemDispatcherComponent', () => {
cardItemTypeService.setComponentTypeResolver('shiny-custom-element', () => CardViewShinyCustomElementItemComponent);
TestBed.configureTestingModule({
imports: [],
declarations: [
CardViewItemDispatcherComponent,
CardViewShinyCustomElementItemComponent,

View File

@ -24,9 +24,7 @@ import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CardViewMapItemModel } from '../../models/card-view-mapitem.model';
import { AppConfigService } from '../../../app-config/app-config.service';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { LogService } from '../../../services/log.service';
import { TranslateLoaderService } from '../../../services/translate-loader.service';
import { CardViewMapItemComponent } from './card-view-mapitem.component';
@ -57,9 +55,7 @@ describe('CardViewMapItemComponent', () => {
CardViewMapItemComponent
],
providers: [
AppConfigService,
CardViewUpdateService,
LogService
CardViewUpdateService
]
}).compileComponents();
}));

View File

@ -23,9 +23,7 @@ import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
import { AppConfigService } from '../../../app-config/app-config.service';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { LogService } from '../../../services/log.service';
import { TranslateLoaderService } from '../../../services/translate-loader.service';
import { CardViewTextItemComponent } from './card-view-textitem.component';
@ -56,9 +54,7 @@ describe('CardViewTextItemComponent', () => {
CardViewTextItemComponent
],
providers: [
AppConfigService,
CardViewUpdateService,
LogService
CardViewUpdateService
]
}).compileComponents();
}));

View File

@ -25,7 +25,6 @@ import { By } from '@angular/platform-browser';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AppConfigService } from '../../../app-config/app-config.service';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
@ -71,8 +70,7 @@ describe('CardViewComponent', () => {
],
providers: [
CardItemTypeService,
CardViewUpdateService,
AppConfigService
CardViewUpdateService
]
});

View File

@ -17,7 +17,7 @@
import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule, ModuleWithProviders } from '@angular/core';
import { APP_INITIALIZER, NgModule, ModuleWithProviders } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
@ -75,6 +75,7 @@ import { TranslationService } from './services/translation.service';
import { UploadService } from './services/upload.service';
import { UserPreferencesService } from './services/user-preferences.service';
import { SearchConfigurationService } from './services/search-configuration.service';
import { startupServiceFactory } from './services/startup-service-factory';
export function createTranslateLoader(http: HttpClient, logService: LogService) {
return new TranslateLoaderService(http, logService);
@ -241,7 +242,15 @@ export class CoreModuleLazy {
TranslateModule
],
providers: [
...providers()
...providers(),
{
provide: APP_INITIALIZER,
useFactory: startupServiceFactory,
deps: [
AlfrescoApiService
],
multi: true
}
]
})
export class CoreModule {
@ -249,7 +258,15 @@ export class CoreModule {
return {
ngModule: CoreModule,
providers: [
...providers()
...providers(),
{
provide: APP_INITIALIZER,
useFactory: startupServiceFactory,
deps: [
AlfrescoApiService
],
multi: true
}
]
};
}

View File

@ -87,7 +87,6 @@ describe('NodeleteDirective', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TestComponent,
TestWithPermissionsComponent,

View File

@ -43,7 +43,6 @@ describe('NodeFavoriteDirective', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TestComponent
]

View File

@ -25,7 +25,6 @@ import { FormService } from './../../../services/form.service';
import { FormFieldModel } from './../core/form-field.model';
import { FormModel } from './../core/form.model';
import { DateTimeWidgetComponent } from './date-time.widget';
import { UserPreferencesService } from '../../../../services/user-preferences.service';
describe('DateTimeWidgetComponent', () => {
@ -44,7 +43,6 @@ describe('DateTimeWidgetComponent', () => {
],
providers: [
FormService,
UserPreferencesService,
EcmModelService,
ActivitiContentService
]

View File

@ -31,7 +31,6 @@ describe('WidgetComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
declarations: [WidgetComponent],
providers: [
FormService,

View File

@ -28,7 +28,6 @@ describe('EcmModelService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
EcmModelService
]

View File

@ -57,7 +57,6 @@ describe('Form service', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
EcmModelService,
FormService

View File

@ -28,7 +28,6 @@ describe('NodeService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
NodeService,
EcmModelService

View File

@ -66,7 +66,6 @@ describe('ProcessContentService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
ProcessContentService
]

View File

@ -37,7 +37,6 @@ describe('WidgetVisibilityService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
WidgetVisibilityService
]

View File

@ -31,8 +31,12 @@ const PipeModule = require('./pipes/pipe.module').PipeModule;
const AppConfigModule = require('./app-config/app-config.module').AppConfigModule;
const LogService = require('./services/log.service').LogService;
const TranslateLoaderService = require('./services/translate-loader.service').TranslateLoaderService;
const AppConfigService = require('@alfresco/adf-core').AppConfigService;
const AppConfigServiceMock = require('@alfresco/adf-core').AppConfigServiceMock;
const AppConfigService = require('./app-config/app-config.service').AppConfigService;
const AppConfigServiceMock = require('./mock/app-config.service.mock').AppConfigServiceMock;
const AlfrescoApiServiceMock = require('./mock/alfresco-api.service.mock').AlfrescoApiServiceMock;
const AlfrescoApiService = require('./services/alfresco-api.service').AlfrescoApiService;
const providers = require('./core.module').providers;
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
@ -61,7 +65,8 @@ beforeEach(() => {
HttpClientModule
],
providers: [
...providers(),
providers(),
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock}
]});
});

View File

@ -22,7 +22,6 @@ import { DirectiveModule } from '../directives/directive.module';
import { MaterialModule } from '../material.module';
import { AppConfigService } from '../app-config/app-config.service';
import { TranslateLoaderService } from '../services/translate-loader.service';
import { UserPreferencesService } from '../services/user-preferences.service';
import { LanguageMenuComponent } from './language-menu.component';
@ -49,8 +48,7 @@ describe('LanguageMenuComponent', () => {
LanguageMenuComponent
],
providers: [
AppConfigService,
UserPreferencesService
AppConfigService
]
}).compileComponents();
}));

View File

@ -0,0 +1,51 @@
/*!
* @license
* Copyright 2016 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 { Injectable } from '@angular/core';
import { AlfrescoApi } from 'alfresco-js-api';
import * as alfrescoApi from 'alfresco-js-api';
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);
this.initAlfrescoApi();
}
async reset() {
this.initAlfrescoApi();
}
protected initAlfrescoApi() {
this.alfrescoApi = <AlfrescoApi> new alfrescoApi({
provider: this.storage.getItem('AUTH_TYPE'),
ticketEcm: this.storage.getItem('ticket-ECM'),
ticketBpm: this.storage.getItem('ticket-BPM'),
hostEcm: this.appConfig.get<string>('ecmHost'),
hostBpm: this.appConfig.get<string>('bpmHost'),
contextRoot: 'alfresco',
disableCsrf: this.storage.getItem('DISABLE_CSRF') === 'true',
oauth2: this.appConfig.get<any>('oauth2')
});
}
}

View File

@ -27,6 +27,7 @@ export * from './event.mock';
export * from './renditionsService.mock';
export * from './search.service.mock';
export * from './traslation.service.mock';
export * from './alfresco-api.service.mock';
export * from './form/form.component.mock';
export * from './form/formDefinition.mock';

View File

@ -21,8 +21,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { Pagination } from 'alfresco-js-api';
import { MaterialModule } from '../material.module';
import { AppConfigService } from '../app-config/app-config.service';
import { LogService } from '../services/log.service';
import { TranslateLoaderService } from '../services/translate-loader.service';
import { TranslationService } from '../services/translation.service';
import { PaginationComponent } from './pagination.component';
@ -68,9 +66,7 @@ describe('PaginationComponent', () => {
PaginationComponent
],
providers: [
TranslationService,
LogService,
AppConfigService
TranslationService
],
schemas: [ NO_ERRORS_SCHEMA ]
}).compileComponents()

View File

@ -28,7 +28,7 @@ import { StorageService } from './storage.service';
@Injectable()
export class AlfrescoApiService {
private alfrescoApi: AlfrescoApi;
protected alfrescoApi: AlfrescoApi;
getInstance(): AlfrescoApi {
return this.alfrescoApi;
@ -74,13 +74,21 @@ export class AlfrescoApiService {
return this.getInstance().core.classesApi;
}
constructor(private appConfig: AppConfigService,
private storage: StorageService) {
this.reset();
constructor(protected appConfig: AppConfigService,
protected storage: StorageService) {
}
reset() {
async load() {
await this.appConfig.load().then(() => {
this.initAlfrescoApi();
});
}
async reset() {
this.initAlfrescoApi();
}
protected initAlfrescoApi() {
this.alfrescoApi = <AlfrescoApi> new alfrescoApi({
provider: this.storage.getItem('AUTH_TYPE'),
ticketEcm: this.storage.getItem('ticket-ECM'),
@ -89,7 +97,7 @@ export class AlfrescoApiService {
hostBpm: this.appConfig.get<string>('bpmHost'),
contextRoot: 'alfresco',
disableCsrf: this.storage.getItem('DISABLE_CSRF') === 'true',
oauth2 : this.appConfig.get<any>('oauth2')
oauth2: this.appConfig.get<any>('oauth2')
});
}
}

View File

@ -16,13 +16,8 @@
*/
import { TestBed } from '@angular/core/testing';
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
import { fakeApps } from '../mock/apps-service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AppsProcessService } from './apps-process.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
declare let jasmine: any;
describe('Apps Service', () => {
@ -32,11 +27,7 @@ describe('Apps Service', () => {
beforeEach((() => {
TestBed.configureTestingModule({
providers: [
AppsProcessService,
AlfrescoApiService,
StorageService,
LogService,
{provide: AppConfigService, useClass: AppConfigServiceMock}
AppsProcessService
]
}).compileComponents();
}));

View File

@ -19,17 +19,12 @@ import { async, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieServiceMock } from './../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthGuardBpm } from './auth-guard-bpm.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
import { RouterStateSnapshot, Router } from '@angular/router';
describe('AuthGuardService BPM', () => {
@ -53,13 +48,7 @@ describe('AuthGuardService BPM', () => {
],
providers: [
AuthGuardBpm,
SettingsService,
AlfrescoApiService,
AuthenticationService,
StorageService,
UserPreferencesService,
{ provide: CookieService, useClass: CookieServiceMock },
LogService
{ provide: CookieService, useClass: CookieServiceMock }
]
}).compileComponents();
}));

View File

@ -21,17 +21,12 @@ import { RouterTestingModule } from '@angular/router/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieServiceMock } from './../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthGuard } from './auth-guard.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
describe('AuthGuardService', () => {
let state;
@ -54,13 +49,8 @@ describe('AuthGuardService', () => {
],
providers: [
AuthGuard,
SettingsService,
AlfrescoApiService,
AuthenticationService,
UserPreferencesService,
StorageService,
{ provide: CookieService, useClass: CookieServiceMock },
LogService
{ provide: CookieService, useClass: CookieServiceMock }
]
}).compileComponents();
}));

View File

@ -19,11 +19,9 @@ import { async, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieServiceMock } from './../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
@ -49,13 +47,10 @@ describe('AuthenticationService', () => {
})
],
providers: [
SettingsService,
AlfrescoApiService,
AuthenticationService,
StorageService,
UserPreferencesService,
{ provide: CookieService, useClass: CookieServiceMock },
LogService
{ provide: CookieService, useClass: CookieServiceMock }
]
}).compileComponents();
}));

View File

@ -17,13 +17,9 @@
import { async, TestBed } from '@angular/core/testing';
import { CommentProcessModel } from '../models';
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
import { fakeProcessComment, fakeTasksComment, fakeUser1 } from '../mock/comment-process-service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { AppConfigService } from '../app-config/app-config.service';
import { CommentProcessService } from './comment-process.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { AlfrescoApiService } from './alfresco-api.service';
declare let jasmine: any;
describe('Comment ProcessService Service', () => {
@ -34,11 +30,7 @@ describe('Comment ProcessService Service', () => {
beforeEach((() => {
TestBed.configureTestingModule({
providers: [
CommentProcessService,
AlfrescoApiService,
StorageService,
LogService,
{provide: AppConfigService, useClass: AppConfigServiceMock}
CommentProcessService
]
}).compileComponents();
}));

View File

@ -18,14 +18,12 @@
import { async, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieServiceMock } from '../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
@ -55,14 +53,12 @@ describe('ContentService', () => {
],
declarations: [],
providers: [
AlfrescoApiService,
ContentService,
AuthenticationService,
SettingsService,
StorageService,
UserPreferencesService,
{provide: CookieService, useClass: CookieServiceMock},
LogService
{provide: CookieService, useClass: CookieServiceMock}
]
}).compileComponents();
}));

View File

@ -17,14 +17,9 @@
import { async, TestBed } from '@angular/core/testing';
import { BpmProductVersionModel, EcmProductVersionModel } from '../models/product-version.model';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { DiscoveryApiService } from './discovery-api.service';
import { StorageService } from './storage.service';
import { UserPreferencesService } from './user-preferences.service';
declare let jasmine: any;
@ -101,12 +96,7 @@ describe('Discovery Api Service', () => {
AppConfigModule
],
providers: [
DiscoveryApiService,
AlfrescoApiService,
UserPreferencesService,
AuthenticationService,
SettingsService,
StorageService
DiscoveryApiService
]
}).compileComponents();
}));

View File

@ -17,12 +17,7 @@
import { TestBed } from '@angular/core/testing';
import { UserProcessModel } from '../models';
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { AppConfigService } from '../app-config/app-config.service';
import { LogService } from './log.service';
import { PeopleProcessService } from './people-process.service';
import { StorageService } from './storage.service';
declare let jasmine: any;
@ -49,11 +44,7 @@ describe('PeopleProcessService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
PeopleProcessService,
AlfrescoApiService,
StorageService,
LogService,
{ provide: AppConfigService, useClass: AppConfigServiceMock }
PeopleProcessService
]
});
service = TestBed.get(PeopleProcessService);

View File

@ -17,12 +17,8 @@
import { async, TestBed } from '@angular/core/testing';
import { fakeRedition, fakeReditionCreated, fakeReditionsList } from '../mock/renditionsService.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { LogService } from './log.service';
import { RenditionsService } from './renditions.service';
import { StorageService } from './storage.service';
declare let jasmine: any;
@ -34,14 +30,8 @@ describe('RenditionsService', () => {
imports: [
AppConfigModule
],
declarations: [
],
providers: [
AlfrescoApiService,
RenditionsService,
SettingsService,
StorageService,
LogService
RenditionsService
]
}).compileComponents();
}));

View File

@ -20,15 +20,10 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { searchMockApi, mockError, fakeSearch } from '../mock/search.service.mock';
import { CookieServiceMock } from './../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { SearchService } from './search.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
describe('SearchService', () => {
@ -48,14 +43,7 @@ describe('SearchService', () => {
],
providers: [
SearchService,
AuthenticationService,
AlfrescoApiService,
SettingsService,
AuthenticationService,
StorageService,
UserPreferencesService,
{ provide: CookieService, useClass: CookieServiceMock },
LogService
{ provide: CookieService, useClass: CookieServiceMock }
]
}).compileComponents();
}));

View File

@ -17,13 +17,9 @@
import { async, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
describe('SettingsService', () => {
@ -41,11 +37,7 @@ describe('SettingsService', () => {
})
],
providers: [
AlfrescoApiService,
SettingsService,
UserPreferencesService,
StorageService,
LogService
SettingsService
]
}).compileComponents();
}));

View File

@ -17,16 +17,10 @@
import { async, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { LogService } from './log.service';
import { SitesService } from './sites.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
declare let jasmine: any;
@ -46,13 +40,7 @@ describe('Sites service', () => {
})
],
providers: [
SitesService,
AlfrescoApiService,
UserPreferencesService,
AuthenticationService,
SettingsService,
StorageService,
LogService
SitesService
]
}).compileComponents();
}));

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { AppConfigService } from './app-config.service';
import { AlfrescoApiService } from './alfresco-api.service';
export function startupServiceFactory(configService: AppConfigService): Function {
return () => configService.load();
export function startupServiceFactory(alfrescoApiService: AlfrescoApiService): Function {
return () => alfrescoApiService.load();
}

View File

@ -21,17 +21,10 @@ import { MatIconRegistry } from '@angular/material';
import { BrowserModule } from '@angular/platform-browser';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CookieServiceMock } from './../mock/cookie.service.mock';
import { AlfrescoApiService } from './alfresco-api.service';
import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { ThumbnailService } from './thumbnail.service';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
describe('ThumbnailService', () => {
@ -50,17 +43,9 @@ describe('ThumbnailService', () => {
})
],
providers: [
UserPreferencesService,
AuthenticationService,
ContentService,
SettingsService,
AppConfigService,
{ provide: CookieService, useClass: CookieServiceMock },
ThumbnailService,
AlfrescoApiService,
SettingsService,
StorageService,
LogService,
MatIconRegistry
]
}).compileComponents();

View File

@ -19,14 +19,9 @@ import { HttpClientModule } from '@angular/common/http';
import { Injector } from '@angular/core';
import { getTestBed, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AppConfigService } from '../app-config/app-config.service';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { TRANSLATION_PROVIDER, TranslationService } from './translation.service';
import { UserPreferencesService } from './user-preferences.service';
let componentJson1 = ' {"TEST": "This is a test", "TEST2": "This is another test"} ' ;
@ -50,11 +45,6 @@ describe('TranslateLoader', () => {
],
providers: [
TranslationService,
LogService,
AlfrescoApiService,
StorageService,
UserPreferencesService,
AppConfigService,
{
provide: TRANSLATION_PROVIDER,
multi: true,

View File

@ -20,13 +20,8 @@ import { Injector } from '@angular/core';
import { getTestBed, TestBed } from '@angular/core/testing';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { AppConfigService } from '../app-config/app-config.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
import { TranslateLoaderService } from './translate-loader.service';
import { TRANSLATION_PROVIDER, TranslationService } from './translation.service';
import { UserPreferencesService } from './user-preferences.service';
declare let jasmine: any;
@ -47,11 +42,6 @@ describe('TranslationService', () => {
],
providers: [
TranslationService,
LogService,
AlfrescoApiService,
StorageService,
UserPreferencesService,
AppConfigService,
{
provide: TRANSLATION_PROVIDER,
multi: true,

View File

@ -18,13 +18,9 @@
import { EventEmitter } from '@angular/core';
import { async, TestBed } from '@angular/core/testing';
import { FileModel, FileUploadOptions, FileUploadStatus } from '../models/file.model';
import { AlfrescoApiService } from './alfresco-api.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuthenticationService } from './authentication.service';
import { StorageService } from './storage.service';
import { UploadService } from './upload.service';
import { AppConfigService } from '../app-config/app-config.service';
declare let jasmine: any;
@ -37,11 +33,7 @@ describe('UploadService', () => {
AppConfigModule
],
providers: [
UploadService,
AlfrescoApiService,
SettingsService,
AuthenticationService,
StorageService
UploadService
]
}).compileComponents();
}));

View File

@ -10,6 +10,10 @@
.adf-toolbar {
&-title{
overflow: hidden;
}
.mat-toolbar {
min-height: $adf-toolbar-height;
border: 1px solid mat-color($foreground, text, .07);

View File

@ -16,7 +16,6 @@
*/
import { async, TestBed } from '@angular/core/testing';
import { AlfrescoApiService, LogService } from '../../services';
import { BpmUserModel } from '../models/bpm-user.model';
import { BpmUserService } from '../services/bpm-user.service';
@ -29,7 +28,7 @@ describe('Bpm user service', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
providers: [
AlfrescoApiService, LogService, BpmUserService
BpmUserService
]
}).compileComponents();
}));

View File

@ -17,10 +17,7 @@
import { SimpleChange } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { AuthenticationService } from '../../services/authentication.service';
import { ContentService } from '../../services/content.service';
import { SettingsService } from '../../services/settings.service';
import { MaterialModule } from '../../material.module';
import { ToolbarModule } from '../../toolbar/toolbar.module';
@ -44,12 +41,7 @@ describe('Test Img viewer component ', () => {
MaterialModule,
ToolbarModule
],
declarations: [ImgViewerComponent],
providers: [
SettingsService,
AuthenticationService,
AlfrescoApiService
]
declarations: [ImgViewerComponent]
}).compileComponents();
service = TestBed.get(ContentService);
}));

View File

@ -20,10 +20,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MediaPlayerComponent } from './mediaPlayer.component';
import {
AlfrescoApiService,
AuthenticationService,
ContentService,
SettingsService
ContentService
} from '../../services';
describe('Test Media player component ', () => {
@ -39,13 +36,7 @@ describe('Test Media player component ', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MediaPlayerComponent],
providers: [
SettingsService,
AuthenticationService,
AlfrescoApiService
]
declarations: [MediaPlayerComponent]
}).compileComponents();
service = TestBed.get(ContentService);
}));

View File

@ -17,11 +17,6 @@
import { Component, SimpleChange, ViewChild } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {
AlfrescoApiService,
AuthenticationService,
SettingsService
} from '../../services';
import { MaterialModule } from '../../material.module';
import { ToolbarModule } from '../../toolbar/toolbar.module';
import { EventMock } from '../../mock/event.mock';
@ -152,9 +147,6 @@ describe('Test PdfViewer component', () => {
}
}
},
SettingsService,
AuthenticationService,
AlfrescoApiService,
RenderingQueueServices
]
})

View File

@ -17,11 +17,6 @@
import { SimpleChange } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {
AlfrescoApiService,
AuthenticationService,
SettingsService
} from '../../services';
import { TxtViewerComponent } from './txtViewer.component';
describe('Text View component', () => {
@ -32,12 +27,7 @@ describe('Text View component', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [TxtViewerComponent],
providers: [
SettingsService,
AuthenticationService,
AlfrescoApiService
]
declarations: [TxtViewerComponent]
}).compileComponents();
}));

View File

@ -167,7 +167,6 @@ describe('ViewerComponent', () => {
return Observable.throw('throwed');
}
}},
AlfrescoApiService,
RenderingQueueServices,
{ provide: Location, useClass: SpyLocation }
]

View File

@ -41,8 +41,7 @@ describe('DiagramTooltipComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DiagramTooltipComponent ],
providers: []
declarations: [ DiagramTooltipComponent ]
}).compileComponents();
}));

View File

@ -24,6 +24,8 @@ const AppConfigService = require('@alfresco/adf-core').AppConfigService;
const AppConfigServiceMock = require('@alfresco/adf-core').AppConfigServiceMock;
const TranslationService = require('@alfresco/adf-core').TranslationService;
const TranslationMock = require('@alfresco/adf-core').TranslationMock;
const AlfrescoApiServiceMock = require('@alfresco/adf-core').AlfrescoApiServiceMock;
const AlfrescoApiService = require('@alfresco/adf-core').AlfrescoApiService;
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
@ -36,6 +38,7 @@ beforeEach(() => {
CoreModule.forRoot()
],
providers: [
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock},
{provide: TranslationService, useClass: TranslationMock}
]

View File

@ -71,7 +71,7 @@
"@mat-datetimepicker/core": "^1.0.1",
"@mat-datetimepicker/moment": "^1.0.1",
"@ngx-translate/core": "9.1.1",
"alfresco-js-api": "2.3.0-beta5",
"alfresco-js-api": "^2.3.0-7186e9787152f396d8c6c6dc191578ac486a1986",
"chart.js": "2.5.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",

View File

@ -40,8 +40,6 @@ describe('AppsListComponent', () => {
],
declarations: [
AppsListComponent
],
providers: [
]
}).compileComponents();

View File

@ -50,7 +50,6 @@ describe('CommentListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
CommentListComponent
],

View File

@ -25,8 +25,6 @@ import {
FormService,
ProcessContentService,
ActivitiContentService,
AlfrescoApiService,
LogService,
ThumbnailService,
SitesService,
FormFieldMetadata,
@ -110,8 +108,6 @@ describe('AttachFileWidgetComponent', () => {
ProcessContentService,
ThumbnailService,
ActivitiContentService,
AlfrescoApiService,
LogService,
SitesService,
DocumentListService,
ContentNodeDialogService,

View File

@ -22,8 +22,6 @@ import {
FormFieldModel,
FormModel,
FormService,
AlfrescoApiService,
LogService,
ThumbnailService,
SitesService,
NodesApiService
@ -62,8 +60,6 @@ describe('AttachFolderWidgetComponent', () => {
providers: [
FormService,
ThumbnailService,
AlfrescoApiService,
LogService,
SitesService,
DocumentListService,
ContentNodeDialogService,

View File

@ -29,6 +29,11 @@ const CommonModule = require('@angular/common').CommonModule;
const FormsModule = require('@angular/forms').FormsModule;
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;
const AlfrescoApiServiceMock = require('@alfresco/adf-core').AlfrescoApiServiceMock;
const AlfrescoApiService = require('@alfresco/adf-core').AlfrescoApiService;
console.log('AlfrescoApiServiceMock' + AlfrescoApiServiceMock);
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
beforeEach(() => {
@ -42,6 +47,7 @@ beforeEach(() => {
ReactiveFormsModule
],
providers: [
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock},
{provide: TranslationService, useClass: TranslationMock}
]

View File

@ -35,11 +35,8 @@ describe('PeopleListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
PeopleListComponent
],
providers: [
]
}).compileComponents().then(() => {

View File

@ -38,7 +38,6 @@ describe('ProcessInstanceTasksComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
declarations: [
ProcessInstanceTasksComponent
],

View File

@ -538,8 +538,7 @@ describe('CustomProcessListComponent', () => {
],
providers: [
ProcessService
],
imports: []
]
}).compileComponents();
}));

View File

@ -20,7 +20,7 @@ import { AlfrescoApi } from 'alfresco-js-api';
import { mockError, fakeProcessFilters } from '../../mock';
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
import { ProcessFilterService } from './process-filter.service';
import { AlfrescoApiService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, AlfrescoApiService, AppConfigService, StorageService } from '@alfresco/adf-core';
declare let jasmine: any;
@ -31,7 +31,7 @@ describe('Process filter', () => {
let alfrescoApi: AlfrescoApi;
beforeEach(() => {
apiService = new AlfrescoApiService(new AppConfigService(null), new StorageService() );
apiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() );
service = new ProcessFilterService(apiService);
alfrescoApi = apiService.getInstance();
});

View File

@ -22,7 +22,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, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigService, StorageService } from '@alfresco/adf-core';
declare let moment: any;
@ -33,7 +33,7 @@ describe('ProcessService', () => {
let alfrescoApi: AlfrescoApi;
beforeEach(() => {
apiService = new AlfrescoApiService(new AppConfigService(null), new StorageService() );
apiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() );
service = new ProcessService(apiService);
alfrescoApi = apiService.getInstance();
});

View File

@ -127,7 +127,6 @@ describe('TaskListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TaskListComponent
],
@ -659,8 +658,7 @@ describe('CustomTaskListComponent', () => {
],
providers: [
TaskListService
],
imports: []
]
}).compileComponents();
}));

View File

@ -29,7 +29,6 @@ describe('TaskStandaloneComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
TaskStandaloneComponent
],

View File

@ -23,7 +23,7 @@ import {
} from '../../mock';
import { FilterRepresentationModel } from '../models/filter.model';
import { TaskFilterService } from './task-filter.service';
import { AlfrescoApiService, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
declare let jasmine: any;
@ -31,7 +31,7 @@ describe('Activiti Task filter Service', () => {
let service: TaskFilterService;
beforeEach(async(() => {
service = new TaskFilterService(new AlfrescoApiService(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
service = new TaskFilterService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService()), new LogService(new AppConfigService(null)));
jasmine.Ajax.install();
}));

View File

@ -37,7 +37,7 @@ import {
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './tasklist.service';
import { AlfrescoApiService, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, LogService, AppConfigService, StorageService } from '@alfresco/adf-core';
declare let jasmine: any;
@ -46,7 +46,7 @@ describe('Activiti TaskList Service', () => {
let service: TaskListService;
beforeEach(async(() => {
service = new TaskListService(new AlfrescoApiService(new AppConfigService(null), new StorageService() ), new LogService(new AppConfigService(null)));
service = new TaskListService(new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() ), new LogService(new AppConfigService(null)));
jasmine.Ajax.install();
}));