Merge pull request #1401 from Alfresco/dev-denys-1152

LogService implementation
This commit is contained in:
Mario Romano
2017-01-06 14:39:55 +00:00
committed by GitHub
121 changed files with 1280 additions and 1221 deletions

View File

@@ -19,13 +19,13 @@ import { NgModule, Component, OnInit } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { CoreModule } from 'ng2-alfresco-core';
import { CoreModule, LogService } from 'ng2-alfresco-core';
import { SearchModule } from 'ng2-alfresco-search';
import {
SettingsService,
AuthService,
AlfrescoTranslationService
AlfrescoTranslateService
} from 'ng2-alfresco-core';
@Component({
@@ -50,16 +50,14 @@ import {
class SearchDemo implements OnInit {
authenticated: boolean;
public searchTerm: string = 'test';
public ecmHost: string = 'http://localhost:8080';
searchTerm: string = 'test';
ecmHost: string = 'http://localhost:8080';
ticket: string;
constructor(private authService: AuthService,
private settingsService: SettingsService,
translation: AlfrescoTranslationService) {
translation: AlfrescoTranslateService,
private logService: LogService) {
settingsService.ecmHost = this.ecmHost;
settingsService.setProviders('ECM');
@@ -79,18 +77,18 @@ class SearchDemo implements OnInit {
login() {
this.authService.login('admin', 'admin').subscribe(
ticket => {
console.log(ticket);
this.logService.info(ticket);
this.ticket = this.authService.getTicketEcm();
this.authenticated = true;
},
error => {
console.log(error);
this.logService.error(error);
this.authenticated = false;
});
}
searchTermChange(event) {
console.log('Search term changed', event);
this.logService.info('Search term changed', event);
this.searchTerm = event.value;
}
}

View File

@@ -28,10 +28,10 @@ import {
SettingsService,
AlfrescoApiService,
AuthService,
ContentService,
AlfrescoTranslateService,
CoreModule,
StorageService
StorageService,
LogService
} from 'ng2-alfresco-core';
describe('AlfrescoSearchComponent', () => {
@@ -102,18 +102,13 @@ describe('AlfrescoSearchComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule
CoreModule.forRoot()
],
declarations: [ AlfrescoSearchComponent ], // declare the test component
providers: [
AlfrescoSearchService,
{provide: AlfrescoTranslateService, useClass: TranslationMock},
AlfrescoThumbnailService,
SettingsService,
AlfrescoApiService,
AuthService,
ContentService,
StorageService
AlfrescoThumbnailService
]
}).compileComponents().then(() => {
fixture = TestBed.createComponent(AlfrescoSearchComponent);
@@ -123,9 +118,7 @@ describe('AlfrescoSearchComponent', () => {
}));
it('should not have a search term by default', () => {
let search = new AlfrescoSearchComponent(null, null, null, null);
expect(search).toBeDefined();
expect(search.searchTerm).toBe('');
expect(component.searchTerm).toBe('');
});
it('should take the provided search term from query param provided via RouteParams', () => {
@@ -144,6 +137,7 @@ describe('AlfrescoSearchComponent', () => {
SettingsService,
AlfrescoApiService,
StorageService,
LogService,
{ provide: ActivatedRoute, useValue: { params: Observable.from([{}]) } }
]);
let search = new AlfrescoSearchComponent(injector.get(AlfrescoSearchService), null, null, injector.get(ActivatedRoute));

View File

@@ -17,7 +17,7 @@
import { ReflectiveInjector } from '@angular/core';
import { AlfrescoSearchService } from './alfresco-search.service';
import { AuthService, SettingsService, AlfrescoApiService, StorageService } from 'ng2-alfresco-core';
import { AuthService, SettingsService, AlfrescoApiService, StorageService, LogService } from 'ng2-alfresco-core';
import { fakeApi, fakeSearch, fakeError } from '../assets/alfresco-search.service.mock';
declare let jasmine: any;
@@ -34,7 +34,8 @@ describe('AlfrescoSearchService', () => {
SettingsService,
AlfrescoApiService,
AuthService,
StorageService
StorageService,
LogService
]);
service = injector.get(AlfrescoSearchService);
apiService = injector.get(AlfrescoApiService);

View File

@@ -17,7 +17,7 @@
import { ReflectiveInjector } from '@angular/core';
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
import { AlfrescoApiService, AuthService, ContentService, SettingsService, StorageService } from 'ng2-alfresco-core';
import { AlfrescoApiService, AuthService, ContentService, SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
describe('AlfrescoThumbnailService', () => {
@@ -31,7 +31,8 @@ describe('AlfrescoThumbnailService', () => {
ContentService,
SettingsService,
AlfrescoThumbnailService,
StorageService
StorageService,
LogService
]);
service = injector.get(AlfrescoThumbnailService);