mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-847] upgrade to use application configuration service (#1986)
* migrate core lib to use server-side app config * fix unit tests * update Search tests - update tests - upgrade tests to use TestBed * update UserInfo tests * update Social tests * update tests * update unit tests * cleanup old code * update about page * update demo shell readme * dev and prod configurations
This commit is contained in:
committed by
Eugenio Romano
parent
f5b94e1bb4
commit
d5f64fa9fc
@@ -1,14 +1,7 @@
|
|||||||
|
|
||||||
<h1 align="center">Alfresco Angular 2 Components</h1>
|
# ADF Demo Application
|
||||||
<p align="center">
|
|
||||||
<img title="alfresco" alt='alfresco' src='../assets/alfresco.png' width="280px" height="150px" ></img>
|
Please note that this application is not an official product, but a testing and demo application to showcase complex interactions for ADF components.
|
||||||
<img title="angular2" alt='angular2' src='../assets/angular2.png' width="150px" height="150px" ></img>
|
|
||||||
</p>
|
|
||||||
<p align="center">
|
|
||||||
<a href='https://github.com/mgechev/angular2-style-guide'>
|
|
||||||
<img src='https://mgechev.github.io/angular2-style-guide/images/badge.svg' alt='style' />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
@@ -20,6 +13,53 @@ cd alfresco-ng2-components/demo-shell-ng2/
|
|||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Proxy settings and CORS
|
||||||
|
|
||||||
|
To simplify development and reduce the time to get started the application features the following Proxy settings:
|
||||||
|
|
||||||
|
- **http://localhost:3000/ecm** is mapped to **http://localhost:8080**
|
||||||
|
- **http://localhost:3000/bpm** is mapped to **http://localhost:9999**
|
||||||
|
|
||||||
|
The settings above address most common scenarios for running ACS on port 8080 and APS on port 9999 and allow you to skip the CORS configuration.
|
||||||
|
|
||||||
|
If you would like to change default proxy settings, please edit the `config/webpack.common.js` file.
|
||||||
|
|
||||||
|
## Application settings (server-side)
|
||||||
|
|
||||||
|
All server-side application settings are stored in the `app.config-dev.json` and `app.config-prod.json` files.
|
||||||
|
By default the configuration files have the content similar to the following one:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"ecmHost": "http://localhost:3000/ecm",
|
||||||
|
"bpmHost": "http://localhost:3000/bpm",
|
||||||
|
"application": {
|
||||||
|
"name": "Alfresco"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can add any additional settings to the application configuration file if needed.
|
||||||
|
|
||||||
|
Configuration files are picked based on environment settings (see `app.module.ts` for more details).
|
||||||
|
|
||||||
|
```ts
|
||||||
|
let appConfigFile = 'app.config-dev.json';
|
||||||
|
if (process.env.ENV === 'production') {
|
||||||
|
appConfigFile = 'app.config-prod.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
...
|
||||||
|
CoreModule.forRoot({
|
||||||
|
appConfigFile: appConfigFile
|
||||||
|
}),
|
||||||
|
...
|
||||||
|
]
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Development build
|
## Development build
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -59,42 +99,3 @@ If you want to run the demo shell with the latest change from the development br
|
|||||||
./npm-clean.sh
|
./npm-clean.sh
|
||||||
./start-linked.sh -install
|
./start-linked.sh -install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Multi-language
|
|
||||||
To support a new language you need to create your language file (.json) and add it to `i18n/` folder.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"username" : "Username",
|
|
||||||
"input-required-message": "Required",
|
|
||||||
"input-min-message": "Your username needs to be at least 4 characters.",
|
|
||||||
"login-button": "Login"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Directory structure:
|
|
||||||
```
|
|
||||||
.
|
|
||||||
├── i18n/
|
|
||||||
│ ├── en.json
|
|
||||||
│ ├── it.json
|
|
||||||
│ └── fr.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## Custom-files
|
|
||||||
|
|
||||||
If you need to add custom files on your project you can add this files in the folders public
|
|
||||||
|
|
||||||
```
|
|
||||||
.
|
|
||||||
├── public/
|
|
||||||
│ ├── images/
|
|
||||||
│ ├── css/
|
|
||||||
│ └── js/
|
|
||||||
```
|
|
||||||
|
|
||||||
the public folder above wil be copied in the root of your project and you can refer to them for example as
|
|
||||||
|
|
||||||
* './images/custom_image.png'
|
|
||||||
* './js/custom_script.js'
|
|
||||||
* './css/custom_style.css'
|
|
||||||
|
7
demo-shell-ng2/app.config-prod.json
Normal file
7
demo-shell-ng2/app.config-prod.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ecmHost": "http://localhost:3000/ecm",
|
||||||
|
"bpmHost": "http://localhost:3000/bpm",
|
||||||
|
"application": {
|
||||||
|
"name": "Alfresco"
|
||||||
|
}
|
||||||
|
}
|
@@ -21,7 +21,6 @@
|
|||||||
<a class="mdl-navigation__link" data-automation-id="files" href="" routerLink="/files">DocumentList</a>
|
<a class="mdl-navigation__link" data-automation-id="files" href="" routerLink="/files">DocumentList</a>
|
||||||
<a class="mdl-navigation__link" data-automation-id="activiti" href="" routerLink="/activiti">Process Services</a>
|
<a class="mdl-navigation__link" data-automation-id="activiti" href="" routerLink="/activiti">Process Services</a>
|
||||||
<a class="mdl-navigation__link" data-automation-id="login" href="" routerLink="/login">Login</a>
|
<a class="mdl-navigation__link" data-automation-id="login" href="" routerLink="/login">Login</a>
|
||||||
<a class="mdl-navigation__link" data-automation-id="settings" href="" routerLink="/settings">Settings</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -60,7 +59,6 @@
|
|||||||
<a class="mdl-navigation__link" href="" routerLink="/tag" (click)="hideDrawer()">Tag</a>
|
<a class="mdl-navigation__link" href="" routerLink="/tag" (click)="hideDrawer()">Tag</a>
|
||||||
<a class="mdl-navigation__link" href="" routerLink="/social" (click)="hideDrawer()">Social</a>
|
<a class="mdl-navigation__link" href="" routerLink="/social" (click)="hideDrawer()">Social</a>
|
||||||
<a class="mdl-navigation__link" href="" routerLink="/about" (click)="hideDrawer()">About</a>
|
<a class="mdl-navigation__link" href="" routerLink="/about" (click)="hideDrawer()">About</a>
|
||||||
<a class="mdl-navigation__link" href="" routerLink="/settings" (click)="hideDrawer()">Settings</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<main class="mdl-layout__content" (dragover)="onDragOverMainPage($event)"
|
<main class="mdl-layout__content" (dragover)="onDragOverMainPage($event)"
|
||||||
|
@@ -35,17 +35,12 @@ declare var document: any;
|
|||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
searchTerm: string = '';
|
searchTerm: string = '';
|
||||||
|
|
||||||
ecmHost: string = `http://${window.location.hostname}` + (window.location.port ? `:${window.location.port}` : '') + `/ecm`;
|
|
||||||
bpmHost: string = `http://${window.location.hostname}` + (window.location.port ? `:${window.location.port}` : '') + `/bpm`;
|
|
||||||
|
|
||||||
constructor(private authService: AlfrescoAuthenticationService,
|
constructor(private authService: AlfrescoAuthenticationService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private settingsService: AlfrescoSettingsService,
|
private settingsService: AlfrescoSettingsService,
|
||||||
private translateService: AlfrescoTranslationService,
|
private translateService: AlfrescoTranslationService,
|
||||||
private storage: StorageService,
|
private storage: StorageService,
|
||||||
private logService: LogService) {
|
private logService: LogService) {
|
||||||
this.setEcmHost();
|
|
||||||
this.setBpmHost();
|
|
||||||
this.setProvider();
|
this.setProvider();
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
@@ -100,24 +95,6 @@ export class AppComponent {
|
|||||||
document.querySelector('.mdl-layout').MaterialLayout.toggleDrawer();
|
document.querySelector('.mdl-layout').MaterialLayout.toggleDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private setEcmHost() {
|
|
||||||
if (this.storage.hasItem(`ecmHost`)) {
|
|
||||||
this.settingsService.ecmHost = this.storage.getItem(`ecmHost`);
|
|
||||||
this.ecmHost = this.storage.getItem(`ecmHost`);
|
|
||||||
} else {
|
|
||||||
this.settingsService.ecmHost = this.ecmHost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private setBpmHost() {
|
|
||||||
if (this.storage.hasItem(`bpmHost`)) {
|
|
||||||
this.settingsService.bpmHost = this.storage.getItem(`bpmHost`);
|
|
||||||
this.bpmHost = this.storage.getItem(`bpmHost`);
|
|
||||||
} else {
|
|
||||||
this.settingsService.bpmHost = this.bpmHost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private setProvider() {
|
private setProvider() {
|
||||||
if (this.storage.hasItem(`providers`)) {
|
if (this.storage.hasItem(`providers`)) {
|
||||||
this.settingsService.setProviders(this.storage.getItem(`providers`));
|
this.settingsService.setProviders(this.storage.getItem(`providers`));
|
||||||
|
@@ -58,15 +58,21 @@ import {
|
|||||||
SocialComponent,
|
SocialComponent,
|
||||||
AboutComponent,
|
AboutComponent,
|
||||||
FilesComponent,
|
FilesComponent,
|
||||||
FormNodeViewer,
|
FormNodeViewer
|
||||||
SettingComponent
|
|
||||||
} from './components/index';
|
} from './components/index';
|
||||||
|
|
||||||
|
let appConfigFile = 'app.config-dev.json';
|
||||||
|
if (process.env.ENV === 'production') {
|
||||||
|
appConfigFile = 'app.config-prod.json';
|
||||||
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
routing,
|
routing,
|
||||||
CoreModule.forRoot(),
|
CoreModule.forRoot({
|
||||||
|
appConfigFile: appConfigFile
|
||||||
|
}),
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
LoginModule.forRoot(),
|
LoginModule.forRoot(),
|
||||||
SearchModule.forRoot(),
|
SearchModule.forRoot(),
|
||||||
@@ -104,7 +110,6 @@ import {
|
|||||||
AboutComponent,
|
AboutComponent,
|
||||||
FilesComponent,
|
FilesComponent,
|
||||||
FormNodeViewer,
|
FormNodeViewer,
|
||||||
SettingComponent,
|
|
||||||
CreateFolderDialog
|
CreateFolderDialog
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
|
@@ -33,8 +33,7 @@ import {
|
|||||||
SocialComponent,
|
SocialComponent,
|
||||||
AboutComponent,
|
AboutComponent,
|
||||||
FormViewer,
|
FormViewer,
|
||||||
FormNodeViewer,
|
FormNodeViewer
|
||||||
SettingComponent
|
|
||||||
} from './components/index';
|
} from './components/index';
|
||||||
|
|
||||||
import { UploadButtonComponent } from 'ng2-alfresco-upload';
|
import { UploadButtonComponent } from 'ng2-alfresco-upload';
|
||||||
@@ -129,8 +128,7 @@ export const appRoutes: Routes = [
|
|||||||
component: SocialComponent,
|
component: SocialComponent,
|
||||||
canActivate: [AuthGuardEcm]
|
canActivate: [AuthGuardEcm]
|
||||||
},
|
},
|
||||||
{ path: 'about', component: AboutComponent },
|
{ path: 'about', component: AboutComponent }
|
||||||
{ path: 'settings', component: SettingComponent }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
|
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
|
||||||
|
@@ -1,10 +1,25 @@
|
|||||||
<div class="about-container">
|
<div class="about-container">
|
||||||
|
|
||||||
|
<h3>Server settings</h3>
|
||||||
|
<small>The values below are taken from the AppConfigService and loaded from the '{{ configFile }}' file.</small>
|
||||||
|
<div>
|
||||||
|
Alfresco Process Services URL: <strong>{{ bpmHost }}</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Alfresco Content Services URL: <strong>{{ ecmHost }}</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="githubUrlCommitAlpha">
|
<div *ngIf="githubUrlCommitAlpha">
|
||||||
<h3>Current Commit position</h3>
|
<h3>Source code</h3>
|
||||||
|
<small>You are running the project based on the following commit:</small>
|
||||||
|
<div>
|
||||||
<a [href]="githubUrlCommitAlpha">{{githubUrlCommitAlpha}}</a>
|
<a [href]="githubUrlCommitAlpha">{{githubUrlCommitAlpha}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h3>Packages</h3>
|
<h3>Packages</h3>
|
||||||
|
<small>Current project is using the following ADF libraries:</small>
|
||||||
<alfresco-datatable [data]="data"></alfresco-datatable>
|
<alfresco-datatable [data]="data"></alfresco-datatable>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||||
import { LogService } from 'ng2-alfresco-core';
|
import { LogService, AppConfigService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'about-page',
|
selector: 'about-page',
|
||||||
@@ -28,10 +28,14 @@ import { LogService } from 'ng2-alfresco-core';
|
|||||||
export class AboutComponent implements OnInit {
|
export class AboutComponent implements OnInit {
|
||||||
|
|
||||||
data: ObjectDataTableAdapter;
|
data: ObjectDataTableAdapter;
|
||||||
|
|
||||||
githubUrlCommitAlpha: string = 'https://github.com/Alfresco/alfresco-ng2-components/commits/';
|
githubUrlCommitAlpha: string = 'https://github.com/Alfresco/alfresco-ng2-components/commits/';
|
||||||
|
|
||||||
|
configFile: string = '';
|
||||||
|
ecmHost: string = '';
|
||||||
|
bpmHost: string = '';
|
||||||
|
|
||||||
constructor(private http: Http,
|
constructor(private http: Http,
|
||||||
|
private appConfig: AppConfigService,
|
||||||
private logService: LogService) {
|
private logService: LogService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +66,10 @@ export class AboutComponent implements OnInit {
|
|||||||
{type: 'text', key: 'version', title: 'Version', sortable: true}
|
{type: 'text', key: 'version', title: 'Version', sortable: true}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.configFile = this.appConfig.configFile;
|
||||||
|
this.ecmHost = this.appConfig.get<string>('ecmHost');
|
||||||
|
this.bpmHost = this.appConfig.get<string>('bpmHost');
|
||||||
}
|
}
|
||||||
|
|
||||||
private gitHubLinkCreation(alfrescoPackagesTableRepresentation): void {
|
private gitHubLinkCreation(alfrescoPackagesTableRepresentation): void {
|
||||||
|
@@ -29,5 +29,4 @@ export { SocialComponent } from './social/social.component';
|
|||||||
export { AboutComponent } from './about/about.component';
|
export { AboutComponent } from './about/about.component';
|
||||||
export { FilesComponent } from './files/files.component';
|
export { FilesComponent } from './files/files.component';
|
||||||
export { FormNodeViewer } from './activiti/form-node-viewer.component';
|
export { FormNodeViewer } from './activiti/form-node-viewer.component';
|
||||||
export { SettingComponent } from './setting/setting.component';
|
|
||||||
export { ActivitiAppsView } from './activiti/apps.view';
|
export { ActivitiAppsView } from './activiti/apps.view';
|
||||||
|
@@ -23,16 +23,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--SETTING BUTTON-->
|
|
||||||
|
|
||||||
<a class="mdl-navigation__link setting-button" data-automation-id="settings" href="" routerLink="/settings">
|
|
||||||
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored">
|
|
||||||
<i class="material-icons">settings</i>
|
|
||||||
</button>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!--LOGIN-->
|
|
||||||
|
|
||||||
<alfresco-login #alfrescologin
|
<alfresco-login #alfrescologin
|
||||||
[providers]="providers"
|
[providers]="providers"
|
||||||
[fieldsValidation]="customValidation"
|
[fieldsValidation]="customValidation"
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
.setting-card.mdl-card {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting-card > .mdl-card__title {
|
|
||||||
color: #fff;
|
|
||||||
background: bottom right 15% no-repeat #1fbcd2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting-card-padding {
|
|
||||||
width: 50%;
|
|
||||||
display: table-cell;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting-container {
|
|
||||||
display: table;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-spacing: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-margin {
|
|
||||||
margin-right: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-row {
|
|
||||||
display: table-row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-setting-input-padding {
|
|
||||||
padding-top: 0px !important;
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
<div class="setting-container">
|
|
||||||
<div class="table-row">
|
|
||||||
<div class="setting-card-padding"></div>
|
|
||||||
<div class="setting-card mdl-card mdl-shadow--2dp">
|
|
||||||
<div class="mdl-card__title mdl-card--expand">
|
|
||||||
<h2 class="mdl-card__title-text">SETTINGS</h2>
|
|
||||||
</div>
|
|
||||||
<div class="mdl-card__actions mdl-card--border">
|
|
||||||
<div class="mdl-card__supporting-text">
|
|
||||||
Content Services host URL configuration
|
|
||||||
</div>
|
|
||||||
<nav class="mdl-navigation">
|
|
||||||
<i class="icon material-icons icon-margin">link</i>
|
|
||||||
<div class="mdl-textfield mdl-js-textfield adf-setting-input-padding">
|
|
||||||
<input data-automation-id="ecmHost"
|
|
||||||
class="mdl-textfield__input" tabindex="1"
|
|
||||||
type="text" tabindex="1"
|
|
||||||
(change)="onChangeECMHost($event)"
|
|
||||||
pattern="^(http|https):\/\/.*" id="ecmHost" value="{{ecmHost}}">
|
|
||||||
<label class="mdl-textfield__label" for="ecmHost">ECM Host</label>
|
|
||||||
<span class="mdl-textfield__error">ECM host is not valid!</span>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="mdl-card__supporting-text">
|
|
||||||
Process Services host URL configuration
|
|
||||||
</div>
|
|
||||||
<nav class="mdl-navigation">
|
|
||||||
<i class="icon material-icons icon-margin">link</i>
|
|
||||||
<div class="mdl-textfield mdl-js-textfield adf-setting-input-padding">
|
|
||||||
<input class="mdl-textfield__input"
|
|
||||||
type="text"
|
|
||||||
(change)="onChangeBPMHost($event)"
|
|
||||||
tabindex="2" pattern="^(http|https):\/\/.*" id="bpmHost" value="{{bpmHost}}">
|
|
||||||
<label class="mdl-textfield__label" for="bpmHost">BPM Host</label>
|
|
||||||
<span class="mdl-textfield__error">BPM host is not valid!</span>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
<div class="mdl-card__actions mdl-card--border">
|
|
||||||
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" onclick="window.history.back()" >
|
|
||||||
Back
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="setting-card-padding"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,75 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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 { Component, AfterViewChecked } from '@angular/core';
|
|
||||||
import { AlfrescoSettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
|
||||||
|
|
||||||
declare var componentHandler: any;
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'alfresco-setting-demo',
|
|
||||||
templateUrl: './setting.component.html',
|
|
||||||
styleUrls: ['./setting.component.css']
|
|
||||||
})
|
|
||||||
export class SettingComponent implements AfterViewChecked {
|
|
||||||
|
|
||||||
ecmHost: string;
|
|
||||||
bpmHost: string;
|
|
||||||
|
|
||||||
constructor(private settingsService: AlfrescoSettingsService,
|
|
||||||
private storage: StorageService,
|
|
||||||
private logService: LogService) {
|
|
||||||
this.ecmHost = this.settingsService.ecmHost;
|
|
||||||
this.bpmHost = this.settingsService.bpmHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewChecked() {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public onChangeECMHost(event: KeyboardEvent): void {
|
|
||||||
let value = (<HTMLInputElement>event.target).value.trim();
|
|
||||||
if (value && this.isValidUrl(value)) {
|
|
||||||
this.logService.info(`ECM host: ${value}`);
|
|
||||||
this.ecmHost = value;
|
|
||||||
this.settingsService.ecmHost = value;
|
|
||||||
this.storage.setItem(`ecmHost`, value);
|
|
||||||
} else {
|
|
||||||
console.error('Ecm address does not match the pattern');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public onChangeBPMHost(event: KeyboardEvent): void {
|
|
||||||
let value = (<HTMLInputElement>event.target).value.trim();
|
|
||||||
if (value && this.isValidUrl(value)) {
|
|
||||||
this.logService.info(`BPM host: ${value}`);
|
|
||||||
this.bpmHost = value;
|
|
||||||
this.settingsService.bpmHost = value;
|
|
||||||
this.storage.setItem(`bpmHost`, value);
|
|
||||||
} else {
|
|
||||||
console.error('Bpm address does not match the pattern');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isValidUrl(url: string) {
|
|
||||||
return /^(http|https):\/\/.*/.test(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -102,7 +102,10 @@ module.exports = {
|
|||||||
to: 'resources/i18n'
|
to: 'resources/i18n'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: 'app.config.json'
|
from: 'app.config-dev.json'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'app.config-prod.json'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: 'favicon-96x96.png'
|
from: 'favicon-96x96.png'
|
||||||
|
@@ -90,7 +90,7 @@ describe('AnalyticsReportListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return the default reports when the report list is empty', (done) => {
|
it('should return the default reports when the report list is empty', (done) => {
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/reports').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/reports').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: []
|
responseText: []
|
||||||
@@ -98,13 +98,13 @@ describe('AnalyticsReportListComponent', () => {
|
|||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/default-reports').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/default-reports').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: []
|
responseText: []
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/reports').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/reports').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: reportList
|
responseText: reportList
|
||||||
|
@@ -295,13 +295,13 @@ describe('AnalyticsReportParametersComponent', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDef
|
responseText: analyticParamsMock.reportDefParamProcessDef
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/process-definitions').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/process-definitions').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDefOptionsNoApp
|
responseText: analyticParamsMock.reportDefParamProcessDefOptionsNoApp
|
||||||
@@ -326,7 +326,7 @@ describe('AnalyticsReportParametersComponent', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDef
|
responseText: analyticParamsMock.reportDefParamProcessDef
|
||||||
@@ -334,7 +334,7 @@ describe('AnalyticsReportParametersComponent', () => {
|
|||||||
|
|
||||||
let appId = '1';
|
let appId = '1';
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/api/enterprise/process-definitions?appDefinitionId=' + appId).andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/api/enterprise/process-definitions?appDefinitionId=' + appId).andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDefOptionsApp
|
responseText: analyticParamsMock.reportDefParamProcessDefOptionsApp
|
||||||
@@ -392,13 +392,13 @@ describe('AnalyticsReportParametersComponent', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDef
|
responseText: analyticParamsMock.reportDefParamProcessDef
|
||||||
});
|
});
|
||||||
|
|
||||||
jasmine.Ajax.stubRequest('http://localhost:9999/activiti-app/app/rest/reporting/process-definitions').andReturn({
|
jasmine.Ajax.stubRequest('http://localhost:3000/bpm/activiti-app/app/rest/reporting/process-definitions').andReturn({
|
||||||
status: 404,
|
status: 404,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: []
|
responseText: []
|
||||||
|
@@ -30,7 +30,7 @@ export class DiagramsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
|
||||||
let url = `${this.settingsService.getBPMApiBaseUrl()}/app/rest/process-definitions/${processDefinitionId}/model-json`;
|
let url = `${this.settingsService.bpmHost}/activiti-app/app/rest/process-definitions/${processDefinitionId}/model-json`;
|
||||||
let options = this.getRequestOptions();
|
let options = this.getRequestOptions();
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, options)
|
.get(url, options)
|
||||||
@@ -41,7 +41,7 @@ export class DiagramsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRunningProcessDefinitionModel(processInstanceId: string): Observable<any> {
|
getRunningProcessDefinitionModel(processInstanceId: string): Observable<any> {
|
||||||
let url = `${this.settingsService.getBPMApiBaseUrl()}/app/rest/process-instances/${processInstanceId}/model-json`;
|
let url = `${this.settingsService.bpmHost}/activiti-app/app/rest/process-instances/${processInstanceId}/model-json`;
|
||||||
let options = this.getRequestOptions();
|
let options = this.getRequestOptions();
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, options)
|
.get(url, options)
|
||||||
|
@@ -15,14 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import {
|
import { CoreModule, AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { FormService } from './form.service';
|
import { FormService } from './form.service';
|
||||||
import { Response, ResponseOptions } from '@angular/http';
|
import { Response, ResponseOptions } from '@angular/http';
|
||||||
@@ -69,24 +63,26 @@ function createFakeBlob() {
|
|||||||
|
|
||||||
describe('Form service', () => {
|
describe('Form service', () => {
|
||||||
|
|
||||||
let service, injector, apiService, logService;
|
let service: FormService;
|
||||||
|
let apiService: AlfrescoApiService;
|
||||||
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
AlfrescoSettingsService,
|
imports: [
|
||||||
AlfrescoApiService,
|
CoreModule
|
||||||
AlfrescoAuthenticationService,
|
],
|
||||||
|
providers: [
|
||||||
EcmModelService,
|
EcmModelService,
|
||||||
StorageService,
|
FormService
|
||||||
FormService,
|
]
|
||||||
LogService
|
}).compileComponents();
|
||||||
]);
|
}));
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
service = injector.get(FormService);
|
service = TestBed.get(FormService);
|
||||||
apiService = injector.get(AlfrescoApiService);
|
apiService = TestBed.get(AlfrescoApiService);
|
||||||
logService = injector.get(LogService);
|
logService = TestBed.get(LogService);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -530,7 +526,7 @@ describe('Form service', () => {
|
|||||||
|
|
||||||
function stubCreateForm() {
|
function stubCreateForm() {
|
||||||
jasmine.Ajax.stubRequest(
|
jasmine.Ajax.stubRequest(
|
||||||
'http://localhost:9999/activiti-app/api/enterprise/models'
|
'http://localhost:3000/bpm/activiti-app/api/enterprise/models'
|
||||||
).andReturn({
|
).andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: 'HTTP/1.1 200 OK',
|
statusText: 'HTTP/1.1 200 OK',
|
||||||
@@ -541,7 +537,7 @@ describe('Form service', () => {
|
|||||||
|
|
||||||
function stubGetEcmModel() {
|
function stubGetEcmModel() {
|
||||||
jasmine.Ajax.stubRequest(
|
jasmine.Ajax.stubRequest(
|
||||||
'http://localhost:8080/alfresco/api/-default-/private/alfresco/versions/1/cmm/activitiFormsModel/types'
|
'http://localhost:3000/ecm/alfresco/api/-default-/private/alfresco/versions/1/cmm/activitiFormsModel/types'
|
||||||
).andReturn({
|
).andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: 'HTTP/1.1 200 OK',
|
statusText: 'HTTP/1.1 200 OK',
|
||||||
@@ -562,7 +558,7 @@ describe('Form service', () => {
|
|||||||
|
|
||||||
function stubAddFieldsToAForm() {
|
function stubAddFieldsToAForm() {
|
||||||
jasmine.Ajax.stubRequest(
|
jasmine.Ajax.stubRequest(
|
||||||
'http://localhost:9999/activiti-app/api/enterprise/editor/form-models/' + formId
|
'http://localhost:3000/bpm/activiti-app/api/enterprise/editor/form-models/' + formId
|
||||||
).andReturn({
|
).andReturn({
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: 'HTTP/1.1 200 OK',
|
statusText: 'HTTP/1.1 200 OK',
|
||||||
|
@@ -15,21 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { async } from '@angular/core/testing';
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
import {
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { ActivitiTaskListService } from './activiti-tasklist.service';
|
import { ActivitiTaskListService } from './activiti-tasklist.service';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import {
|
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||||
FilterRepresentationModel,
|
|
||||||
TaskQueryRequestRepresentationModel
|
|
||||||
} from '../models/filter.model';
|
|
||||||
import { Comment } from '../models/comment.model';
|
import { Comment } from '../models/comment.model';
|
||||||
import {
|
import {
|
||||||
fakeFilters,
|
fakeFilters,
|
||||||
@@ -56,21 +46,20 @@ declare let jasmine: any;
|
|||||||
describe('Activiti TaskList Service', () => {
|
describe('Activiti TaskList Service', () => {
|
||||||
|
|
||||||
let service: ActivitiTaskListService;
|
let service: ActivitiTaskListService;
|
||||||
let injector;
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
ActivitiTaskListService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(ActivitiTaskListService);
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
ActivitiTaskListService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = injector.get(ActivitiTaskListService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
- [Prerequisites](#prerequisites)
|
- [Prerequisites](#prerequisites)
|
||||||
- [Install](#install)
|
- [Install](#install)
|
||||||
- [Library content](#library-content)
|
|
||||||
- [Toolbar Component](#toolbar-component)
|
- [Toolbar Component](#toolbar-component)
|
||||||
* [Properties](#properties)
|
* [Properties](#properties)
|
||||||
- [Upload Directive](#upload-directive)
|
- [Upload Directive](#upload-directive)
|
||||||
@@ -52,24 +51,6 @@ necessary configuration, see this [page](https://github.com/Alfresco/alfresco-ng
|
|||||||
npm install ng2-alfresco-core
|
npm install ng2-alfresco-core
|
||||||
```
|
```
|
||||||
|
|
||||||
## Library content
|
|
||||||
|
|
||||||
- Components
|
|
||||||
- [Toolbar](#toolbar-component)
|
|
||||||
- [Accordion](#accordion-component)
|
|
||||||
- Directives
|
|
||||||
- [Upload](#upload-directive)
|
|
||||||
- [Context Menu](#context-menu-directive)
|
|
||||||
- Services
|
|
||||||
- [AppConfigService](#appconfigservice), application configuration
|
|
||||||
- **LogService**, log service implementation
|
|
||||||
- [NotificationService](#notification-service), Notification service implementation
|
|
||||||
- [AlfrescoApiService](#alfresco-api-service), provides access to Alfresco JS API instance
|
|
||||||
- [AlfrescoAuthenticationService](#authentication-service), main authentication APIs
|
|
||||||
- [AlfrescoTranslationService](#alfrescotranslationservice), various i18n-related APIs
|
|
||||||
- **ContextMenuService**, global context menu APIs
|
|
||||||
- [Renditions Service](#renditions-service)
|
|
||||||
|
|
||||||
## Toolbar Component
|
## Toolbar Component
|
||||||
|
|
||||||
```html
|
```html
|
||||||
@@ -350,6 +331,28 @@ export class AppComponent {
|
|||||||
You custom components can also benefit from the `AppConfigService`,
|
You custom components can also benefit from the `AppConfigService`,
|
||||||
you can put an unlimited number of settings and optionally a nested JSON hierarchy.
|
you can put an unlimited number of settings and optionally a nested JSON hierarchy.
|
||||||
|
|
||||||
|
### Different configurations based on environment settings
|
||||||
|
|
||||||
|
The CoreModule allows you to provide custom application configuration path.
|
||||||
|
That means you can evaluate the final file name based on conditions, for example environment settings:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
let appConfigFile = 'app.config-dev.json';
|
||||||
|
if (process.env.ENV === 'production') {
|
||||||
|
appConfigFile = 'app.config-prod.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
...
|
||||||
|
CoreModule.forRoot({
|
||||||
|
appConfigFile: appConfigFile
|
||||||
|
}),
|
||||||
|
...
|
||||||
|
]
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Notification Service
|
## Notification Service
|
||||||
|
|
||||||
The Notification Service is implemented on top of the Angular 2 Material Design snackbar.
|
The Notification Service is implemented on top of the Angular 2 Material Design snackbar.
|
||||||
|
@@ -19,54 +19,29 @@ import { Injectable } from '@angular/core';
|
|||||||
import { AlfrescoApi } from 'alfresco-js-api';
|
import { AlfrescoApi } from 'alfresco-js-api';
|
||||||
import * as alfrescoApi from 'alfresco-js-api';
|
import * as alfrescoApi from 'alfresco-js-api';
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
|
import { AppConfigService } from './app-config.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoApiService {
|
export class AlfrescoApiService {
|
||||||
|
|
||||||
private alfrescoApi: AlfrescoApi;
|
private alfrescoApi: AlfrescoApi;
|
||||||
|
|
||||||
private provider: string;
|
private provider: string;
|
||||||
|
|
||||||
private ticketEcm: string;
|
|
||||||
|
|
||||||
private ticketBpm: string;
|
|
||||||
|
|
||||||
private hostEcm: string;
|
|
||||||
|
|
||||||
private hostBpm: string;
|
|
||||||
|
|
||||||
private contextRoot: string;
|
|
||||||
|
|
||||||
private disableCsrf: boolean;
|
private disableCsrf: boolean;
|
||||||
|
|
||||||
public getInstance(): AlfrescoApi {
|
public getInstance(): AlfrescoApi {
|
||||||
return this.alfrescoApi;
|
return this.alfrescoApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private settingsService: AlfrescoSettingsService,
|
constructor(private appConfig: AppConfigService,
|
||||||
|
private settingsService: AlfrescoSettingsService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService) {
|
||||||
|
|
||||||
this.provider = this.settingsService.getProviders();
|
this.provider = this.settingsService.getProviders();
|
||||||
this.ticketEcm = this.getTicketEcm();
|
|
||||||
this.ticketBpm = this.getTicketBpm();
|
|
||||||
this.hostEcm = this.settingsService.ecmHost;
|
|
||||||
this.hostBpm = this.settingsService.bpmHost;
|
|
||||||
this.contextRoot = 'alfresco';
|
|
||||||
this.disableCsrf = false;
|
this.disableCsrf = false;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
settingsService.bpmHostSubject.subscribe((hostBpm) => {
|
|
||||||
this.hostBpm = hostBpm;
|
|
||||||
this.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
settingsService.ecmHostSubject.subscribe((hostEcm) => {
|
|
||||||
this.hostEcm = hostEcm;
|
|
||||||
this.init();
|
|
||||||
});
|
|
||||||
|
|
||||||
settingsService.csrfSubject.subscribe((disableCsrf) => {
|
settingsService.csrfSubject.subscribe((disableCsrf) => {
|
||||||
this.disableCsrf = disableCsrf;
|
this.disableCsrf = disableCsrf;
|
||||||
this.init();
|
this.init();
|
||||||
@@ -81,29 +56,12 @@ export class AlfrescoApiService {
|
|||||||
private init() {
|
private init() {
|
||||||
this.alfrescoApi = <AlfrescoApi>new alfrescoApi({
|
this.alfrescoApi = <AlfrescoApi>new alfrescoApi({
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
ticketEcm: this.ticketEcm,
|
ticketEcm: this.storage.getItem('ticket-ECM'),
|
||||||
ticketBpm: this.ticketBpm,
|
ticketBpm: this.storage.getItem('ticket-BPM'),
|
||||||
hostEcm: this.hostEcm,
|
hostEcm: this.appConfig.get<string>('ecmHost'),
|
||||||
hostBpm: this.hostBpm,
|
hostBpm: this.appConfig.get<string>('bpmHost'),
|
||||||
contextRoot: this.contextRoot,
|
contextRoot: 'alfresco',
|
||||||
disableCsrf: this.disableCsrf
|
disableCsrf: this.disableCsrf
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The method return the ECM ticket stored in the Storage
|
|
||||||
* @returns ticket
|
|
||||||
*/
|
|
||||||
private getTicketEcm(): string {
|
|
||||||
return this.storage.getItem('ticket-ECM');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The method return the BPM ticket stored in the Storage
|
|
||||||
* @returns ticket
|
|
||||||
*/
|
|
||||||
private getTicketBpm(): string {
|
|
||||||
return this.storage.getItem('ticket-BPM');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@@ -23,30 +23,39 @@ import { StorageService } from './storage.service';
|
|||||||
import { CookieService } from './cookie.service';
|
import { CookieService } from './cookie.service';
|
||||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
|
import { AppConfigModule } from './app-config.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('AlfrescoAuthenticationService', () => {
|
describe('AlfrescoAuthenticationService', () => {
|
||||||
let injector;
|
let apiService: AlfrescoApiService;
|
||||||
let authService: AlfrescoAuthenticationService;
|
let authService: AlfrescoAuthenticationService;
|
||||||
let settingsService: AlfrescoSettingsService;
|
let settingsService: AlfrescoSettingsService;
|
||||||
let storage: StorageService;
|
let storage: StorageService;
|
||||||
let cookie: CookieService;
|
let cookie: CookieService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AppConfigModule
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService,
|
||||||
StorageService,
|
StorageService,
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
LogService
|
LogService
|
||||||
]);
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
authService = injector.get(AlfrescoAuthenticationService);
|
beforeEach(() => {
|
||||||
settingsService = injector.get(AlfrescoSettingsService);
|
apiService = TestBed.get(AlfrescoApiService);
|
||||||
cookie = injector.get(CookieService);
|
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||||
storage = injector.get(StorageService);
|
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||||
|
cookie = TestBed.get(CookieService);
|
||||||
|
storage = TestBed.get(StorageService);
|
||||||
storage.clear();
|
storage.clear();
|
||||||
|
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
@@ -350,32 +359,6 @@ describe('AlfrescoAuthenticationService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Setting service change should reflect in the api', () => {
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
settingsService.setProviders('ALL');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should host ecm url change be reflected in the api configuration', () => {
|
|
||||||
settingsService.ecmHost = '127.99.99.99';
|
|
||||||
|
|
||||||
expect(authService.alfrescoApi.getInstance().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.alfrescoApi.getInstance().config.hostBpm).toBe('127.99.99.99');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should host bpm provider change be reflected in the api configuration', () => {
|
|
||||||
settingsService.setProviders('ECM');
|
|
||||||
|
|
||||||
expect(authService.alfrescoApi.getInstance().config.provider).toBe('ECM');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the setting is both ECM and BPM ', () => {
|
describe('when the setting is both ECM and BPM ', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||||
import { AlfrescoContentService } from './alfresco-content.service';
|
import { AlfrescoContentService } from './alfresco-content.service';
|
||||||
@@ -24,12 +24,13 @@ import { StorageService } from './storage.service';
|
|||||||
import { CookieService } from './cookie.service';
|
import { CookieService } from './cookie.service';
|
||||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
|
import { AppConfigModule } from './app-config.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('AlfrescoContentService', () => {
|
describe('AlfrescoContentService', () => {
|
||||||
|
|
||||||
let injector, contentService: AlfrescoContentService;
|
let contentService: AlfrescoContentService;
|
||||||
let authService: AlfrescoAuthenticationService;
|
let authService: AlfrescoAuthenticationService;
|
||||||
let settingsService: AlfrescoSettingsService;
|
let settingsService: AlfrescoSettingsService;
|
||||||
let storage: StorageService;
|
let storage: StorageService;
|
||||||
@@ -37,8 +38,14 @@ describe('AlfrescoContentService', () => {
|
|||||||
|
|
||||||
const nodeId = 'fake-node-id';
|
const nodeId = 'fake-node-id';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AppConfigModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AlfrescoContentService,
|
AlfrescoContentService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService,
|
||||||
@@ -46,12 +53,15 @@ describe('AlfrescoContentService', () => {
|
|||||||
StorageService,
|
StorageService,
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
LogService
|
LogService
|
||||||
]);
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
authService = injector.get(AlfrescoAuthenticationService);
|
beforeEach(() => {
|
||||||
settingsService = injector.get(AlfrescoSettingsService);
|
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||||
contentService = injector.get(AlfrescoContentService);
|
settingsService = TestBed.get(AlfrescoSettingsService);
|
||||||
storage = injector.get(StorageService);
|
contentService = TestBed.get(AlfrescoContentService);
|
||||||
|
storage = TestBed.get(StorageService);
|
||||||
storage.clear();
|
storage.clear();
|
||||||
|
|
||||||
node = {
|
node = {
|
||||||
@@ -73,7 +83,7 @@ describe('AlfrescoContentService', () => {
|
|||||||
|
|
||||||
it('should return a valid content URL', (done) => {
|
it('should return a valid content URL', (done) => {
|
||||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||||
expect(contentService.getContentUrl(node)).toBe('http://localhost:8080/alfresco/api/' +
|
expect(contentService.getContentUrl(node)).toBe('http://localhost:3000/ecm/alfresco/api/' +
|
||||||
'-default-/public/alfresco/versions/1/nodes/fake-node-id/content?attachment=false&alf_ticket=fake-post-ticket');
|
'-default-/public/alfresco/versions/1/nodes/fake-node-id/content?attachment=false&alf_ticket=fake-post-ticket');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@@ -88,7 +98,7 @@ describe('AlfrescoContentService', () => {
|
|||||||
it('should return a valid thumbnail URL', (done) => {
|
it('should return a valid thumbnail URL', (done) => {
|
||||||
authService.login('fake-username', 'fake-password').subscribe(() => {
|
authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||||
expect(contentService.getDocumentThumbnailUrl(node))
|
expect(contentService.getDocumentThumbnailUrl(node))
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco' +
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco' +
|
||||||
'/versions/1/nodes/fake-node-id/renditions/doclib/content?attachment=false&alf_ticket=fake-post-ticket');
|
'/versions/1/nodes/fake-node-id/renditions/doclib/content?attachment=false&alf_ticket=fake-post-ticket');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -15,35 +15,32 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
|
import { AppConfigModule } from './app-config.service';
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
|
|
||||||
describe('AlfrescoSettingsService', () => {
|
describe('AlfrescoSettingsService', () => {
|
||||||
|
|
||||||
let service: AlfrescoSettingsService;
|
let service: AlfrescoSettingsService;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AppConfigModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AlfrescoSettingsService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
service = new AlfrescoSettingsService();
|
service = TestBed.get(AlfrescoSettingsService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have default ECM host', () => {
|
it('should be exposed by the module', () => {
|
||||||
expect(service.ecmHost).toBe(AlfrescoSettingsService.DEFAULT_ECM_ADDRESS);
|
expect(service).toBeDefined();
|
||||||
});
|
|
||||||
|
|
||||||
it('should change host ECM', () => {
|
|
||||||
// this test ensures 'host' getter/setter working properly
|
|
||||||
let address = 'http://192.168.0.1';
|
|
||||||
service.ecmHost = address;
|
|
||||||
expect(service.ecmHost).toBe(address);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have default BPM host', () => {
|
|
||||||
expect(service.bpmHost).toBe(AlfrescoSettingsService.DEFAULT_BPM_ADDRESS);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should change host BPM', () => {
|
|
||||||
// this test ensures 'host' getter/setter working properly
|
|
||||||
let address = 'http://192.168.0.1';
|
|
||||||
service.bpmHost = address;
|
|
||||||
expect(service.bpmHost).toBe(address);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -17,31 +17,23 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
|
import { AppConfigService } from './app-config.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoSettingsService {
|
export class AlfrescoSettingsService {
|
||||||
|
|
||||||
static DEFAULT_ECM_ADDRESS: string = 'http://' + window.location.hostname + ':8080';
|
|
||||||
static DEFAULT_BPM_ADDRESS: string = 'http://' + window.location.hostname + ':9999';
|
|
||||||
static DEFAULT_CSRF_CONFIG: boolean = false;
|
static DEFAULT_CSRF_CONFIG: boolean = false;
|
||||||
|
|
||||||
static DEFAULT_BPM_CONTEXT_PATH: string = '/activiti-app';
|
|
||||||
|
|
||||||
private _ecmHost: string = AlfrescoSettingsService.DEFAULT_ECM_ADDRESS;
|
|
||||||
private _bpmHost: string = AlfrescoSettingsService.DEFAULT_BPM_ADDRESS;
|
|
||||||
private _csrfDisabled: boolean = AlfrescoSettingsService.DEFAULT_CSRF_CONFIG;
|
private _csrfDisabled: boolean = AlfrescoSettingsService.DEFAULT_CSRF_CONFIG;
|
||||||
|
|
||||||
private _bpmContextPath = AlfrescoSettingsService.DEFAULT_BPM_CONTEXT_PATH;
|
|
||||||
|
|
||||||
private providers: string = 'ALL'; // ECM, BPM , ALL
|
private providers: string = 'ALL'; // ECM, BPM , ALL
|
||||||
|
|
||||||
public bpmHostSubject: Subject<string> = new Subject<string>();
|
|
||||||
public ecmHostSubject: Subject<string> = new Subject<string>();
|
|
||||||
public csrfSubject: Subject<boolean> = new Subject<boolean>();
|
public csrfSubject: Subject<boolean> = new Subject<boolean>();
|
||||||
public providerSubject: Subject<string> = new Subject<string>();
|
public providerSubject: Subject<string> = new Subject<string>();
|
||||||
|
|
||||||
|
constructor(private appConfig: AppConfigService) {}
|
||||||
|
|
||||||
public get ecmHost(): string {
|
public get ecmHost(): string {
|
||||||
return this._ecmHost;
|
return this.appConfig.get<string>('ecmHost');
|
||||||
}
|
}
|
||||||
|
|
||||||
public set csrfDisabled(csrfDisabled: boolean) {
|
public set csrfDisabled(csrfDisabled: boolean) {
|
||||||
@@ -49,22 +41,24 @@ export class AlfrescoSettingsService {
|
|||||||
this._csrfDisabled = csrfDisabled;
|
this._csrfDisabled = csrfDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @deprecated in 1.6.0 */
|
||||||
public set ecmHost(ecmHostUrl: string) {
|
public set ecmHost(ecmHostUrl: string) {
|
||||||
this.ecmHostSubject.next(ecmHostUrl);
|
console.log('AlfrescoSettingsService.ecmHost is deprecated. Use AppConfigService instead.');
|
||||||
this._ecmHost = ecmHostUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get bpmHost(): string {
|
public get bpmHost(): string {
|
||||||
return this._bpmHost;
|
return this.appConfig.get<string>('bpmHost');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @deprecated in 1.6.0 */
|
||||||
public set bpmHost(bpmHostUrl: string) {
|
public set bpmHost(bpmHostUrl: string) {
|
||||||
this.bpmHostSubject.next(bpmHostUrl);
|
console.log('AlfrescoSettingsService.bpmHost is deprecated. Use AppConfigService instead.');
|
||||||
this._bpmHost = bpmHostUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @deprecated in 1.6.0 */
|
||||||
public getBPMApiBaseUrl(): string {
|
public getBPMApiBaseUrl(): string {
|
||||||
return this._bpmHost + this._bpmContextPath;
|
console.log('AlfrescoSettingsService.getBPMApiBaseUrl is deprecated.');
|
||||||
|
return this.bpmHost + '/activiti-app';
|
||||||
}
|
}
|
||||||
|
|
||||||
public getProviders(): string {
|
public getProviders(): string {
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable, APP_INITIALIZER, NgModule, ModuleWithProviders } from '@angular/core';
|
import { Injectable, APP_INITIALIZER, NgModule, ModuleWithProviders } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { HttpModule, Http } from '@angular/http';
|
||||||
import { ObjectUtils } from '../utils/object-utils';
|
import { ObjectUtils } from '../utils/object-utils';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -70,6 +70,9 @@ export function InitAppConfigServiceProvider(resource: string): any {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
HttpModule
|
||||||
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AppConfigService
|
AppConfigService
|
||||||
]
|
]
|
||||||
|
@@ -15,6 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async, inject } from '@angular/core/testing';
|
||||||
|
import { Router} from '@angular/router';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@@ -23,24 +27,29 @@ import { LogService } from './log.service';
|
|||||||
import { CookieService } from './cookie.service';
|
import { CookieService } from './cookie.service';
|
||||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||||
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
import { AuthGuardBpm } from './auth-guard-bpm.service';
|
||||||
import { Router} from '@angular/router';
|
import { AppConfigModule } from './app-config.service';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, async, inject } from '@angular/core/testing';
|
|
||||||
|
|
||||||
describe('AuthGuardService BPM', () => {
|
describe('AuthGuardService BPM', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [AuthGuardBpm,
|
imports: [
|
||||||
|
AppConfigModule,
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AuthGuardBpm,
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService,
|
||||||
StorageService,
|
StorageService,
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
LogService],
|
LogService
|
||||||
imports: [RouterTestingModule]
|
]
|
||||||
});
|
}).compileComponents();
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('if the alfresco js api is logged in should canActivate be true',
|
it('if the alfresco js api is logged in should canActivate be true',
|
||||||
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
async(inject([AuthGuardBpm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||||
|
@@ -15,6 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async, inject } from '@angular/core/testing';
|
||||||
|
import { Router} from '@angular/router';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@@ -23,24 +27,29 @@ import { CookieService } from './cookie.service';
|
|||||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
import { AuthGuardEcm } from './auth-guard-ecm.service';
|
||||||
import { Router} from '@angular/router';
|
import { AppConfigModule } from './app-config.service';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, async, inject } from '@angular/core/testing';
|
|
||||||
|
|
||||||
describe('AuthGuardService ECM', () => {
|
describe('AuthGuardService ECM', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [AuthGuardEcm,
|
imports: [
|
||||||
|
AppConfigModule,
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AuthGuardEcm,
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService,
|
||||||
StorageService,
|
StorageService,
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
LogService],
|
LogService
|
||||||
imports: [RouterTestingModule]
|
]
|
||||||
});
|
}).compileComponents();
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('if the alfresco js api is logged in should canActivate be true',
|
it('if the alfresco js api is logged in should canActivate be true',
|
||||||
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
async(inject([AuthGuardEcm, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||||
|
@@ -15,6 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async, inject } from '@angular/core/testing';
|
||||||
|
import { Router} from '@angular/router';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
import { AlfrescoAuthenticationService } from './alfresco-authentication.service';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
@@ -23,24 +27,27 @@ import { CookieService } from './cookie.service';
|
|||||||
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
import { CookieServiceMock } from './../assets/cookie.service.mock';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
import { AuthGuard } from './auth-guard.service';
|
import { AuthGuard } from './auth-guard.service';
|
||||||
import { Router} from '@angular/router';
|
import { AppConfigModule } from './app-config.service';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, async, inject } from '@angular/core/testing';
|
|
||||||
|
|
||||||
describe('AuthGuardService', () => {
|
describe('AuthGuardService', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [AuthGuard,
|
imports: [
|
||||||
|
AppConfigModule,
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AuthGuard,
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
AlfrescoAuthenticationService,
|
AlfrescoAuthenticationService,
|
||||||
StorageService,
|
StorageService,
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
LogService],
|
LogService
|
||||||
imports: [RouterTestingModule]
|
]
|
||||||
});
|
}).compileComponents();
|
||||||
});
|
}));
|
||||||
|
|
||||||
it('if the alfresco js api is logged in should canActivate be true',
|
it('if the alfresco js api is logged in should canActivate be true',
|
||||||
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
async(inject([AuthGuard, Router, AlfrescoSettingsService, StorageService, AlfrescoAuthenticationService], (auth, router, settingsService, storage, authService) => {
|
||||||
|
@@ -15,33 +15,40 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { RenditionsService } from './renditions.service';
|
import { RenditionsService } from './renditions.service';
|
||||||
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
import { fakeRedition, fakeReditionCreated, fakeReditionsList } from '../assets/renditionsService.mock';
|
import { fakeRedition, fakeReditionCreated, fakeReditionsList } from '../assets/renditionsService.mock';
|
||||||
|
import { AppConfigModule } from './app-config.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
declare let AlfrescoApi: any;
|
|
||||||
|
|
||||||
describe('RenditionsService', () => {
|
describe('RenditionsService', () => {
|
||||||
let service, injector;
|
let service: RenditionsService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AppConfigModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
RenditionsService,
|
RenditionsService,
|
||||||
AlfrescoSettingsService,
|
AlfrescoSettingsService,
|
||||||
StorageService,
|
StorageService,
|
||||||
LogService
|
LogService
|
||||||
]);
|
]
|
||||||
});
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
service = injector.get(RenditionsService);
|
service = TestBed.get(RenditionsService);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -63,7 +70,7 @@ describe('RenditionsService', () => {
|
|||||||
|
|
||||||
it('Create redition service should call the server with the ID passed and the asked encoding', (done) => {
|
it('Create redition service should call the server with the ID passed and the asked encoding', (done) => {
|
||||||
service.createRendition('fake-node-id', 'pdf').subscribe((res) => {
|
service.createRendition('fake-node-id', 'pdf').subscribe((res) => {
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
|
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -15,30 +15,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
AlfrescoSettingsService,
|
CoreModule,
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
CookieService,
|
||||||
AlfrescoContentService,
|
|
||||||
LogService,
|
LogService,
|
||||||
LogServiceMock
|
LogServiceMock
|
||||||
} from 'ng2-alfresco-core';
|
} from 'ng2-alfresco-core';
|
||||||
import { FileNode } from '../assets/document-library.model.mock';
|
import { FileNode } from '../assets/document-library.model.mock';
|
||||||
import { CookieServiceMock } from '../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
import { CookieServiceMock } from '../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
|
||||||
import { DocumentListService } from './document-list.service';
|
import { DocumentListService } from './document-list.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('DocumentListService', () => {
|
describe('DocumentListService', () => {
|
||||||
|
|
||||||
let injector;
|
|
||||||
let service: DocumentListService;
|
let service: DocumentListService;
|
||||||
let settingsService: AlfrescoSettingsService;
|
|
||||||
let authService: AlfrescoAuthenticationService;
|
|
||||||
let alfrescoApiService: AlfrescoApiService;
|
|
||||||
|
|
||||||
let fakeEntryNode = {
|
let fakeEntryNode = {
|
||||||
'entry': {
|
'entry': {
|
||||||
@@ -101,23 +93,21 @@ describe('DocumentListService', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
AlfrescoApiService,
|
imports: [
|
||||||
AlfrescoAuthenticationService,
|
CoreModule
|
||||||
AlfrescoSettingsService,
|
],
|
||||||
AlfrescoApiService,
|
providers: [
|
||||||
AlfrescoContentService,
|
|
||||||
DocumentListService,
|
DocumentListService,
|
||||||
StorageService,
|
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
{ provide: CookieService, useClass: CookieServiceMock },
|
||||||
{ provide: LogService, useClass: LogServiceMock }
|
{ provide: LogService, useClass: LogServiceMock }
|
||||||
]);
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
settingsService = injector.get(AlfrescoSettingsService);
|
beforeEach(() => {
|
||||||
authService = injector.get(AlfrescoAuthenticationService);
|
service = TestBed.get(DocumentListService);
|
||||||
alfrescoApiService = injector.get(AlfrescoApiService);
|
|
||||||
service = injector.get(DocumentListService);
|
|
||||||
jasmine.Ajax.install();
|
jasmine.Ajax.install();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -21,14 +21,7 @@ import { AlfrescoSearchAutocompleteComponent } from './alfresco-search-autocompl
|
|||||||
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
|
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
|
||||||
import { TranslationMock } from './../assets/translation.service.mock';
|
import { TranslationMock } from './../assets/translation.service.mock';
|
||||||
import { result } from './../assets/alfresco-search.component.mock';
|
import { result } from './../assets/alfresco-search.component.mock';
|
||||||
import {
|
import { CoreModule, AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoContentService,
|
|
||||||
AlfrescoTranslationService,
|
|
||||||
CoreModule
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { AlfrescoSearchService } from '../services/alfresco-search.service';
|
import { AlfrescoSearchService } from '../services/alfresco-search.service';
|
||||||
|
|
||||||
describe('AlfrescoSearchControlComponent', () => {
|
describe('AlfrescoSearchControlComponent', () => {
|
||||||
@@ -42,7 +35,7 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule
|
CoreModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AlfrescoSearchControlComponent,
|
AlfrescoSearchControlComponent,
|
||||||
@@ -51,10 +44,6 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{provide: AlfrescoTranslationService, useClass: TranslationMock},
|
{provide: AlfrescoTranslationService, useClass: TranslationMock},
|
||||||
AlfrescoThumbnailService,
|
AlfrescoThumbnailService,
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoContentService,
|
|
||||||
AlfrescoSearchService
|
AlfrescoSearchService
|
||||||
]
|
]
|
||||||
}).compileComponents().then(() => {
|
}).compileComponents().then(() => {
|
||||||
@@ -65,7 +54,7 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should setup i18n folder', () => {
|
it('should setup i18n folder', () => {
|
||||||
let translationService = fixture.debugElement.injector.get(AlfrescoTranslationService);
|
let translationService = TestBed.get(AlfrescoTranslationService);
|
||||||
spyOn(translationService, 'addTranslationFolder');
|
spyOn(translationService, 'addTranslationFolder');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(translationService.addTranslationFolder)
|
expect(translationService.addTranslationFolder)
|
||||||
@@ -210,7 +199,7 @@ describe('AlfrescoSearchControlComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should keep find-as-you-type control visible when user tabs into results', (done) => {
|
it('should keep find-as-you-type control visible when user tabs into results', (done) => {
|
||||||
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
let searchService = TestBed.get(AlfrescoSearchService);
|
||||||
spyOn(searchService, 'getQueryNodesPromise')
|
spyOn(searchService, 'getQueryNodesPromise')
|
||||||
.and.returnValue(Promise.resolve(result));
|
.and.returnValue(Promise.resolve(result));
|
||||||
|
|
||||||
|
@@ -22,17 +22,7 @@ import { Observable } from 'rxjs/Rx';
|
|||||||
import { AlfrescoSearchComponent } from './alfresco-search.component';
|
import { AlfrescoSearchComponent } from './alfresco-search.component';
|
||||||
import { TranslationMock } from './../assets/translation.service.mock';
|
import { TranslationMock } from './../assets/translation.service.mock';
|
||||||
import { AlfrescoSearchService } from '../services/alfresco-search.service';
|
import { AlfrescoSearchService } from '../services/alfresco-search.service';
|
||||||
import {
|
import { AlfrescoTranslationService, CoreModule } from 'ng2-alfresco-core';
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoTranslationService,
|
|
||||||
CoreModule,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { CookieServiceMock } from './../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
|
||||||
import { DocumentListModule } from 'ng2-alfresco-documentlist';
|
import { DocumentListModule } from 'ng2-alfresco-documentlist';
|
||||||
|
|
||||||
describe('AlfrescoSearchComponent', () => {
|
describe('AlfrescoSearchComponent', () => {
|
||||||
@@ -143,26 +133,8 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
expect(search.searchTerm).toBe('exampleTerm692');
|
expect(search.searchTerm).toBe('exampleTerm692');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a null search term if no query param provided via RouteParams', () => {
|
|
||||||
let injector = ReflectiveInjector.resolveAndCreate([
|
|
||||||
AlfrescoSearchService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
|
||||||
LogService,
|
|
||||||
{provide: ActivatedRoute, useValue: {params: Observable.from([{}])}}
|
|
||||||
]);
|
|
||||||
let search = new AlfrescoSearchComponent(injector.get(AlfrescoSearchService), null, injector.get(ActivatedRoute));
|
|
||||||
|
|
||||||
search.ngOnInit();
|
|
||||||
|
|
||||||
expect(search.searchTerm).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should setup i18n folder', () => {
|
it('should setup i18n folder', () => {
|
||||||
let translationService = fixture.debugElement.injector.get(AlfrescoTranslationService);
|
let translationService = TestBed.get(AlfrescoTranslationService);
|
||||||
spyOn(translationService, 'addTranslationFolder');
|
spyOn(translationService, 'addTranslationFolder');
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -198,7 +170,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
|
|
||||||
it('should display search results when a search term is provided', (done) => {
|
it('should display search results when a search term is provided', (done) => {
|
||||||
|
|
||||||
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
let searchService = TestBed.get(AlfrescoSearchService);
|
||||||
spyOn(searchService, 'getQueryNodesPromise').and.returnValue(Promise.resolve(result));
|
spyOn(searchService, 'getQueryNodesPromise').and.returnValue(Promise.resolve(result));
|
||||||
component.searchTerm = '';
|
component.searchTerm = '';
|
||||||
|
|
||||||
@@ -219,7 +191,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
|
|
||||||
it('should display no result if no result are returned', (done) => {
|
it('should display no result if no result are returned', (done) => {
|
||||||
|
|
||||||
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
let searchService = TestBed.get(AlfrescoSearchService);
|
||||||
spyOn(searchService, 'getQueryNodesPromise')
|
spyOn(searchService, 'getQueryNodesPromise')
|
||||||
.and.returnValue(Promise.resolve(noResult));
|
.and.returnValue(Promise.resolve(noResult));
|
||||||
|
|
||||||
@@ -241,7 +213,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
|
|
||||||
it('should display an error if an error is encountered running the search', (done) => {
|
it('should display an error if an error is encountered running the search', (done) => {
|
||||||
|
|
||||||
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
let searchService = TestBed.get(AlfrescoSearchService);
|
||||||
spyOn(searchService, 'getQueryNodesPromise')
|
spyOn(searchService, 'getQueryNodesPromise')
|
||||||
.and.returnValue(Promise.reject(errorJson));
|
.and.returnValue(Promise.reject(errorJson));
|
||||||
|
|
||||||
@@ -266,7 +238,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
|
|
||||||
it('should update search results when the search term input is changed', (done) => {
|
it('should update search results when the search term input is changed', (done) => {
|
||||||
|
|
||||||
let searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
let searchService = TestBed.get(AlfrescoSearchService);
|
||||||
spyOn(searchService, 'getQueryNodesPromise')
|
spyOn(searchService, 'getQueryNodesPromise')
|
||||||
.and.returnValue(Promise.resolve(result));
|
.and.returnValue(Promise.resolve(result));
|
||||||
|
|
||||||
@@ -298,7 +270,7 @@ describe('AlfrescoSearchComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
debugElement = fixture.debugElement;
|
debugElement = fixture.debugElement;
|
||||||
searchService = fixture.debugElement.injector.get(AlfrescoSearchService);
|
searchService = TestBed.get(AlfrescoSearchService);
|
||||||
querySpy = spyOn(searchService, 'getQueryNodesPromise').and.returnValue(Promise.resolve(result));
|
querySpy = spyOn(searchService, 'getQueryNodesPromise').and.returnValue(Promise.resolve(result));
|
||||||
emitSpy = spyOn(component.preview, 'emit');
|
emitSpy = spyOn(component.preview, 'emit');
|
||||||
});
|
});
|
||||||
|
@@ -15,17 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { AlfrescoSearchService } from './alfresco-search.service';
|
import { AlfrescoSearchService } from './alfresco-search.service';
|
||||||
import {
|
import { CoreModule, AlfrescoApiService } from 'ng2-alfresco-core';
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { CookieServiceMock } from './../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
|
||||||
import { fakeApi, fakeSearch, fakeError } from '../assets/alfresco-search.service.mock';
|
import { fakeApi, fakeSearch, fakeError } from '../assets/alfresco-search.service.mock';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
@@ -34,20 +26,21 @@ describe('AlfrescoSearchService', () => {
|
|||||||
|
|
||||||
let service: AlfrescoSearchService;
|
let service: AlfrescoSearchService;
|
||||||
let apiService: AlfrescoApiService;
|
let apiService: AlfrescoApiService;
|
||||||
let injector: ReflectiveInjector;
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AlfrescoSearchService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(AlfrescoSearchService);
|
||||||
AlfrescoSearchService,
|
apiService = TestBed.get(AlfrescoApiService);
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
StorageService,
|
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
service = injector.get(AlfrescoSearchService);
|
|
||||||
apiService = injector.get(AlfrescoApiService);
|
|
||||||
spyOn(apiService, 'getInstance').and.returnValue(fakeApi);
|
spyOn(apiService, 'getInstance').and.returnValue(fakeApi);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -15,37 +15,27 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
||||||
import {
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoContentService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { CookieServiceMock } from './../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
|
||||||
|
|
||||||
describe('AlfrescoThumbnailService', () => {
|
describe('AlfrescoThumbnailService', () => {
|
||||||
|
|
||||||
let injector: ReflectiveInjector;
|
|
||||||
let service: AlfrescoThumbnailService;
|
let service: AlfrescoThumbnailService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
TestBed.configureTestingModule({
|
||||||
AlfrescoApiService,
|
imports: [
|
||||||
AlfrescoAuthenticationService,
|
CoreModule.forRoot()
|
||||||
AlfrescoContentService,
|
],
|
||||||
AlfrescoSettingsService,
|
providers: [
|
||||||
AlfrescoThumbnailService,
|
AlfrescoThumbnailService
|
||||||
StorageService,
|
]
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
}).compileComponents();
|
||||||
LogService
|
}));
|
||||||
]);
|
|
||||||
|
|
||||||
service = injector.get(AlfrescoThumbnailService);
|
beforeEach(() => {
|
||||||
|
service = TestBed.get(AlfrescoThumbnailService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the correct icon for a plain text file', () => {
|
it('should return the correct icon for a plain text file', () => {
|
||||||
|
@@ -15,35 +15,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import {
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { RatingService } from '../services/rating.service';
|
import { RatingService } from '../services/rating.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('Rating service', () => {
|
describe('Rating service', () => {
|
||||||
|
|
||||||
let service, injector;
|
let service;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
RatingService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(RatingService);
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
RatingService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = injector.get(RatingService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -118,7 +118,7 @@ describe('Test ng2-alfresco-tag Tag actions list', () => {
|
|||||||
deleteButton.click();
|
deleteButton.click();
|
||||||
|
|
||||||
expect(jasmine.Ajax.requests.at(1).url)
|
expect(jasmine.Ajax.requests.at(1).url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
|
||||||
expect(jasmine.Ajax.requests.at(1).method).toBe('DELETE');
|
expect(jasmine.Ajax.requests.at(1).method).toBe('DELETE');
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
@@ -117,7 +117,7 @@ describe('Test ng2-alfresco-tag Tag relative node list', () => {
|
|||||||
deleteButton.click();
|
deleteButton.click();
|
||||||
|
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url).
|
expect(jasmine.Ajax.requests.mostRecent().url).
|
||||||
toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
|
toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/0ee933fa-57fc-4587-8a77-b787e814f1d2');
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
@@ -15,35 +15,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import {
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { TagService } from '../services/tag.service';
|
import { TagService } from '../services/tag.service';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('Tag service', () => {
|
describe('Tag service', () => {
|
||||||
|
|
||||||
let service, injector;
|
let service: TagService;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
TagService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(TagService);
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
TagService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = injector.get(TagService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -60,7 +54,7 @@ describe('Tag service', () => {
|
|||||||
service.removeTag('fake-node-id', 'fake-tag').subscribe(() => {
|
service.removeTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
expect(jasmine.Ajax.requests.mostRecent().method).toBe('DELETE');
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/fake-tag');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags/fake-tag');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,7 +67,7 @@ describe('Tag service', () => {
|
|||||||
service.addTag('fake-node-id', 'fake-tag').subscribe(() => {
|
service.addTag('fake-node-id', 'fake-tag').subscribe(() => {
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
|
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -86,7 +80,7 @@ describe('Tag service', () => {
|
|||||||
service.getAllTheTags().subscribe(() => {
|
service.getAllTheTags().subscribe(() => {
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/tags');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/tags');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,7 +93,7 @@ describe('Tag service', () => {
|
|||||||
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
||||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
expect(jasmine.Ajax.requests.mostRecent().method).toBe('GET');
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/tags');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, ElementRef, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, ElementRef, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { Observable, Subject } from 'rxjs/Rx';
|
import { Observable, Subject } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, LogService, NotificationService, AlfrescoSettingsService, FileUtils } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, LogService, NotificationService, FileUtils } from 'ng2-alfresco-core';
|
||||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
import { UploadService } from '../services/upload.service';
|
import { UploadService } from '../services/upload.service';
|
||||||
import { FileModel } from '../models/file.model';
|
import { FileModel } from '../models/file.model';
|
||||||
@@ -93,7 +93,6 @@ export class UploadButtonComponent implements OnInit, OnChanges {
|
|||||||
private translateService: AlfrescoTranslationService,
|
private translateService: AlfrescoTranslationService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private settingsService: AlfrescoSettingsService,
|
|
||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
private contentService: AlfrescoContentService) {
|
private contentService: AlfrescoContentService) {
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
@@ -102,10 +101,6 @@ export class UploadButtonComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.settingsService.ecmHostSubject.subscribe((hostEcm: string) => {
|
|
||||||
this.checkPermission();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.permissionValue.subscribe((permission: boolean) => {
|
this.permissionValue.subscribe((permission: boolean) => {
|
||||||
this.hasPermission = permission;
|
this.hasPermission = permission;
|
||||||
});
|
});
|
||||||
|
@@ -85,7 +85,7 @@ describe('UploadService', () => {
|
|||||||
service.uploadFilesInTheQueue(emitter);
|
service.uploadFilesInTheQueue(emitter);
|
||||||
|
|
||||||
let request = jasmine.Ajax.requests.mostRecent();
|
let request = jasmine.Ajax.requests.mostRecent();
|
||||||
expect(request.url).toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true');
|
expect(request.url).toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true');
|
||||||
expect(request.method).toBe('POST');
|
expect(request.method).toBe('POST');
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
@@ -109,7 +109,7 @@ describe('UploadService', () => {
|
|||||||
service.addToQueue(fileFake);
|
service.addToQueue(fileFake);
|
||||||
service.uploadFilesInTheQueue(emitter);
|
service.uploadFilesInTheQueue(emitter);
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url)
|
expect(jasmine.Ajax.requests.mostRecent().url)
|
||||||
.toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true');
|
.toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true');
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
'status': 404,
|
'status': 404,
|
||||||
@@ -159,7 +159,7 @@ describe('UploadService', () => {
|
|||||||
service.uploadFilesInTheQueue(emitter);
|
service.uploadFilesInTheQueue(emitter);
|
||||||
|
|
||||||
let request = jasmine.Ajax.requests.mostRecent();
|
let request = jasmine.Ajax.requests.mostRecent();
|
||||||
expect(request.url).toBe('http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true');
|
expect(request.url).toBe('http://localhost:3000/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true');
|
||||||
expect(request.method).toBe('POST');
|
expect(request.method).toBe('POST');
|
||||||
|
|
||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
@@ -15,35 +15,30 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import {
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { BpmUserService } from '../services/bpm-user.service';
|
import { BpmUserService } from '../services/bpm-user.service';
|
||||||
import { BpmUserModel } from '../models/bpm-user.model';
|
import { BpmUserModel } from '../models/bpm-user.model';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('Bpm user service', () => {
|
describe('Bpm user service', () => {
|
||||||
|
|
||||||
let service, injector;
|
let service: BpmUserService;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
BpmUserService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(BpmUserService);
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
BpmUserService,
|
|
||||||
StorageService,
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = injector.get(BpmUserService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -15,19 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { EcmUserService } from '../services/ecm-user.service';
|
import { EcmUserService } from '../services/ecm-user.service';
|
||||||
import { fakeEcmUser } from '../assets/fake-ecm-user.service.mock';
|
import { fakeEcmUser } from '../assets/fake-ecm-user.service.mock';
|
||||||
import { ReflectiveInjector } from '@angular/core';
|
import { CoreModule, AlfrescoAuthenticationService, AlfrescoContentService} from 'ng2-alfresco-core';
|
||||||
import {
|
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoContentService,
|
|
||||||
AlfrescoSettingsService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
|
||||||
LogService
|
|
||||||
} from 'ng2-alfresco-core';
|
|
||||||
import { CookieServiceMock } from './../../../ng2-alfresco-core/src/assets/cookie.service.mock';
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
describe('EcmUserService', () => {
|
describe('EcmUserService', () => {
|
||||||
@@ -35,25 +27,22 @@ describe('EcmUserService', () => {
|
|||||||
let service: EcmUserService;
|
let service: EcmUserService;
|
||||||
let authService: AlfrescoAuthenticationService;
|
let authService: AlfrescoAuthenticationService;
|
||||||
let contentService: AlfrescoContentService;
|
let contentService: AlfrescoContentService;
|
||||||
let injector;
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
CoreModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
EcmUserService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
injector = ReflectiveInjector.resolveAndCreate([
|
service = TestBed.get(EcmUserService);
|
||||||
AlfrescoSettingsService,
|
authService = TestBed.get(AlfrescoAuthenticationService);
|
||||||
AlfrescoApiService,
|
contentService = TestBed.get(AlfrescoContentService);
|
||||||
AlfrescoAuthenticationService,
|
|
||||||
AlfrescoContentService,
|
|
||||||
EcmUserService,
|
|
||||||
StorageService,
|
|
||||||
{ provide: CookieService, useClass: CookieServiceMock },
|
|
||||||
LogService
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = injector.get(EcmUserService);
|
|
||||||
authService = injector.get(AlfrescoAuthenticationService);
|
|
||||||
contentService = injector.get(AlfrescoContentService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -87,7 +87,7 @@ describe('Test ng2-alfresco-webscript', () => {
|
|||||||
|
|
||||||
component.ngOnChanges(null).then(() => {
|
component.ngOnChanges(null).then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:8080/alfresco/service/sample/folder/Company%20Home');
|
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:3000/ecm/alfresco/service/sample/folder/Company%20Home');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user