Remove deprecated use of getAlfrescoApi() #1094

remove getAlfrescoApi from auth #1094
This commit is contained in:
Eugenio Romano
2016-11-28 14:04:58 +00:00
parent eed6902428
commit d87a768d20
18 changed files with 73 additions and 74 deletions

View File

@@ -88,7 +88,7 @@ describe('AlfrescoAuthentication', () => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(authService.isLoggedIn()).toBe(true);
expect(authService.getTicketBpm()).toBeNull();
expect(authService.getAlfrescoApi().bpmAuth.isLoggedIn()).toBeFalsy();
expect(authService.alfrescoApi.bpmAuth.isLoggedIn()).toBeFalsy();
done();
});
@@ -187,7 +187,7 @@ describe('AlfrescoAuthentication', () => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(authService.isLoggedIn()).toBe(true);
expect(authService.getTicketEcm()).toBeNull();
expect(authService.getAlfrescoApi().ecmAuth.isLoggedIn()).toBeFalsy();
expect(authService.alfrescoApi.ecmAuth.isLoggedIn()).toBeFalsy();
done();
});
@@ -258,19 +258,19 @@ describe('AlfrescoAuthentication', () => {
it('should host ecm url change be reflected in the api configuration', () => {
settingsService.ecmHost = '127.99.99.99';
expect(authService.getAlfrescoApi().config.hostEcm).toBe('127.99.99.99');
expect(authService.alfrescoApi.config.hostEcm).toBe('127.99.99.99');
});
it('should host bpm url change be reflected in the api configuration', () => {
settingsService.bpmHost = '127.99.99.99';
expect(authService.getAlfrescoApi().config.hostBpm).toBe('127.99.99.99');
expect(authService.alfrescoApi.config.hostBpm).toBe('127.99.99.99');
});
it('should host bpm provider change be reflected in the api configuration', () => {
settingsService.setProviders('ECM');
expect(authService.getAlfrescoApi().config.provider).toBe('ECM');
expect(authService.alfrescoApi.config.provider).toBe('ECM');
});
});

View File

@@ -221,8 +221,4 @@ export class AlfrescoAuthenticationService {
console.error('Error when logging in', error);
return Observable.throw(error || 'Server error');
}
getAlfrescoApi(): any {
return this.alfrescoApi;
}
}

View File

@@ -18,11 +18,12 @@
import { Injectable } from '@angular/core';
import { AlfrescoAuthenticationService } from './AlfrescoAuthentication.service';
import { AlfrescoApiService } from './AlfrescoApi.service';
@Injectable()
export class AlfrescoContentService {
constructor(private authService: AlfrescoAuthenticationService) {
constructor(public authService: AlfrescoAuthenticationService, public apiService: AlfrescoApiService) {
}
/**
@@ -31,7 +32,7 @@ export class AlfrescoContentService {
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(document: any): string {
return this.authService.getAlfrescoApi().content.getDocumentThumbnailUrl(document.entry.id);
return this.apiService.getInstance().content.getDocumentThumbnailUrl(document.entry.id);
}
/**
@@ -40,6 +41,6 @@ export class AlfrescoContentService {
* @returns {string} URL address.
*/
getContentUrl(document: any): string {
return this.authService.getAlfrescoApi().content.getContentUrl(document.entry.id);
return this.apiService.getInstance().content.getContentUrl(document.entry.id);
}
}