mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-05 04:06:49 +02:00
Added app, tests, lint to BUCK file for web/gui2
Change-Id: I94912cb18f31db26971b66c9d851fb57f022df54
This commit is contained in:
parent
318809a874
commit
49e15be98e
@ -1,4 +1,3 @@
|
||||
NODE_VERSION = "v8.1.2"
|
||||
NODE_RELEASE_BASE_URL = "https://nodejs.org/dist/"
|
||||
|
||||
NODE_SHA1S = {
|
||||
|
||||
@ -252,6 +252,7 @@ ONOS_APPS = [
|
||||
'//apps/imr:onos-apps-imr-oar',
|
||||
# nodemetrics application
|
||||
'//apps/nodemetrics:onos-apps-nodemetrics-oar',
|
||||
'//web/gui2:onos-web-gui2-oar',
|
||||
]
|
||||
|
||||
PROTOCOL_APPS = [
|
||||
|
||||
1
web/gui2/.gitignore
vendored
1
web/gui2/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
documentation/
|
||||
dist/
|
||||
coverage/
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
NODE_VERSION = "v8.11.1"
|
||||
|
||||
COMPILE_DEPS = [
|
||||
'//lib:CORE_DEPS',
|
||||
@ -15,8 +16,8 @@ COMPILE_DEPS = [
|
||||
'//incubator/net:onos-incubator-net',
|
||||
'//utils/rest:onlab-rest',
|
||||
'//core/store/serializers:onos-core-serializers',
|
||||
':node-release-v8.11.1',
|
||||
':node-bin-v8.11.1',
|
||||
':node-release-' + NODE_VERSION,
|
||||
':node-bin-' + NODE_VERSION,
|
||||
'//web/gui2:onos-web-gui2-build',
|
||||
]
|
||||
|
||||
@ -28,7 +29,7 @@ TEST_DEPS = [
|
||||
|
||||
include_defs('//bucklets/node.bucklet')
|
||||
|
||||
fetch_node(version = 'v8.11.1')
|
||||
fetch_node(version = NODE_VERSION)
|
||||
|
||||
genrule(
|
||||
name = 'onos-web-gui2-build',
|
||||
@ -37,7 +38,9 @@ genrule(
|
||||
'src/main/webapp/**/*.ts',
|
||||
'src/main/webapp/**/*.html',
|
||||
'src/main/webapp/**/*.css',
|
||||
'src/main/webapp/**/*.png'
|
||||
'src/main/webapp/**/*.png',
|
||||
'*.js',
|
||||
'e2e/**/*'
|
||||
], excludes = [
|
||||
'dist/**/*',
|
||||
'node_modules/**/*',
|
||||
@ -46,31 +49,98 @@ genrule(
|
||||
bash =
|
||||
#To avoid any older 'NodeJS' installations it is necessary to use only the one
|
||||
# associated with this project - Angular 6 won't work on older releases
|
||||
'export PATH=$(location :node-bin-v8.11.1)/bin:$PATH; '
|
||||
'export PATH=$(location :node-bin-' + NODE_VERSION + ')/bin:$PATH; '
|
||||
+ 'echo $PATH;'
|
||||
+ '$(location :node-bin-v8.11.1)/bin/node -v;'
|
||||
+ 'ORIGPATH=`pwd`;'
|
||||
+ 'cd $(location :node-bin-v8.11.1)/bin &&'
|
||||
+ '$(location :node-bin-' + NODE_VERSION + ')/bin/node -v;'
|
||||
+ 'ORIGPATH="$SRCDIR";'
|
||||
+ 'cd $(location :node-bin-' + NODE_VERSION + ')/bin &&'
|
||||
+ 'ln -sf ../lib/node_modules/npm/bin/npm-cli.js npm5 &&'
|
||||
+ 'cd $ORIGPATH &&'
|
||||
# The symlink to npm is not always created properly by the BUCK job that
|
||||
# untars it. It's safer to have our own symlink 'npm5'
|
||||
+ 'npm5 -v;'
|
||||
+ 'npm5 install -g @angular/cli@6.0.0 2>&1;'
|
||||
+ 'npm5 install -g @compodoc/compodoc 2>&1;'
|
||||
+ 'npm5 install 2>&1;'
|
||||
+ 'ng -v;'
|
||||
+ 'ng build --preserve-symlinks --base-href /onos/ui2/dist/ --deploy-url /onos/ui2/dist/ --output-path=$OUT 2>&1;',
|
||||
+ 'ng build --preserve-symlinks --base-href /onos/ui2/dist/ --deploy-url /onos/ui2/dist/ --output-path="$OUT" 2>&1',
|
||||
out = 'dist',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'onos-web-gui2-test',
|
||||
srcs = [],
|
||||
bash =
|
||||
'export PATH=$(location :node-bin-' + NODE_VERSION + ')/bin:$PATH; '
|
||||
+ 'ORIGPATH="$SRCDIR";'
|
||||
+ 'ORIGOUTPUT=\$(echo $ORIGPATH|cut -d\'_\' -f 1 );'
|
||||
+ 'cd $(location :onos-web-gui2-build)/../../onos-web-gui2-build__srcs;'
|
||||
# The sym linked karma.conf.js will mean that 'karma-jasmine' won't be found
|
||||
+ 'cp karma.conf.js karma.conflocal.js;'
|
||||
+ 'pwd > "$OUT";'
|
||||
+ 'npm5 -v >> "$OUT";'
|
||||
+ 'ng -v >> "$OUT";'
|
||||
+ 'if [ -f /usr/bin/chromium-browser ]; then export CHROME_BIN=/usr/bin/chromium-browser; fi;'
|
||||
+ 'echo $CHROME_BIN >> "$OUT";'
|
||||
# No point using PhantonJS as the browser because it's not compatible with ES6
|
||||
# Install either chrome or chromium-browser on the machine
|
||||
+ 'ng test --preserve-symlinks --karma-config=karma.conflocal.js --code-coverage --browsers=ChromeHeadless --watch=false >> "$OUT" 2>&1 || '
|
||||
+ 'if [ $? -eq 0 ]; then echo "Successfully ran tests";'
|
||||
+ 'else echo "Error running \'ng test\' on \'//web/gui2:onos-web-gui2-test\'. See $ORIGOUTPUT/onos-web-gui2-test-log.txt for more details" >&2;'
|
||||
+ 'tail -n 100 $ORIGOUTPUT/onos-web-gui2-test-log.txt >&2;'
|
||||
+ 'fi;',
|
||||
out = 'onos-web-gui2-test-log.txt',
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'onos-web-gui2-lint',
|
||||
srcs = [],
|
||||
bash =
|
||||
'export PATH=$(location :node-bin-' + NODE_VERSION + ')/bin:$PATH; '
|
||||
+ 'cd $(location :onos-web-gui2-build)/../../onos-web-gui2-build__srcs;'
|
||||
+ 'pwd > "$OUT";'
|
||||
+ 'npm5 -v >> "$OUT";'
|
||||
+ 'ng -v >> "$OUT";'
|
||||
+ 'ng lint >> "$OUT"',
|
||||
out = 'onos-web-gui2-lint-log.txt',
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = 'onos-web-gui2-compodoc',
|
||||
srcs = [],
|
||||
bash =
|
||||
'export PATH=$(location :node-bin-' + NODE_VERSION + ')/bin:$PATH; '
|
||||
+ 'cd $(location :onos-web-gui2-build) && cd ../.. && cd onos-web-gui2-build__srcs;'
|
||||
+ 'pwd;'
|
||||
+ 'npm5 -v;'
|
||||
+ 'npm5 install -g @compodoc/compodoc 2>&1;'
|
||||
+ 'npm5 run compodoc -- -V;'
|
||||
# TODO This does not pick up on sym linked files - issue raised with authors
|
||||
+ 'npm5 run compodoc -- -d "$OUT"',
|
||||
out = 'documentation',
|
||||
)
|
||||
|
||||
osgi_jar_with_tests (
|
||||
name = 'onos-gui2',
|
||||
deps = COMPILE_DEPS,
|
||||
test_deps = TEST_DEPS,
|
||||
resources = [':onos-web-gui2-build'],
|
||||
resources = [
|
||||
':onos-web-gui2-build'
|
||||
],
|
||||
resources_root = '.',
|
||||
test_resources = [
|
||||
':onos-web-gui2-test',
|
||||
':onos-web-gui2-lint'
|
||||
],
|
||||
test_resources_root = '.',
|
||||
web_context = '/onos/ui2',
|
||||
do_javadocs = False,
|
||||
)
|
||||
|
||||
onos_app (
|
||||
title = 'ONOS GUI v2 Application',
|
||||
category = 'GUI',
|
||||
url = 'http://onosproject.org',
|
||||
description = 'ONOS GUI v2 based on Angular 6',
|
||||
included_bundles = ['//web/gui2:onos-gui2'],
|
||||
)
|
||||
@ -1,20 +1,52 @@
|
||||
# ONOS GUI 2.0.0
|
||||
|
||||
This project is based on __Angular 5__, as an alternative to the 1.0.0 GUI which was based off __AngularJS 1.3.5__
|
||||
This project is based on __[Angular 6](https://angular.io/docs)__, as an alternative to the 1.0.0 GUI which was based
|
||||
off __[AngularJS 1.3.5](https://angularjs.org/)__
|
||||
|
||||
To use the new structure on your system, you need to
|
||||
1. Change directory in to onos/web/gui - this is where you will run the `ng` command from.
|
||||
1. Run `npm install` from this folder to add dependencies
|
||||
1. Run `npm install -g @angular/cli` to install the `ng` command
|
||||
1. Run `npm install -g @compodoc/compodoc` to install Compodoc which can generate documentation
|
||||
1. Add the following to your PATH environment variable `$ONOS_ROOT/buck-out/gen/web/gui2/node-bin-v8.11.1/node-binaries/bin`
|
||||
Building, testing and running lint are all handled by BUCK. See web/gui2/BUCK file.
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.4.
|
||||
To use this new GUI you simply have to start the GUI in a running ONOS at the __onos>__ cli:
|
||||
```
|
||||
feature:install onos-gui2
|
||||
```
|
||||
and the gui will be accessible at [http://localhost:8181/onos/ui2/dist/](http://localhost:8181/onos/ui2/dist/)
|
||||
|
||||
# Development
|
||||
The project relies on [Angular CLI](https://github.com/angular/angular-cli) v6 to simplify development of the browser side code.
|
||||
|
||||
This allows you to develop the Angular 6 Type Script code independent of ONOS in a separate container. At the current moment (May '18) the
|
||||
implementation of WebSockets and REST calls is not done, so there is __no__ requirement to run ONOS in the background.
|
||||
This will change in the coming weeks.
|
||||
|
||||
There is no need to install node, npm or ng again on your system, and indeed if they are already installed, it's best
|
||||
to use the versions of these that's used by BUCK. To do this add to the __start__ of your PATH environment variable.
|
||||
```
|
||||
~/onos/buck-out/gen/web/gui2/node-bin-v8.11.1/node-binaries/bin
|
||||
|
||||
```
|
||||
On Linux:
|
||||
```
|
||||
export PATH=~/onos/buck-out/gen/web/gui2/node-bin-v8.11.1/node-binaries/bin:$PATH
|
||||
```
|
||||
|
||||
After this you should be able to run 'ng -v' and see:
|
||||
```
|
||||
Angular CLI: 6.0.0
|
||||
Node: 8.11.1
|
||||
OS: linux x64
|
||||
```
|
||||
|
||||
To use Angular CLI for development on your system, you need to:
|
||||
1. Change directory in to onos/web/gui2 - this is where you will run the `ng` command from.
|
||||
2. Run `npm install` once from this folder to add dependencies
|
||||
3. Then run 'ng -v' from onos/web/gui2 and an additional version should be shown __Angular: 6.0.0__
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
Press Ctrl-Shift-I in Chrome and Firefox to bring up the developer tools and the browser console.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
@ -27,22 +59,26 @@ outputted folder this is copied to the sources root directory, where as files
|
||||
are copied to WEB-INF/classes. To get around this I put all the outputted stuff in to
|
||||
```dist``` and it gets copied to /WEB-INF/classes/dist/ )
|
||||
|
||||
To start the GUI in a running ONOS at the __onos>__ cli
|
||||
```
|
||||
feature:install onos-gui2
|
||||
```
|
||||
and the gui will be accessible at [http://localhost:8181/onos/ui2/dist/](http://localhost:8181/onos/ui2/dist/)
|
||||
To run it manually in Angular CLI run `ng build`
|
||||
|
||||
## Running unit tests
|
||||
This is automatically done when using "onos-buck test" - see the web/gui2/BUCK file for more details.
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
To run it manually in Angular CLI run `ng test --watch=true` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running checkstyle
|
||||
This is automatically done when using "onos-buck test" - see the web/gui2/BUCK file for more details.
|
||||
|
||||
To run it manually in Angular CLI run `ng lint` to run codelyzer on your code, according to the rules in __tslint.json__
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
To run it manually in Angular CLI run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
|
||||
## Generating documentation
|
||||
Run `npm run compodoc` to generate documentation via [Compodoc](https://github.com/compodoc/compodoc)
|
||||
This is automatically done when using "onos-buck onos build" - see the web/gui2/BUCK file for more details.
|
||||
|
||||
To run it manually in Angular CLI run `npm run compodoc` to generate documentation via [Compodoc](https://github.com/compodoc/compodoc)
|
||||
|
||||
## Further help
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs",
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
|
||||
@ -37,10 +37,14 @@ export class DetectBrowserDirective {
|
||||
let browser = '';
|
||||
if (fs.isChrome()) {
|
||||
browser = 'chrome';
|
||||
} else if (fs.isChromeHeadless()) {
|
||||
browser = 'chromeheadless';
|
||||
} else if (fs.isSafari()) {
|
||||
browser = 'safari';
|
||||
} else if (fs.isFirefox()) {
|
||||
browser = 'firefox';
|
||||
} else {
|
||||
this.log.warn('Unknown browser:', window.navigator.vendor);
|
||||
}
|
||||
body.classList.add(browser);
|
||||
// body.classed(browser, true);
|
||||
|
||||
@ -29,7 +29,7 @@ import { WebSocketService } from '../remote/websocket.service';
|
||||
export class DetailsPanelService {
|
||||
|
||||
constructor(
|
||||
private etc: EditableTextService,
|
||||
private ets: EditableTextService,
|
||||
private fs: FnService,
|
||||
private is: IconService,
|
||||
private log: LogService,
|
||||
|
||||
@ -36,7 +36,7 @@ const waitDelay = 500;
|
||||
@Injectable()
|
||||
export class LoadingService {
|
||||
images: any[] = [];
|
||||
idx: number = 0;
|
||||
idx = 0;
|
||||
img: any;
|
||||
theme: string;
|
||||
task: any;
|
||||
@ -60,7 +60,7 @@ export class LoadingService {
|
||||
let idx: number;
|
||||
|
||||
this.dbg('preload images start...');
|
||||
for (idx=1; idx<=nImgs; idx++) {
|
||||
for (idx = 1; idx <= nImgs ; idx++) {
|
||||
this.addImg('light', idx);
|
||||
this.addImg('dark', idx);
|
||||
}
|
||||
@ -68,7 +68,7 @@ export class LoadingService {
|
||||
}
|
||||
|
||||
addImg(theme: string, idx: number) {
|
||||
let img = new Image();
|
||||
const img = new Image();
|
||||
img.src = this.fname(idx, theme);
|
||||
this.images.push(img);
|
||||
}
|
||||
@ -87,7 +87,7 @@ export class LoadingService {
|
||||
startAnim() {
|
||||
this.dbg('start ANIMATION');
|
||||
this.theme = this.ts.getTheme();
|
||||
let div = d3.select('#'+id);
|
||||
let div = d3.select('#' + id);
|
||||
if (div.empty()) {
|
||||
div = d3.select('body')
|
||||
.append('div')
|
||||
@ -107,7 +107,7 @@ export class LoadingService {
|
||||
clearInterval(this.task);
|
||||
this.task = null;
|
||||
}
|
||||
d3.select('#'+id).remove();
|
||||
d3.select('#' + id).remove();
|
||||
}
|
||||
|
||||
// schedule function to start animation in the future
|
||||
|
||||
@ -89,12 +89,12 @@ export class WebSocketService {
|
||||
* host: if defined, is the host address to use
|
||||
*/
|
||||
createWebSocket(opts, _host_: string = '') {
|
||||
let wsport = (opts && opts.wsport) || null;
|
||||
const wsport = (opts && opts.wsport) || null;
|
||||
|
||||
this.webSockOpts = opts; // preserved for future calls
|
||||
|
||||
// this.host = _host_ || this.host();
|
||||
let url = this.ufs.wsUrl('core', wsport, _host_);
|
||||
const url = this.ufs.wsUrl('core', wsport, _host_);
|
||||
|
||||
this.log.debug('Attempting to open websocket to: ' + url);
|
||||
this.ws = this.wsock.newWebSocket(url);
|
||||
@ -126,10 +126,10 @@ export class WebSocketService {
|
||||
* If the websocket is not up yet, we store it in a pending list.
|
||||
*/
|
||||
sendEvent(evType, payload) {
|
||||
let ev = <EventType> {
|
||||
const ev = <EventType> {
|
||||
event: evType,
|
||||
payload: payload
|
||||
}
|
||||
};
|
||||
|
||||
if (this.wsUp) {
|
||||
this._send(ev);
|
||||
|
||||
@ -96,7 +96,7 @@ export class GlyphService {
|
||||
registerGlyphs(data: Map<string, string>, overwrite: boolean = false): boolean {
|
||||
const dups: string[] = [];
|
||||
const missvb: string[] = [];
|
||||
for (let [key, value] of data.entries()) {
|
||||
for (const [key, value] of data.entries()) {
|
||||
const vbk = '_' + key;
|
||||
const vb = data.get(vbk);
|
||||
|
||||
@ -120,7 +120,7 @@ export class GlyphService {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let [key, value] of data.entries()) {
|
||||
for (const [key, value] of data.entries()) {
|
||||
// angular.forEach(data, function (value, key) {
|
||||
if (key[0] !== '_') {
|
||||
this.addToMap(key, value, vb, overwrite, dups);
|
||||
|
||||
@ -29,7 +29,7 @@ import * as d3 from 'd3';
|
||||
})
|
||||
export class IconDirective implements OnInit {
|
||||
@Input() iconId: string;
|
||||
@Input() iconSize: number = 20;
|
||||
@Input() iconSize = 20;
|
||||
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
|
||||
@ -27,65 +27,65 @@ export const glyphMapping = new Map<string, string>([
|
||||
// Maps icon ID to the glyph ID it uses.
|
||||
// NOTE: icon ID maps to a CSS class for styling that icon
|
||||
['active', 'checkMark'],
|
||||
['inactive','xMark'],
|
||||
['inactive', 'xMark'],
|
||||
|
||||
['plus','plus'],
|
||||
['minus','minus'],
|
||||
['play','play'],
|
||||
['stop','stop'],
|
||||
['plus', 'plus'],
|
||||
['minus', 'minus'],
|
||||
['play', 'play'],
|
||||
['stop', 'stop'],
|
||||
|
||||
['upload','upload'],
|
||||
['download','download'],
|
||||
['delta','delta'],
|
||||
['nonzero','nonzero'],
|
||||
['close','xClose'],
|
||||
['upload', 'upload'],
|
||||
['download', 'download'],
|
||||
['delta', 'delta'],
|
||||
['nonzero', 'nonzero'],
|
||||
['close', 'xClose'],
|
||||
|
||||
['topo','topo'],
|
||||
['topo', 'topo'],
|
||||
|
||||
['refresh','refresh'],
|
||||
['query','query'],
|
||||
['garbage','garbage'],
|
||||
['refresh', 'refresh'],
|
||||
['query', 'query'],
|
||||
['garbage', 'garbage'],
|
||||
|
||||
|
||||
['upArrow','triangleUp'],
|
||||
['downArrow','triangleDown'],
|
||||
['upArrow', 'triangleUp'],
|
||||
['downArrow', 'triangleDown'],
|
||||
|
||||
['appInactive','unknown'],
|
||||
['appInactive', 'unknown'],
|
||||
|
||||
['node','node'],
|
||||
['devIcon_SWITCH','switch'],
|
||||
['devIcon_ROADM','roadm'],
|
||||
['devIcon_OTN','otn'],
|
||||
['node', 'node'],
|
||||
['devIcon_SWITCH', 'switch'],
|
||||
['devIcon_ROADM', 'roadm'],
|
||||
['devIcon_OTN', 'otn'],
|
||||
|
||||
['portIcon_DEFAULT','m_ports'],
|
||||
['portIcon_DEFAULT', 'm_ports'],
|
||||
|
||||
['meter','meterTable'], // TODO: m_meter icon?
|
||||
['meter', 'meterTable'], // TODO: m_meter icon?
|
||||
|
||||
['deviceTable','switch'],
|
||||
['flowTable','flowTable'],
|
||||
['portTable','portTable'],
|
||||
['groupTable','groupTable'],
|
||||
['meterTable','meterTable'],
|
||||
['pipeconfTable','pipeconfTable'],
|
||||
['deviceTable', 'switch'],
|
||||
['flowTable', 'flowTable'],
|
||||
['portTable', 'portTable'],
|
||||
['groupTable', 'groupTable'],
|
||||
['meterTable', 'meterTable'],
|
||||
['pipeconfTable', 'pipeconfTable'],
|
||||
|
||||
['hostIcon_endstation','endstation'],
|
||||
['hostIcon_router','router'],
|
||||
['hostIcon_bgpSpeaker','bgpSpeaker'],
|
||||
['hostIcon_endstation', 'endstation'],
|
||||
['hostIcon_router', 'router'],
|
||||
['hostIcon_bgpSpeaker', 'bgpSpeaker'],
|
||||
|
||||
// navigation menu icons...
|
||||
['nav_apps','bird'],
|
||||
['nav_settings','cog'],
|
||||
['nav_cluster','node'],
|
||||
['nav_processors','allTraffic'],
|
||||
['nav_apps', 'bird'],
|
||||
['nav_settings', 'cog'],
|
||||
['nav_cluster', 'node'],
|
||||
['nav_processors', 'allTraffic'],
|
||||
|
||||
['nav_topo','topo'],
|
||||
['nav_topo2','m_cloud'],
|
||||
['nav_devs','switch'],
|
||||
['nav_links','ports'],
|
||||
['nav_hosts','endstation'],
|
||||
['nav_intents','relatedIntents'],
|
||||
['nav_tunnels','ports'], // TODO: use tunnel glyph, when available
|
||||
['nav_yang','yang'],
|
||||
['nav_topo', 'topo'],
|
||||
['nav_topo2', 'm_cloud'],
|
||||
['nav_devs', 'switch'],
|
||||
['nav_links', 'ports'],
|
||||
['nav_hosts', 'endstation'],
|
||||
['nav_intents', 'relatedIntents'],
|
||||
['nav_tunnels', 'ports'], // TODO: use tunnel glyph, when available
|
||||
['nav_yang', 'yang'],
|
||||
]);
|
||||
|
||||
/**
|
||||
@ -104,7 +104,7 @@ export class IconService {
|
||||
}
|
||||
|
||||
ensureIconLibDefs() {
|
||||
let body = d3.select('body');
|
||||
const body = d3.select('body');
|
||||
let svg = body.select('svg#IconLibDefs');
|
||||
if (svg.empty()) {
|
||||
svg = body.append('svg').attr('id', 'IconLibDefs');
|
||||
@ -125,9 +125,9 @@ export class IconService {
|
||||
* Defaults to 'embeddedIcon'.
|
||||
*/
|
||||
loadIcon(div, glyphId: string = 'unknown', size: number = 20, installGlyph: boolean = true, svgClass: string = 'embeddedIcon') {
|
||||
let dim = size || 20;
|
||||
let svgCls = svgClass || 'embeddedIcon';
|
||||
let gid = glyphId || 'unknown';
|
||||
const dim = size || 20;
|
||||
const svgCls = svgClass || 'embeddedIcon';
|
||||
const gid = glyphId || 'unknown';
|
||||
let g;
|
||||
let svgIcon: any;
|
||||
|
||||
@ -168,7 +168,7 @@ export class IconService {
|
||||
* @param svgClass The CSS class used to identify the SVG layer.
|
||||
* Defaults to 'embeddedIcon'.
|
||||
*/
|
||||
loadIconByClass(div, iconCls: string, size: number, installGlyph: boolean, svgClass='embeddedIcon') {
|
||||
loadIconByClass(div, iconCls: string, size: number, installGlyph: boolean, svgClass= 'embeddedIcon') {
|
||||
this.loadIcon(div, glyphMapping.get(iconCls), size, installGlyph, svgClass);
|
||||
div.select('svg g').classed(iconCls, true);
|
||||
}
|
||||
@ -202,7 +202,7 @@ export class IconService {
|
||||
* Returns the D3 selection of the glyph (use) element.
|
||||
*/
|
||||
addDeviceIcon(elem, glyphId, iconDim) {
|
||||
let gid = this.gs.glyphDefined(glyphId) ? glyphId : 'query';
|
||||
const gid = this.gs.glyphDefined(glyphId) ? glyphId : 'query';
|
||||
return elem.append('use').attr({
|
||||
'xlink:href': '#' + gid,
|
||||
width: iconDim,
|
||||
@ -211,9 +211,9 @@ export class IconService {
|
||||
}
|
||||
|
||||
addHostIcon(elem, radius, glyphId) {
|
||||
let dim = radius * 1.5;
|
||||
let xlate = -dim / 2;
|
||||
let g = elem.append('g')
|
||||
const dim = radius * 1.5;
|
||||
const xlate = -dim / 2;
|
||||
const g = elem.append('g')
|
||||
.attr('class', 'svgIcon hostIcon');
|
||||
|
||||
g.append('circle').attr('r', radius);
|
||||
|
||||
@ -35,7 +35,7 @@ import * as d3 from 'd3';
|
||||
})
|
||||
export class IconComponent implements OnInit {
|
||||
@Input() iconId: string;
|
||||
@Input() iconSize: number = 20;
|
||||
@Input() iconSize = 20;
|
||||
|
||||
constructor(
|
||||
private is: IconService,
|
||||
|
||||
@ -24,43 +24,43 @@ declare const InstallTrigger: any;
|
||||
// TODO Move all this trie stuff to its own class
|
||||
// Angular>=2 Tightened up on types to avoid compiler errors
|
||||
interface TrieC {
|
||||
p: any,
|
||||
s: string[]
|
||||
p: any;
|
||||
s: string[];
|
||||
}
|
||||
// trie operation
|
||||
function _trieOp(op: string, trie, word: string, data) {
|
||||
var p = trie,
|
||||
w: string = word.toUpperCase(),
|
||||
s: Array<string> = w.split(''),
|
||||
c:TrieC = { p: p, s: s },
|
||||
t = [],
|
||||
x: number = 0,
|
||||
f1 = op === '+' ? add : probe,
|
||||
f2 = op === '+' ? insert : remove;
|
||||
const p = trie;
|
||||
const w: string = word.toUpperCase();
|
||||
const s: Array<string> = w.split('');
|
||||
let c: TrieC = { p: p, s: s };
|
||||
let t = [];
|
||||
let x = 0;
|
||||
const f1 = op === '+' ? add : probe;
|
||||
const f2 = op === '+' ? insert : remove;
|
||||
|
||||
function add(c):TrieC {
|
||||
var q = c.s.shift(),
|
||||
np = c.p[q];
|
||||
function add(cAdded): TrieC {
|
||||
const q = cAdded.s.shift();
|
||||
let np = cAdded.p[q];
|
||||
|
||||
if (!np) {
|
||||
c.p[q] = {};
|
||||
np = c.p[q];
|
||||
cAdded.p[q] = {};
|
||||
np = cAdded.p[q];
|
||||
x = 1;
|
||||
}
|
||||
return { p: np, s: c.s };
|
||||
return { p: np, s: cAdded.s };
|
||||
}
|
||||
|
||||
function probe(c):TrieC {
|
||||
var q = c.s.shift(),
|
||||
k:number = Object.keys(c.p).length,
|
||||
np = c.p[q];
|
||||
function probe(cProbed): TrieC {
|
||||
const q = cProbed.s.shift();
|
||||
const k: number = Object.keys(cProbed.p).length;
|
||||
const np = cProbed.p[q];
|
||||
|
||||
t.push({ q: q, k: k, p: c.p });
|
||||
t.push({ q: q, k: k, p: cProbed.p });
|
||||
if (!np) {
|
||||
t = [];
|
||||
return { p: [], s: [] };
|
||||
}
|
||||
return { p: np, s: c.s };
|
||||
return { p: np, s: cProbed.s };
|
||||
}
|
||||
|
||||
function insert() {
|
||||
@ -72,7 +72,7 @@ function _trieOp(op: string, trie, word: string, data) {
|
||||
if (t.length) {
|
||||
t = t.reverse();
|
||||
while (t.length) {
|
||||
let d = t.shift();
|
||||
const d = t.shift();
|
||||
delete d.p[d.q];
|
||||
if (d.k > 1) {
|
||||
t = [];
|
||||
@ -109,9 +109,9 @@ function removeFromTrie(trie, word) {
|
||||
// -1 for a partial match (word is a prefix to an existing word)
|
||||
// data for the word for an exact match
|
||||
function trieLookup(trie, word) {
|
||||
var s = word.toUpperCase().split(''),
|
||||
p = trie,
|
||||
n;
|
||||
const s = word.toUpperCase().split('');
|
||||
let p = trie;
|
||||
let n;
|
||||
|
||||
while (s.length) {
|
||||
n = s.shift();
|
||||
@ -142,10 +142,11 @@ export class FnService {
|
||||
private log: LogService
|
||||
) {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
let debugparam: string = params['debug'];
|
||||
const debugparam: string = params['debug'];
|
||||
log.debug('Param:', debugparam);
|
||||
this.parseDebugFlags(debugparam);
|
||||
});
|
||||
log.debug("FnService constructed");
|
||||
log.debug('FnService constructed');
|
||||
}
|
||||
|
||||
isF(f) {
|
||||
@ -174,8 +175,8 @@ export class FnService {
|
||||
* Returns true if current browser determined to be a mobile device
|
||||
*/
|
||||
isMobile() {
|
||||
var ua = window.navigator.userAgent,
|
||||
patt = /iPhone|iPod|iPad|Silk|Android|BlackBerry|Opera Mini|IEMobile/;
|
||||
const ua = window.navigator.userAgent;
|
||||
const patt = /iPhone|iPod|iPad|Silk|Android|BlackBerry|Opera Mini|IEMobile/;
|
||||
return patt.test(ua);
|
||||
}
|
||||
|
||||
@ -183,14 +184,21 @@ export class FnService {
|
||||
* Returns true if the current browser determined to be Chrome
|
||||
*/
|
||||
isChrome() {
|
||||
let isChromium = (window as any).chrome;
|
||||
let vendorName = window.navigator.vendor;
|
||||
const isChromium = (window as any).chrome;
|
||||
const vendorName = window.navigator.vendor;
|
||||
|
||||
let isOpera = window.navigator.userAgent.indexOf('OPR') > -1;
|
||||
const isOpera = window.navigator.userAgent.indexOf('OPR') > -1;
|
||||
return (isChromium !== null &&
|
||||
isChromium !== undefined &&
|
||||
vendorName === 'Google Inc.' &&
|
||||
isOpera == false);
|
||||
isOpera === false);
|
||||
}
|
||||
|
||||
isChromeHeadless() {
|
||||
const vendorName = window.navigator.vendor;
|
||||
const headlessChrome = window.navigator.userAgent.indexOf('HeadlessChrome') > -1;
|
||||
|
||||
return (vendorName === 'Google Inc.' && headlessChrome === true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,8 +234,8 @@ export class FnService {
|
||||
}
|
||||
|
||||
parseDebugFlags(dbgstr: string): void {
|
||||
let bits = dbgstr ? dbgstr.split(',') : [];
|
||||
bits.forEach(function (key) {
|
||||
const bits = dbgstr ? dbgstr.split(',') : [];
|
||||
bits.forEach((key) => {
|
||||
this.debugFlags.set(key, true);
|
||||
});
|
||||
this.log.debug('Debug flags:', dbgstr);
|
||||
|
||||
@ -67,7 +67,7 @@ export class LionService {
|
||||
this.log.info('LION service: Locale... [' + data.locale + ']');
|
||||
this.log.info('LION service: Bundles installed...');
|
||||
|
||||
for (let p in this.ubercache) {
|
||||
for (const p in this.ubercache) {
|
||||
if (this.ubercache[p]) {
|
||||
this.log.info(' :=> ', p);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import { LogService } from '../../log.service';
|
||||
@Injectable()
|
||||
export class ThemeService {
|
||||
themes: string[] = ['light', 'dark'];
|
||||
thidx: number = 0;
|
||||
thidx = 0;
|
||||
|
||||
constructor(
|
||||
private log: LogService
|
||||
|
||||
@ -39,10 +39,10 @@ import { LogService } from './log.service';
|
||||
import { OnosService } from './onos.service';
|
||||
|
||||
const onosRoutes: Routes = [
|
||||
{ path: 'apps', component: AppsComponent }, // All except default should be driven by
|
||||
{ path: 'device', component: DeviceComponent }, // servlet like {INJECTED-VIEW-DATA-START}
|
||||
{ path: '**', component: DeviceComponent } //Change to Topo(2) when it's ready for normal behaviour
|
||||
]
|
||||
{ path: 'apps', component: AppsComponent }, // All except default should be driven by
|
||||
{ path: 'device', component: DeviceComponent }, // servlet like {INJECTED-VIEW-DATA-START}
|
||||
{ path: '**', component: DeviceComponent } // Change to Topo(2) when it's ready for normal behaviour
|
||||
];
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Main Application Module
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Directive } from '@angular/core';
|
||||
import { LogService } from '../../log.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Apps -- Trigger Form Directive
|
||||
@ -23,6 +24,10 @@ import { Directive } from '@angular/core';
|
||||
})
|
||||
export class TriggerFormDirective {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private log: LogService,
|
||||
) {
|
||||
this.log.debug('TriggerFormDirective constructed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,48 +13,57 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { DetectBrowserDirective } from '../../app/detectbrowser.directive';
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../app/consolelogger.service';
|
||||
import { DetectBrowserDirective } from '../../app/detectbrowser.directive';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { FnService } from '../../app/fw/util/fn.service';
|
||||
import { OnosService } from '../../app/onos.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
class MockOnosService extends OnosService {
|
||||
// Override things as necessary
|
||||
class MockFnService extends FnService {
|
||||
constructor(ar: ActivatedRoute, log: LogService) {
|
||||
super(ar, log);
|
||||
}
|
||||
}
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
class MockOnosService {}
|
||||
|
||||
class MockActivatedRoute extends ActivatedRoute {
|
||||
constructor(params: Params) {
|
||||
super();
|
||||
this.queryParams = of(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Detect Browser Directive - Unit Tests
|
||||
*/
|
||||
describe('DetectBrowserDirective', () => {
|
||||
|
||||
let onos: MockOnosService;
|
||||
let fs: MockFunctionService;
|
||||
let log: LogService;
|
||||
let ar: ActivatedRoute;
|
||||
let directive: DetectBrowserDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
onos = new MockOnosService(log);
|
||||
fs = new MockFunctionService(ar, log);
|
||||
directive = new DetectBrowserDirective(fs, log, onos);
|
||||
log = new ConsoleLoggerService();
|
||||
ar = new MockActivatedRoute(['debug', 'DetectBrowserDirective']);
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ DetectBrowserDirective,
|
||||
{ provide: FnService, useValue: new MockFnService(ar, log) },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: OnosService, useClass: MockOnosService },
|
||||
{ provide: Document, useValue: document },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
onos = null;
|
||||
fs = null;
|
||||
log = null;
|
||||
ar = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([DetectBrowserDirective], (directive: DetectBrowserDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,51 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { DetailsPanelService } from '../../../../app/fw/layer/detailspanel.service';
|
||||
import { EditableTextService } from '../../../../app/fw/layer/editabletext.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { MastService } from '../../../../app/fw/mast/mast.service';
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockEditableTextService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockMastService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Details Panel Service - Unit Tests
|
||||
*/
|
||||
describe('DetailsPanelService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DetailsPanelService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([DetailsPanelService], (service: DetailsPanelService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DetailsPanelService,
|
||||
{ provide: EditableTextService, useClass: MockEditableTextService },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: MastService, useClass: MockMastService },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([DetailsPanelService], (service: DetailsPanelService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,39 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { DialogService } from '../../../../app/fw/layer/dialog.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Dialog Service - Unit Tests
|
||||
*/
|
||||
describe('DialogService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DialogService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([DialogService], (service: DialogService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DialogService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([DialogService], (service: DialogService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,35 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { EditableTextService } from '../../../../app/fw/layer/editabletext.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Editable Text Service - Unit Tests
|
||||
*/
|
||||
describe('EditableTextService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [EditableTextService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([EditableTextService], (service: EditableTextService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [EditableTextService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([EditableTextService], (service: EditableTextService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FlashService } from '../../../../app/fw/layer/flash.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Flash Service - Unit Tests
|
||||
*/
|
||||
describe('FlashService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [FlashService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([FlashService], (service: FlashService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [FlashService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([FlashService], (service: FlashService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,42 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { LoadingService } from '../../../../app/fw/layer/loading.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ThemeService } from '../../../../app/fw/util/theme.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockFnService {
|
||||
debug() {
|
||||
}
|
||||
}
|
||||
|
||||
class MockThemeService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Loading Service - Unit Tests
|
||||
*/
|
||||
describe('LoadingService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [LoadingService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([LoadingService], (service: LoadingService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [LoadingService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: ThemeService, useClass: MockThemeService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([LoadingService], (service: LoadingService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -16,18 +16,30 @@
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Panel Service - Unit Tests
|
||||
*/
|
||||
describe('PanelService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [PanelService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([PanelService], (service: PanelService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [PanelService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([PanelService], (service: PanelService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,43 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { QuickHelpService } from '../../../../app/fw/layer/quickhelp.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { LionService } from '../../../../app/fw/util/lion.service';
|
||||
import { LoadingService } from '../../../../app/fw/layer/loading.service';
|
||||
import { SvgUtilService } from '../../../../app/fw/svg/svgutil.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockLionService {}
|
||||
|
||||
class MockLoadingService {}
|
||||
|
||||
class MockSvgUtilService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Quick Help Service - Unit Tests
|
||||
*/
|
||||
describe('QuickHelpService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [QuickHelpService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([QuickHelpService], (service: QuickHelpService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [QuickHelpService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LionService, useClass: MockLionService },
|
||||
{ provide: LoadingService, useClass: MockLoadingService },
|
||||
{ provide: SvgUtilService, useClass: MockSvgUtilService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([QuickHelpService], (service: QuickHelpService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,43 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { VeilService } from '../../../../app/fw/layer/veil.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Layer -- Veil Service - Unit Tests
|
||||
*/
|
||||
describe('VeilService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [VeilService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([VeilService], (service: VeilService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [VeilService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([VeilService], (service: VeilService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -16,18 +16,32 @@
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { MastService } from '../../../../app/fw/mast/mast.service';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {
|
||||
isMobile() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Masthead Service - Unit Tests
|
||||
*/
|
||||
describe('MastService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [MastService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([MastService], (service: MastService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [MastService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([MastService], (service: MastService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,29 +15,50 @@
|
||||
*/
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../../app/consolelogger.service';
|
||||
import { MastComponent } from '../../../../../app/fw/mast/mast/mast.component';
|
||||
import { IconComponent } from '../../../../../app/fw/svg/icon/icon.component';
|
||||
import { DialogService } from '../../../../../app/fw/layer/dialog.service';
|
||||
import { LionService } from '../../../../../app/fw/util/lion.service';
|
||||
import { IconService } from '../../../../../app/fw/svg/icon.service';
|
||||
import { NavService } from '../../../../../app/fw/nav/nav.service';
|
||||
import { WebSocketService } from '../../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockDialogService {}
|
||||
|
||||
class MockLionService {}
|
||||
|
||||
class MockNavService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Masthead Controller - Unit Tests
|
||||
*/
|
||||
describe('MastComponent', () => {
|
||||
let component: MastComponent;
|
||||
let fixture: ComponentFixture<MastComponent>;
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MastComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MastComponent, IconComponent ],
|
||||
providers: [
|
||||
{ provide: DialogService, useClass: MockDialogService },
|
||||
{ provide: LionService, useClass: MockLionService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: NavService, useClass: MockNavService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MastComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
it('should create', () => {
|
||||
const fixture = TestBed.createComponent(MastComponent);
|
||||
const component = fixture.componentInstance;
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { NavService } from '../../../../app/fw/nav/nav.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Util -- Navigation Service - Unit Tests
|
||||
*/
|
||||
describe('NavService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [NavService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([NavService], (service: NavService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [NavService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([NavService], (service: NavService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,29 +15,38 @@
|
||||
*/
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../../app/consolelogger.service';
|
||||
import { NavComponent } from '../../../../../app/fw/nav/nav/nav.component';
|
||||
import { IconComponent } from '../../../../../app/fw/svg/icon/icon.component';
|
||||
import { IconService } from '../../../../../app/fw/svg/icon.service';
|
||||
import { NavService } from '../../../../../app/fw/nav/nav.service';
|
||||
|
||||
class MockNavService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Util -- Navigation Component - Unit Tests
|
||||
*/
|
||||
describe('NavComponent', () => {
|
||||
let component: NavComponent;
|
||||
let fixture: ComponentFixture<NavComponent>;
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavComponent, IconComponent ],
|
||||
providers: [
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: NavService, useClass: MockNavService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
it('should create', () => {
|
||||
const fixture = TestBed.createComponent(NavComponent);
|
||||
const component = fixture.componentInstance;
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -15,19 +15,35 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { RestService } from '../../../../app/fw/remote/rest.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { UrlFnService } from '../../../../app/fw/remote/urlfn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockUrlFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Remote -- REST Service - Unit Tests
|
||||
*/
|
||||
describe('RestService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [RestService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([RestService], (service: RestService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [RestService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: UrlFnService, useClass: MockUrlFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([RestService], (service: RestService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,29 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { UrlFnService } from '../../../../app/fw/remote/urlfn.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Remote -- General Functions - Unit Tests
|
||||
*/
|
||||
describe('UrlFnService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [UrlFnService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
const windowMock = <any>{ location: <any> { hostname: 'localhost' } };
|
||||
|
||||
it('should be created', inject([UrlFnService], (service: UrlFnService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [UrlFnService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: Window, useValue: windowMock },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([UrlFnService], (service: UrlFnService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,45 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { UrlFnService } from '../../../../app/fw/remote/urlfn.service';
|
||||
import { WSock } from '../../../../app/fw/remote/wsock.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockUrlFnService {}
|
||||
|
||||
class MockWSock {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Remote -- Web Socket Service - Unit Tests
|
||||
*/
|
||||
describe('WebSocketService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [WebSocketService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
const windowMock = <any>{ location: <any> { hostname: 'localhost' } };
|
||||
|
||||
it('should be created', inject([WebSocketService], (service: WebSocketService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [WebSocketService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: UrlFnService, useClass: MockUrlFnService },
|
||||
{ provide: WSock, useClass: MockWSock },
|
||||
{ provide: Window, useValue: windowMock },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([WebSocketService], (service: WebSocketService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { WSock } from '../../../../app/fw/remote/wsock.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Remote -- WSock Service - Unit Tests
|
||||
*/
|
||||
describe('WSock', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [WSock]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([WSock], (service: WSock) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [WSock,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([WSock], (service: WSock) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { GeoDataService } from '../../../../app/fw/svg/geodata.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- GeoData Service - Unit Tests
|
||||
*/
|
||||
describe('GeoDataService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GeoDataService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([GeoDataService], (service: GeoDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GeoDataService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([GeoDataService], (service: GeoDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Glyph Service - Unit Tests
|
||||
*/
|
||||
describe('GlyphService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GlyphService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([GlyphService], (service: GlyphService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GlyphService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([GlyphService], (service: GlyphService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { GlyphDataService } from '../../../../app/fw/svg/glyphdata.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Glyph Data Service - Unit Tests
|
||||
*/
|
||||
describe('GlyphDataService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GlyphDataService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([GlyphDataService], (service: GlyphDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [GlyphDataService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([GlyphDataService], (service: GlyphDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -13,55 +13,50 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { IconDirective } from '../../../../app/fw/svg/icon.directive';
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { ElementRef } from '@angular/core';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { IconDirective } from '../../../../app/fw/svg/icon.directive';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { SvgUtilService } from '../../../../app/fw/svg/svgutil.service';
|
||||
import { FnService } from '../../../../app/fw//util/fn.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockGlyphService extends GlyphService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockFnService {}
|
||||
|
||||
class MockSvgUtilService extends SvgUtilService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockIconService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Icon Directive - Unit Tests
|
||||
*/
|
||||
describe('IconDirective', () => {
|
||||
let ar: ActivatedRoute;
|
||||
let log: LogService;
|
||||
let fs: MockFunctionService;
|
||||
let gs: GlyphService;
|
||||
let is: IconService;
|
||||
let sus: SvgUtilService;
|
||||
let directive: IconDirective;
|
||||
const elementMock = <any>{ };
|
||||
|
||||
beforeEach(() => {
|
||||
ar = new ActivatedRoute();
|
||||
log = new LogService();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
sus = new MockSvgUtilService(fs, log);
|
||||
gs = new GlyphService(log);
|
||||
is = new IconService(gs, log, sus);
|
||||
directive = new IconDirective(is, log);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ IconDirective,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: ElementRef, useValue: elementMock },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
is = null;
|
||||
log = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([IconDirective], (directive: IconDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,36 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { SvgUtilService } from '../../../../app/fw/svg/svgutil.service';
|
||||
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockSvgUtilService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Icon Service - Unit Tests
|
||||
*/
|
||||
describe('IconService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [IconService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([IconService], (service: IconService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [IconService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: SvgUtilService, useClass: MockSvgUtilService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([IconService], (service: IconService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -1,25 +1,30 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../../app/consolelogger.service';
|
||||
import { IconComponent } from '../../../../../app/fw/svg/icon/icon.component';
|
||||
import { IconService } from '../../../../../app/fw/svg/icon.service';
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
describe('IconComponent', () => {
|
||||
let component: IconComponent;
|
||||
let fixture: ComponentFixture<IconComponent>;
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ IconComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(IconComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ IconComponent ],
|
||||
providers: [
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
it('should create', () => {
|
||||
const fixture = TestBed.createComponent(IconComponent);
|
||||
const component = fixture.componentInstance;
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { MapService } from '../../../../app/fw/svg/map.service';
|
||||
import { GlyphDataService } from '../../../../app/fw/svg/glyphdata.service';
|
||||
|
||||
class MockGlyphDataService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Map Service - Unit Tests
|
||||
*/
|
||||
describe('MapService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [MapService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([MapService], (service: MapService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [MapService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: GlyphDataService, useClass: MockGlyphDataService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([MapService], (service: MapService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { SpriteService } from '../../../../app/fw/svg/sprite.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Sprite Service - Unit Tests
|
||||
*/
|
||||
describe('SpriteService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SpriteService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([SpriteService], (service: SpriteService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SpriteService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SpriteService], (service: SpriteService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { SpriteDataService } from '../../../../app/fw/svg/spritedata.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Sprite Data Service - Unit Tests
|
||||
*/
|
||||
describe('SpriteDataService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SpriteDataService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([SpriteDataService], (service: SpriteDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SpriteDataService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SpriteDataService], (service: SpriteDataService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { SvgUtilService } from '../../../../app/fw/svg/svgutil.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Svg Util Service - Unit Tests
|
||||
*/
|
||||
describe('SvgUtilService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SvgUtilService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([SvgUtilService], (service: SvgUtilService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SvgUtilService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SvgUtilService], (service: SvgUtilService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ZoomService } from '../../../../app/fw/svg/zoom.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- SVG -- Zoom Service - Unit Tests
|
||||
*/
|
||||
describe('ZoomService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ZoomService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ZoomService], (service: ZoomService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ZoomService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ZoomService], (service: ZoomService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { EeService } from '../../../../app/fw/util/ee.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Util -- EE functions - Unit Tests
|
||||
*/
|
||||
describe('EeService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [EeService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([EeService], (service: EeService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [EeService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([EeService], (service: EeService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,39 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
class MockActivatedRoute extends ActivatedRoute {
|
||||
constructor(params: Params) {
|
||||
super();
|
||||
this.queryParams = of(params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Util -- General Purpose Functions - Unit Tests
|
||||
*/
|
||||
describe('FnService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [FnService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
let ar: ActivatedRoute;
|
||||
|
||||
it('should be created', inject([FnService], (service: FnService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
ar = new MockActivatedRoute({'debug': 'TestService'});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [FnService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: ActivatedRoute, useValue: ar },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([FnService], (service: FnService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Key Handler Service - Unit Tests
|
||||
*/
|
||||
describe('KeyService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [KeyService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([KeyService], (service: KeyService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [KeyService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([KeyService], (service: KeyService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -16,19 +16,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { LionService } from '../../../../app/fw/util/lion.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Lion -- Localization Utilities - Unit Tests
|
||||
*/
|
||||
describe('LionService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [LionService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([LionService], (service: LionService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [LionService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([LionService], (service: LionService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,35 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { PrefsService } from '../../../../app/fw/util/prefs.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
ONOS GUI -- Util -- User Preference Service - Unit Tests
|
||||
* ONOS GUI -- Util -- User Preference Service - Unit Tests
|
||||
*/
|
||||
describe('PrefsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [PrefsService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([PrefsService], (service: PrefsService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [PrefsService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([PrefsService], (service: PrefsService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { RandomService } from '../../../../app/fw/util/random.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Random -- Encapsulated randomness - Unit Tests
|
||||
*/
|
||||
describe('RandomService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [RandomService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([RandomService], (service: RandomService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [RandomService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([RandomService], (service: RandomService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ThemeService } from '../../../../app/fw/util/theme.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Util -- Theme Service - Unit Tests
|
||||
*/
|
||||
describe('ThemeService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ThemeService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ThemeService], (service: ThemeService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ThemeService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ThemeService], (service: ThemeService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,39 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ButtonService } from '../../../../app/fw/widget/button.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { TooltipService } from '../../../../app/fw/widget/tooltip.service';
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockTooltipService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Button Service - Unit Tests
|
||||
*/
|
||||
describe('ButtonService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ButtonService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ButtonService], (service: ButtonService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ButtonService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: TooltipService, useClass: MockTooltipService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ButtonService], (service: ButtonService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,39 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ChartBuilderService } from '../../../../app/fw/widget/chartbuilder.service';
|
||||
import { LoadingService } from '../../../../app/fw/layer/loading.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockLoadingService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Chart Builder Service - Unit Tests
|
||||
*/
|
||||
describe('ChartBuilderService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ChartBuilderService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ChartBuilderService], (service: ChartBuilderService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ChartBuilderService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LoadingService, useClass: MockLoadingService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ChartBuilderService], (service: ChartBuilderService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -13,40 +13,37 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FlashChangesDirective } from '../../../../app/fw/widget/flashchanges.directive';
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FlashChangesDirective } from '../../../../app/fw/widget/flashchanges.directive';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Table Flash Changes Directive - Unit Tests
|
||||
*/
|
||||
describe('FlashChangesDirective', () => {
|
||||
let fs: MockFunctionService;
|
||||
let log: LogService;
|
||||
let ar: ActivatedRoute;
|
||||
let directive: FlashChangesDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
directive = new FlashChangesDirective(fs, log);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ FlashChangesDirective,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs = null;
|
||||
log = null;
|
||||
ar = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([FlashChangesDirective], (directive: FlashChangesDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ListService } from '../../../../app/fw/widget/list.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- List Service - Unit Tests
|
||||
*/
|
||||
describe('ListService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ListService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ListService], (service: ListService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ListService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ListService], (service: ListService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -13,55 +13,45 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { SortableHeaderDirective } from '../../../../app/fw/widget/sortableheader.directive';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { GlyphService } from '../../../../app/fw/svg/glyph.service';
|
||||
import { SvgUtilService } from '../../../../app/fw/svg/svgutil.service';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockGlyphService extends GlyphService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockFnService {}
|
||||
|
||||
class MockSvgUtilService extends SvgUtilService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockIconService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Table Sortable Header Directive - Unit Tests
|
||||
*/
|
||||
describe('SortableHeaderDirective', () => {
|
||||
let gs: MockGlyphService;
|
||||
let sus: MockSvgUtilService;
|
||||
let icon: IconService;
|
||||
let log: LogService;
|
||||
let fs: MockFunctionService;
|
||||
let ar: ActivatedRoute;
|
||||
let directive: SortableHeaderDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
gs = new MockGlyphService(log);
|
||||
sus = new MockSvgUtilService(fs, log);
|
||||
icon = new IconService(gs, log, sus);
|
||||
directive = new SortableHeaderDirective(icon, log);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ SortableHeaderDirective,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
log = null;
|
||||
icon = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([SortableHeaderDirective], (directive: SortableHeaderDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,40 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { TableBuilderService } from '../../../../app/fw/widget/tablebuilder.service';
|
||||
import { FnService } from '../../../../app/fw//util/fn.service';
|
||||
import { LoadingService } from '../../../../app/fw/layer/loading.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockLoadingService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/*
|
||||
ONOS GUI -- Widget -- Table Builder Service - Unit Tests
|
||||
*/
|
||||
describe('TableBuilderService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TableBuilderService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([TableBuilderService], (service: TableBuilderService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TableBuilderService,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LoadingService, useClass: MockLoadingService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([TableBuilderService], (service: TableBuilderService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { TableDetailService } from '../../../../app/fw/widget/tabledetail.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Table Detail Service - Unit Tests
|
||||
*/
|
||||
describe('TableDetailService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TableDetailService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([TableDetailService], (service: TableDetailService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TableDetailService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([TableDetailService], (service: TableDetailService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -13,44 +13,41 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { TableResizeDirective } from '../../../../app/fw/widget/tableresize.directive';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { MastService } from '../../../../app/fw/mast/mast.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockFnService {}
|
||||
|
||||
class MockMastService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Table Resize Directive - Unit Tests
|
||||
*/
|
||||
describe('TableResizeDirective', () => {
|
||||
|
||||
let fs: MockFunctionService;
|
||||
let log: LogService;
|
||||
let ar: ActivatedRoute;
|
||||
let ms: MastService;
|
||||
let directive: TableResizeDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
ms = new MastService(fs, log);
|
||||
directive = new TableResizeDirective(fs, log, ms);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ TableResizeDirective,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: MastService, useClass: MockMastService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs = null;
|
||||
log = null;
|
||||
ar = null;
|
||||
ms = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([TableResizeDirective], (directive: TableResizeDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,43 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { ToolbarService } from '../../../../app/fw/widget/toolbar.service';
|
||||
import { ButtonService } from '../../../../app/fw/widget/button.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
|
||||
class MockButtonService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Toolbar Service - Unit Tests
|
||||
*/
|
||||
describe('ToolbarService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ToolbarService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([ToolbarService], (service: ToolbarService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ToolbarService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: ButtonService, useClass: MockButtonService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ToolbarService], (service: ToolbarService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -13,39 +13,37 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { TooltipDirective } from '../../../../app/fw/widget/tooltip.directive';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Tooltip Directive - Unit Tests
|
||||
*/
|
||||
describe('TooltipDirective', () => {
|
||||
let fs: MockFunctionService;
|
||||
let log: LogService;
|
||||
let ar: ActivatedRoute;
|
||||
let directive: TooltipDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
directive = new TooltipDirective(fs, log);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ TooltipDirective,
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs = null;
|
||||
log = null;
|
||||
ar = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([TooltipDirective], (directive: TooltipDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,31 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { TooltipService } from '../../../../app/fw/widget/tooltip.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Widget -- Tooltip Service - Unit Tests
|
||||
*/
|
||||
describe('TooltipService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TooltipService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([TooltipService], (service: TooltipService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TooltipService,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([TooltipService], (service: TooltipService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -14,33 +14,107 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { RouterModule, RouterOutlet, ChildrenOutletContexts } from '@angular/router';
|
||||
import { LogService } from '../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../app/consolelogger.service';
|
||||
import { IconComponent } from '../../app/fw/svg/icon/icon.component';
|
||||
import { MastComponent } from '../../app/fw/mast/mast/mast.component';
|
||||
import { NavComponent } from '../../app/fw/nav/nav/nav.component';
|
||||
import { OnosComponent } from '../../app/onos.component';
|
||||
import { DialogService } from '../../app/fw/layer/dialog.service';
|
||||
import { EeService } from '../../app/fw/util/ee.service';
|
||||
import { FlashService } from '../../app/fw/layer/flash.service';
|
||||
import { GlyphService } from '../../app/fw/svg/glyph.service';
|
||||
import { IconService } from '../../app/fw/svg/icon.service';
|
||||
import { KeyService } from '../../app/fw/util/key.service';
|
||||
import { LionService } from '../../app/fw/util/lion.service';
|
||||
import { NavService } from '../../app/fw/nav/nav.service';
|
||||
import { OnosService } from '../../app/onos.service';
|
||||
import { PanelService } from '../../app/fw/layer/panel.service';
|
||||
import { QuickHelpService } from '../../app/fw/layer/quickhelp.service';
|
||||
import { ThemeService } from '../../app/fw/util/theme.service';
|
||||
import { SpriteService } from '../../app/fw/svg/sprite.service';
|
||||
import { VeilService } from '../../app/fw/layer/veil.service';
|
||||
import { WebSocketService } from '../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockDialogService {}
|
||||
|
||||
class MockEeService {}
|
||||
|
||||
class MockFlashService {}
|
||||
|
||||
class MockGlyphService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockLionService {}
|
||||
|
||||
class MockNavService {}
|
||||
|
||||
class MockOnosService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
class MockQuickHelpService {}
|
||||
|
||||
class MockSpriteService {}
|
||||
|
||||
class MockThemeService {}
|
||||
|
||||
class MockVeilService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Onos Component - Unit Tests
|
||||
*/
|
||||
describe('OnosComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
OnosComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(OnosComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
it(`should have as title 'onos'`, async(() => {
|
||||
const fixture = TestBed.createComponent(OnosComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('onos');
|
||||
}));
|
||||
it('should render title in a h1 tag', async(() => {
|
||||
const fixture = TestBed.createComponent(OnosComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to onos!');
|
||||
}));
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
IconComponent,
|
||||
MastComponent,
|
||||
NavComponent,
|
||||
OnosComponent,
|
||||
RouterOutlet
|
||||
],
|
||||
providers: [
|
||||
{ provide: ChildrenOutletContexts, useClass: ChildrenOutletContexts },
|
||||
{ provide: DialogService, useClass: MockDialogService },
|
||||
{ provide: EeService, useClass: MockEeService },
|
||||
{ provide: FlashService, useClass: MockFlashService },
|
||||
{ provide: GlyphService, useClass: MockGlyphService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: LionService, useClass: MockLionService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: NavService, useClass: MockNavService },
|
||||
{ provide: OnosService, useClass: MockOnosService },
|
||||
{ provide: QuickHelpService, useClass: MockQuickHelpService },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
{ provide: SpriteService, useClass: MockSpriteService },
|
||||
{ provide: ThemeService, useClass: MockThemeService },
|
||||
{ provide: VeilService, useClass: MockVeilService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(OnosComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
|
||||
it(`should have as title 'onos'`, async(() => {
|
||||
const fixture = TestBed.createComponent(OnosComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('onos');
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,19 +15,27 @@
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../app/consolelogger.service';
|
||||
import { OnosService } from '../../app/onos.service';
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Onos Service - Unit Tests
|
||||
*/
|
||||
describe('OnosService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [OnosService]
|
||||
});
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
it('should be created', inject([OnosService], (service: OnosService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [OnosService,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([OnosService], (service: OnosService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -1,25 +1,89 @@
|
||||
/*
|
||||
* Copyright 2018-present Open Networking Foundation
|
||||
*
|
||||
* 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { AppsComponent } from '../../../../app/view/apps/apps.component';
|
||||
import { DialogService } from '../../../../app/fw/layer/dialog.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { LionService } from '../../../../app/fw/util/lion.service';
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
import { TableBuilderService } from '../../../../app/fw/widget/tablebuilder.service';
|
||||
import { UrlFnService } from '../../../../app/fw/remote/urlfn.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockDialogService {}
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockLionService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
class MockTableBuilderService {}
|
||||
|
||||
class MockUrlFnService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Apps View -- Unit Tests
|
||||
*/
|
||||
describe('AppsComponent', () => {
|
||||
let component: AppsComponent;
|
||||
let fixture: ComponentFixture<AppsComponent>;
|
||||
let log: LogService;
|
||||
let component: AppsComponent;
|
||||
let fixture: ComponentFixture<AppsComponent>;
|
||||
const windowMock = <any>{ location: <any> { hostname: 'localhost' } };
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
beforeEach(async(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppsComponent ],
|
||||
providers: [
|
||||
{ provide: DialogService, useClass: MockDialogService },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: LionService, useClass: MockLionService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
{ provide: TableBuilderService, useClass: MockTableBuilderService },
|
||||
{ provide: UrlFnService, useClass: MockUrlFnService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
{ provide: Window, useValue: windowMock },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,8 +1,42 @@
|
||||
/*
|
||||
* Copyright 2015-present Open Networking Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { TriggerFormDirective } from '../../../../app/view/apps/triggerform.directive';
|
||||
|
||||
describe('TriggerFormDirective', () => {
|
||||
it('should create an instance', () => {
|
||||
const directive = new TriggerFormDirective();
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
let log: LogService;
|
||||
|
||||
beforeEach(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ TriggerFormDirective,
|
||||
{ provide: LogService, useValue: log },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
log = null;
|
||||
});
|
||||
|
||||
it('should create an instance', inject([TriggerFormDirective], (directive: TriggerFormDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
@ -15,29 +15,87 @@
|
||||
*/
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { DeviceComponent } from '../../../../app/view/device/device.component';
|
||||
import { DetailsPanelService } from '../../../../app/fw/layer/detailspanel.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { IconService } from '../../../../app/fw/svg/icon.service';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { LoadingService } from '../../../../app/fw/layer/loading.service';
|
||||
import { NavService } from '../../../../app/fw/nav/nav.service';
|
||||
import { MastService } from '../../../../app/fw/mast/mast.service';
|
||||
import { PanelService } from '../../../../app/fw/layer/panel.service';
|
||||
import { TableBuilderService } from '../../../../app/fw/widget/tablebuilder.service';
|
||||
import { TableDetailService } from '../../../../app/fw/widget/tabledetail.service';
|
||||
import { WebSocketService } from '../../../../app/fw/remote/websocket.service';
|
||||
|
||||
class MockDetailsPanelService {}
|
||||
|
||||
class MockFnService {}
|
||||
|
||||
class MockIconService {}
|
||||
|
||||
class MockKeyService {}
|
||||
|
||||
class MockLoadingService {
|
||||
startAnim() {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
class MockNavService {}
|
||||
|
||||
class MockMastService {}
|
||||
|
||||
class MockPanelService {}
|
||||
|
||||
class MockTableBuilderService {}
|
||||
|
||||
class MockTableDetailService {}
|
||||
|
||||
class MockWebSocketService {}
|
||||
|
||||
/**
|
||||
* ONOS GUI -- Device View Module - Unit Tests
|
||||
*/
|
||||
describe('DeviceComponent', () => {
|
||||
let component: DeviceComponent;
|
||||
let fixture: ComponentFixture<DeviceComponent>;
|
||||
let log: LogService;
|
||||
let component: DeviceComponent;
|
||||
let fixture: ComponentFixture<DeviceComponent>;
|
||||
const windowMock = <any>{ location: <any> { hostname: 'localhost' } };
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
beforeEach(async(() => {
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DeviceComponent ],
|
||||
providers: [
|
||||
{ provide: DetailsPanelService, useClass: MockDetailsPanelService },
|
||||
{ provide: FnService, useClass: MockFnService },
|
||||
{ provide: IconService, useClass: MockIconService },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: LoadingService, useClass: MockLoadingService },
|
||||
{ provide: MastService, useClass: MockMastService },
|
||||
{ provide: NavService, useClass: MockNavService },
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: PanelService, useClass: MockPanelService },
|
||||
{ provide: TableBuilderService, useClass: MockTableBuilderService },
|
||||
{ provide: TableDetailService, useClass: MockTableDetailService },
|
||||
{ provide: WebSocketService, useClass: MockWebSocketService },
|
||||
{ provide: Window, useValue: windowMock },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DeviceComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -13,47 +13,39 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { ConsoleLoggerService } from '../../../../app/consolelogger.service';
|
||||
import { DeviceDetailsPanelDirective } from '../../../../app/view/device/devicedetailspanel.directive';
|
||||
import { KeyService } from '../../../../app/fw/util/key.service';
|
||||
import { LogService } from '../../../../app/log.service';
|
||||
import { FnService } from '../../../../app/fw/util/fn.service';
|
||||
import { ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
class MockFunctionService extends FnService {
|
||||
// Override things as necessary
|
||||
}
|
||||
class MockKeyService {}
|
||||
|
||||
class MockKeyService extends KeyService {
|
||||
// Override things as necessary
|
||||
}
|
||||
/**
|
||||
* ONOS GUI -- Device View Module - Unit Tests
|
||||
*/
|
||||
describe('DeviceDetailsPanelDirective', () => {
|
||||
let ar: ActivatedRoute;
|
||||
let log: LogService;
|
||||
let ks: KeyService;
|
||||
let fs: MockFunctionService;
|
||||
let window: Window
|
||||
let directive: DeviceDetailsPanelDirective;
|
||||
const windowMock = <any>{ location: <any> { hostname: 'localhost' } };
|
||||
|
||||
beforeEach(() => {
|
||||
log = new LogService();
|
||||
ar = new ActivatedRoute();
|
||||
fs = new MockFunctionService(ar, log);
|
||||
ks = new MockKeyService(fs, log);
|
||||
directive = new DeviceDetailsPanelDirective(ks, log, window);
|
||||
log = new ConsoleLoggerService();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ DeviceDetailsPanelDirective,
|
||||
{ provide: LogService, useValue: log },
|
||||
{ provide: KeyService, useClass: MockKeyService },
|
||||
{ provide: Window, useValue: windowMock },
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs = null;
|
||||
ks = null;
|
||||
log = null;
|
||||
ar = null;
|
||||
directive = null;
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
it('should create an instance', inject([DeviceDetailsPanelDirective], (directive: DeviceDetailsPanelDirective) => {
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2018-present Open Networking Foundation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.onosproject.ui.impl;
|
||||
|
||||
/**
|
||||
* This is just a dummy file to get BUCK going.
|
||||
*/
|
||||
public class DummyTest {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user