Simon Hunt

GUI -- TopoView - added skeleton topoFilter.js (WIP)

- fixed broken unit tests.

Change-Id: Ibeb85d2724d460b7e681ea2b247e5429ba3d5d7e
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
81 <script src="view/sample/sample.js"></script> 81 <script src="view/sample/sample.js"></script>
82 <script src="view/topo/topo.js"></script> 82 <script src="view/topo/topo.js"></script>
83 <script src="view/topo/topoEvent.js"></script> 83 <script src="view/topo/topoEvent.js"></script>
84 + <script src="view/topo/topoFilter.js"></script>
84 <script src="view/topo/topoForce.js"></script> 85 <script src="view/topo/topoForce.js"></script>
85 <script src="view/topo/topoInst.js"></script> 86 <script src="view/topo/topoInst.js"></script>
86 <script src="view/topo/topoModel.js"></script> 87 <script src="view/topo/topoModel.js"></script>
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Topology layer filtering Module.
19 + Provides functionality to visually differentiate between the packet and
20 + optical layers of the topology.
21 + */
22 +
23 +(function () {
24 + 'use strict';
25 +
26 + // injected refs
27 + var $log, fs, flash, tps, tts;
28 +
29 + // api to topoForce
30 + var api;
31 + /*
32 + node() // get ref to D3 selection of nodes
33 + */
34 +
35 + // internal state
36 +
37 +
38 + // === -----------------------------------------------------
39 + // === MODULE DEFINITION ===
40 +
41 + angular.module('ovTopo')
42 + .factory('TopoFilterService',
43 + ['$log', 'FnService',
44 + 'FlashService',
45 + 'TopoPanelService',
46 + 'TopoTrafficService',
47 +
48 + function (_$log_, _fs_, _flash_, _tps_, _tts_) {
49 + $log = _$log_;
50 + fs = _fs_;
51 + flash = _flash_;
52 + tps = _tps_;
53 + tts = _tts_;
54 +
55 + function initFilter(_api_) {
56 + api = _api_;
57 + }
58 +
59 + function destroyFilter() { }
60 +
61 + return {
62 + initFilter: initFilter,
63 + destroyFilter: destroyFilter
64 + };
65 + }]);
66 +}());
...@@ -40,14 +40,15 @@ describe('factory: fw/svg/svgUtil.js', function() { ...@@ -40,14 +40,15 @@ describe('factory: fw/svg/svgUtil.js', function() {
40 40
41 it('should define api functions', function () { 41 it('should define api functions', function () {
42 expect(fs.areFunctions(sus, [ 42 expect(fs.areFunctions(sus, [
43 - 'createDragBehavior', 'loadGlow', 'cat7', 'translate', 'stripPx', 43 + 'createDragBehavior', 'loadGlowDefs', 'cat7',
44 - 'safeId', 'visible' 44 + 'translate',
45 + 'stripPx', 'safeId', 'visible'
45 ])).toBeTruthy(); 46 ])).toBeTruthy();
46 }); 47 });
47 48
48 49
49 // TODO: add unit tests for drag behavior 50 // TODO: add unit tests for drag behavior
50 - // TODO: add unit tests for loadGlow 51 + // TODO: add unit tests for loadGlowDefs
51 52
52 // === cat7 53 // === cat7
53 54
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Topo View -- Topo Filter Service - Unit Tests
19 + */
20 +describe('factory: view/topo/topoFilter.js', function() {
21 + var $log, fs, filter;
22 +
23 + beforeEach(module('ovTopo', 'onosUtil', 'onosLayer'));
24 +
25 + beforeEach(inject(function (_$log_, FnService, TopoFilterService) {
26 + $log = _$log_;
27 + fs = FnService;
28 + filter = TopoFilterService;
29 + }));
30 +
31 + it('should define TopoFilterService', function () {
32 + expect(filter).toBeDefined();
33 + });
34 +
35 + it('should define api functions', function () {
36 + expect(fs.areFunctions(filter, [
37 + 'initFilter', 'destroyFilter'
38 + ])).toBeTruthy();
39 + });
40 +
41 + // TODO: more tests...
42 +});
...@@ -37,7 +37,7 @@ describe('factory: view/topo/topoForce.js', function() { ...@@ -37,7 +37,7 @@ describe('factory: view/topo/topoForce.js', function() {
37 'initForce', 'newDim', 'destroyForce', 37 'initForce', 'newDim', 'destroyForce',
38 38
39 'updateDeviceColors', 'toggleHosts', 'toggleOffline', 39 'updateDeviceColors', 'toggleHosts', 'toggleOffline',
40 - 'cycleDeviceLabels', 'unpin', 40 + 'cycleDeviceLabels', 'unpin', 'showMastership',
41 41
42 'addDevice', 'updateDevice', 'removeDevice', 42 'addDevice', 'updateDevice', 'removeDevice',
43 'addHost', 'updateHost', 'removeHost', 43 'addHost', 'updateHost', 'removeHost',
......
...@@ -36,7 +36,8 @@ describe('factory: view/topo/topoInst.js', function() { ...@@ -36,7 +36,8 @@ describe('factory: view/topo/topoInst.js', function() {
36 expect(fs.areFunctions(tis, [ 36 expect(fs.areFunctions(tis, [
37 'initInst', 'destroyInst', 37 'initInst', 'destroyInst',
38 'addInstance', 'updateInstance', 'removeInstance', 38 'addInstance', 'updateInstance', 'removeInstance',
39 - 'isVisible', 'show', 'hide', 'toggle' 39 + 'cancelAffinity',
40 + 'isVisible', 'show', 'hide', 'toggle', 'showMaster'
40 ])).toBeTruthy(); 41 ])).toBeTruthy();
41 }); 42 });
42 43
......