Fixed ceilometer bug
diff --git a/views/ngXosLib/README.md b/views/ngXosLib/README.md
index 0166efd..cfce430 100644
--- a/views/ngXosLib/README.md
+++ b/views/ngXosLib/README.md
@@ -51,6 +51,8 @@
 
 >_NOTE: for the API related service, check documentation in [Apigen](#apigen) section._
 
+When some changes are applied to this common library it should be rebuilt with: `npm run build`
+
 ### Yo Xos
 
 We have created a [yeoman](http://yeoman.io/) generator to help you scaffolding views.
diff --git a/views/ngXosLib/karma.conf.js b/views/ngXosLib/karma.conf.js
index b75f95b..803ebb1 100644
--- a/views/ngXosLib/karma.conf.js
+++ b/views/ngXosLib/karma.conf.js
@@ -11,6 +11,8 @@
   return path.relative(process.cwd(), file);
 });
 
+console.log('bower', bowerComponents)
+
 module.exports = function(config) {
 /*eslint-enable*/
   config.set({
@@ -26,9 +28,10 @@
 
     // list of files / patterns to load in the browser
     files: bowerComponents.concat([
-      'xosHelpers/src/*.module.js',
-      'xosHelpers/src/**/*.js',
-      'xosHelpers/spec/**/*.test.js',
+      //'./api/**/*.js',
+      './xosHelpers/src/*.module.js',
+      //'./xosHelpers/src/**/*.js',
+      './xosHelpers/spec/**/*.test.js'
     ]),
 
 
@@ -40,15 +43,24 @@
     // preprocess matching files before serving them to the browser
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
     preprocessors: {
-      '**/*.test.js': ['babel'],
-      'src/**/*.html': ['ng-html2js']
+      '**/*.test.js': ['babel']
     },
 
-    ngHtml2JsPreprocessor: {
-      stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
-      moduleName: 'templates' // define the template module name
+    babelPreprocessor: {
+      options: {
+        presets: ['es2015'],
+        sourceMap: 'inline'
+      },
+      filename: function (file) {
+        return file.originalPath;
+      },
     },
 
+    //ngHtml2JsPreprocessor: {
+    //  stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
+    //  moduleName: 'templates' // define the template module name
+    //},
+
     // test results reporter to use
     // possible values: 'dots', 'progress'
     // available reporters: https://npmjs.org/browse/keyword/karma-reporter
@@ -65,7 +77,7 @@
 
     // level of logging
     // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
-    logLevel: config.LOG_DEBUG,
+    logLevel: config.LOG_INFO,
 
 
     // enable / disable watching file and executing tests whenever any file changes
diff --git a/views/ngXosLib/package.json b/views/ngXosLib/package.json
index 9e13e28..8ae1e6e 100644
--- a/views/ngXosLib/package.json
+++ b/views/ngXosLib/package.json
@@ -8,14 +8,14 @@
     "apigen": "node xos-resource-generator.js",
     "swagger": "node xos-swagger-def.js",
     "apidoc": "jsdoc api/ng-xos.js api/ng-xoslib.js api/ng-hpcapi.js -d api/docs",
-    "build": "gulp vendor"
+    "build": "gulp vendor && gulp helpers"
   },
   "author": "Matteo Scandolo",
   "license": "ISC",
   "dependencies": {
     "bluebird": "^3.0.5",
     "chalk": "^1.1.1",
-    "concat": "^1.0.0",
+    "concat": "^2.0.0",
     "eslint": "^1.8.0",
     "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
     "fetch-swagger-schema": "^0.1.2",
@@ -23,6 +23,7 @@
     "swagger-js-codegen": "^1.1.5"
   },
   "devDependencies": {
+    "babel-preset-es2015": "^6.6.0",
     "gulp": "^3.9.0",
     "gulp-angular-filesort": "^1.1.1",
     "gulp-concat": "^2.6.0",
diff --git a/views/ngXosLib/xosHelpers/spec/csrftoken.test.js b/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
index e49c52b..60e8c63 100644
--- a/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
+++ b/views/ngXosLib/xosHelpers/spec/csrftoken.test.js
@@ -1,22 +1,24 @@
 'use strict';
-
 describe('The xos.helper module', function(){
-  
-  var app, httpProvider;
+  var SetCSRFToken, httpProviderObj;
 
   beforeEach(module('xos.helpers'));
 
-  beforeEach(function(){
-    module(function(_$httpProvider_){
-      console.log('beforeEach');
-      httpProvider = _$httpProvider_;
-    });
-  });
-
-  it('should set SetCSRFToken interceptor', inject(function($http){
-    console.log('httpProvider',httpProvider);
-    expect(true).toBeTrue();
-    // expect(httpProvider.interceptors).toContain('SetCSRFToken');
+  beforeEach(module(function(_$httpProvider_){
+    httpProviderObj = _$httpProvider_;
   }));
 
+  beforeEach(angular.mock.inject(function(_SetCSRFToken_){
+    SetCSRFToken = _SetCSRFToken_;
+  }));
+
+  it('should exist', () => {
+    expect(SetCSRFToken).toBeDefined();
+  });
+  
+  xit('should set SetCSRFToken interceptor', () => {
+    expect(httpProviderObj).toBeDefined();
+    expect(httpProviderObj.interceptors).toContain('SetCSRFToken');
+  });
+
 });
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
index 283e90d..f3a234e 100644
--- a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
+++ b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
@@ -1,6 +1,8 @@
 (function() {
     'use strict';
 
+    console.log('SetCSRFToken');
+
     angular
         .module('xos.helpers')
         .factory('SetCSRFToken', setCSRFToken);
diff --git a/views/ngXosLib/xosHelpers/src/xosHelpers.module.js b/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
index d5b53da..7c97de0 100644
--- a/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
+++ b/views/ngXosLib/xosHelpers/src/xosHelpers.module.js
@@ -1,6 +1,6 @@
 (function() {
     'use strict';
-
+    console.log('XOS Helpers Module')
     angular.module('bugSnag', []).factory('$exceptionHandler', function () {
       return function (exception, cause) {
         if( window.Bugsnag ){
@@ -18,11 +18,12 @@
           'xos.xos',
           'xos.hpcapi',
           'xos.xoslib',
-          'bugSnag'
+          'bugSnag',
         ])
         .config(config);
 
-    function config($httpProvider, $interpolateProvider, $resourceProvider) { 
+    function config($httpProvider, $interpolateProvider, $resourceProvider) {
+      console.log('xos.helpers config')
       $httpProvider.interceptors.push('SetCSRFToken');
 
       $interpolateProvider.startSymbol('{$');
diff --git a/views/ngXosViews/ceilometerDashboard/env/default.js b/views/ngXosViews/ceilometerDashboard/env/default.js
index c7a21c8..a68a4ae 100644
--- a/views/ngXosViews/ceilometerDashboard/env/default.js
+++ b/views/ngXosViews/ceilometerDashboard/env/default.js
@@ -7,7 +7,7 @@
 // (works only for local environment as both application are served on the same domain)
 
 module.exports = {
-  host: 'http://apt016.apt.emulab.net:9999/',
-  xoscsrftoken: 'g0NmwGn8LGsbgFINdvv634YFAVxfWR35',
-  xossessionid: 'fv9sduix69ow31gfn1nfqpppflo3ah5y'
+  host: 'http://apt020.apt.emulab.net:9999/',
+  xoscsrftoken: 'g6cCHldtlqDm0BzoKHgPyP2KzGSCUFgW',
+  xossessionid: '5ofvr4o8pwyqsff1zbd9ca1wsqf023uy'
 };
diff --git a/views/ngXosViews/ceilometerDashboard/karma.conf.js b/views/ngXosViews/ceilometerDashboard/karma.conf.js
index 1978cbd..cbc5a83 100644
--- a/views/ngXosViews/ceilometerDashboard/karma.conf.js
+++ b/views/ngXosViews/ceilometerDashboard/karma.conf.js
@@ -26,8 +26,10 @@
     // list of files / patterns to load in the browser
     files: bowerComponents.concat([
       'src/css/**/*.css',
-      '../../../xos/core/xoslib/static/js/xosApi.js',
+      '../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js',
       '../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js',
+      '../../../xos/core/xoslib/static/js/xosApi.js',
+      'src/js/main.js',
       'src/js/**/*.js',
       'spec/**/*.mock.js',
       'spec/**/*.test.js',
diff --git a/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js b/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
index 86ed3d8..2908041 100644
--- a/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
+++ b/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
@@ -26,42 +26,42 @@
     {
       meter: 'cpu',
       resource_name: 'fakeName',
-      project_id: 'fakeTenant',
+      resource_id: 'fakeTenant',
       timestamp: '2015-12-15T00:34:08',
       volume: 110
     },
     {
       meter: 'cpu',
       resource_name: 'fakeName',
-      project_id: 'fakeTenant',
+      resource_id: 'fakeTenant',
       timestamp: '2015-12-15T00:44:08',
       volume: 120
     },
     {
       meter: 'cpu',
       resource_name: 'anotherName',
-      project_id: 'anotherTenant',
+      resource_id: 'anotherTenant',
       timestamp: '2015-12-15T00:24:08',
       volume: 210
     },
     {
       meter: 'cpu',
       resource_name: 'anotherName',
-      project_id: 'anotherTenant',
+      resource_id: 'anotherTenant',
       timestamp: '2015-12-15T00:34:08',
       volume: 220
     },
     {
       meter: 'cpu',
       resource_name: 'anotherName',
-      project_id: 'anotherTenant',
+      resource_id: 'anotherTenant',
       timestamp: '2015-12-15T00:44:08',
       volume: 230
     },
     {
       meter: 'cpu',
       resource_name: 'thirdName',
-      project_id: 'thirdTenant',
+      resource_id: 'thirdTenant',
       timestamp: '2015-12-15T00:44:08',
       volume: 310
     }
@@ -70,7 +70,7 @@
   const mapping = [
     {
       service: 'service-a',
-      slice: [
+      slices: [
         {
           project_id: 'id-a-1',
           slice: 'slice-a-1'
@@ -83,7 +83,7 @@
     },
     {
       service: 'service-b',
-      slice: [
+      slices: [
         {
           project_id: 'id-b-1',
           slice: 'slice-b-1'
diff --git a/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js b/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
index cbd8ca0..933f892 100644
--- a/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
+++ b/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
@@ -21,31 +21,17 @@
       httpBackend.flush();
     }));
 
-    xdescribe('when loading meters', () => {
-      it('should group meters by services', () => {
-        expect(Object.keys(vm.projects).length).toBe(2);
-      });
-
-      it('should group services by slices', () => {
-        expect(Object.keys(vm.projects.service_2).length).toBe(2);
-      });
-
-      it('should group slices by resources', () => {
-        expect(Object.keys(vm.projects.service_2.slice_2).length).toBe(2);
-      });
-    });
-
     describe('when loading service list', () => {
       it('should append the list to the scope', () => {
         expect(vm.services.length).toBe(2);
-        expect(vm.services[0].slice.length).toBe(2);
-        expect(vm.services[1].slice.length).toBe(2);
+        expect(vm.services[0].slices.length).toBe(2);
+        expect(vm.services[1].slices.length).toBe(2);
       });
     });
 
     describe('when a slice is selected', () => {
       it('should load corresponding meters', () => {
-        vm.loadSliceMeter(vm.services[0].slice[0]);
+        vm.loadSliceMeter(vm.services[0].slices[0]);
 
         httpBackend.flush();
 
@@ -89,7 +75,7 @@
       expect(vm.chart.data[0].length).toBe(2);
       expect(vm.chart.data[0][0]).toBe(110);
       expect(vm.chart.data[0][1]).toBe(120);
-      expect(vm.chartMeters[0].project_id).toBe('fakeTenant')
+      expect(vm.chartMeters[0].resource_id).toBe('fakeTenant')
       expect(vm.chartMeters[0].resource_name).toBe('fakeName')
     });
 
@@ -100,7 +86,7 @@
       expect(vm.chart.data[1][0]).toBe(210);
       expect(vm.chart.data[1][1]).toBe(220);
       expect(vm.chart.data[1][2]).toBe(230);
-      expect(vm.chartMeters[1].project_id).toBe('anotherTenant')
+      expect(vm.chartMeters[1].resource_id).toBe('anotherTenant')
       expect(vm.chartMeters[1].resource_name).toBe('anotherName')
     });
 
@@ -112,7 +98,7 @@
       expect(vm.chart.data[0][0]).toBe(210);
       expect(vm.chart.data[0][1]).toBe(220);
       expect(vm.chart.data[0][2]).toBe(230);
-      expect(vm.chartMeters[0].project_id).toBe('anotherTenant')
+      expect(vm.chartMeters[0].resource_id).toBe('anotherTenant')
       expect(vm.chartMeters[0].resource_name).toBe('anotherName')
     });
 
@@ -120,10 +106,10 @@
       it('should create an array of unique labels', () => {
         // unique because every resource has multiple samples (time-series)
         const samples = [
-          {project_id: 1, resource_name: 'fakeName'},
-          {project_id: 1, resource_name: 'fakeName'},
-          {project_id: 2, resource_name: 'anotherName'},
-          {project_id: 2, resource_name: 'anotherName'}
+          {resource_id: 1, resource_name: 'fakeName'},
+          {resource_id: 1, resource_name: 'fakeName'},
+          {resource_id: 2, resource_name: 'anotherName'},
+          {resource_id: 2, resource_name: 'anotherName'}
         ];
 
         const result = vm.formatSamplesLabels(samples);
diff --git a/views/ngXosViews/ceilometerDashboard/src/js/dashboard.directive.js b/views/ngXosViews/ceilometerDashboard/src/js/dashboard.directive.js
index 8f8487d..a1ae36a 100644
--- a/views/ngXosViews/ceilometerDashboard/src/js/dashboard.directive.js
+++ b/views/ngXosViews/ceilometerDashboard/src/js/dashboard.directive.js
@@ -45,7 +45,6 @@
           /**
            * Load the list of service and slices
            */
-
           this.loadMappings = () => {
             this.loader = true;
             Ceilometer.getMappings()
@@ -92,7 +91,6 @@
           /**
            * Load the list of a single slice
            */
-
           this.loadSliceMeter = (slice, service_name) => {
 
             Ceilometer.selectedSlice = null;
diff --git a/views/ngXosViews/ceilometerDashboard/src/js/samples.directive.js b/views/ngXosViews/ceilometerDashboard/src/js/samples.directive.js
index 1bcb838..42b08e5 100644
--- a/views/ngXosViews/ceilometerDashboard/src/js/samples.directive.js
+++ b/views/ngXosViews/ceilometerDashboard/src/js/samples.directive.js
@@ -44,7 +44,7 @@
         if($stateParams.name && $stateParams.tenant){
           this.name = $stateParams.name;
           this.tenant = $stateParams.tenant;
-          // TODO rename tenant in project_id
+          // TODO rename tenant in resource_id
         }
         else{
           throw new Error('Missing Name and Tenant Params!');
diff --git a/views/ngXosViews/contentProvider/karma.conf.js b/views/ngXosViews/contentProvider/karma.conf.js
index 83d3f63..b4d5d33 100644
--- a/views/ngXosViews/contentProvider/karma.conf.js
+++ b/views/ngXosViews/contentProvider/karma.conf.js
@@ -26,8 +26,9 @@
 
     // list of files / patterns to load in the browser
     files: bowerComponents.concat([
-      '../../static/js/xosApi.js',
-      '../../static/js/vendor/ngXosHelpers.js',
+      '../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js',
+      '../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js',
+      '../../../xos/core/xoslib/static/js/xosApi.js',
       'src/js/**/*.js',
       'spec/**/*.mock.js',
       'spec/**/*.test.js',
diff --git a/views/ngXosViews/contentProvider/package.json b/views/ngXosViews/contentProvider/package.json
index 80d34f9..ee09c4c 100644
--- a/views/ngXosViews/contentProvider/package.json
+++ b/views/ngXosViews/contentProvider/package.json
@@ -21,25 +21,34 @@
   "devDependencies": {
     "browser-sync": "^2.9.11",
     "del": "^2.0.2",
+    "eslint": "^1.8.0",
+    "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
     "gulp": "^3.9.0",
     "gulp-angular-filesort": "^1.1.1",
     "gulp-angular-templatecache": "^1.8.0",
     "gulp-babel": "^5.3.0",
     "gulp-concat": "^2.6.0",
+    "gulp-eslint": "^1.0.0",
     "gulp-inject": "^3.0.0",
     "gulp-minify-html": "^1.0.4",
+    "gulp-ng-annotate": "^1.1.0",
     "gulp-rename": "^1.2.2",
     "gulp-replace": "^0.5.4",
     "gulp-uglify": "^1.4.2",
     "http-proxy": "^1.12.0",
+    "jasmine-core": "^2.4.1",
+    "karma": "^0.13.22",
+    "karma-babel-preprocessor": "~5.2.2",
+    "karma-coverage": "^0.5.3",
+    "karma-jasmine": "~0.3.6",
+    "karma-mocha-reporter": "~1.1.1",
+    "karma-ng-html2js-preprocessor": "^0.2.0",
+    "karma-phantomjs-launcher": "~0.2.1",
+    "lodash": "^3.10.1",
+    "phantomjs": "^2.1.3",
     "proxy-middleware": "^0.15.0",
     "run-sequence": "^1.1.4",
     "wiredep": "^3.0.0-beta",
-    "wrench": "^1.5.8",
-    "gulp-ng-annotate": "^1.1.0",
-    "lodash": "^3.10.1",
-    "eslint": "^1.8.0",
-    "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
-    "gulp-eslint": "^1.0.0"
+    "wrench": "^1.5.8"
   }
 }
diff --git a/views/ngXosViews/contentProvider/spec/sample.test.js b/views/ngXosViews/contentProvider/spec/sample.test.js
deleted file mode 100644
index 177bc7d..0000000
--- a/views/ngXosViews/contentProvider/spec/sample.test.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-describe('The User List', () => {
-  
-  var scope, element, isolatedScope, httpBackend;
-
-  beforeEach(module('xos.contentProvider'));
-  beforeEach(module('templates'));
-
-  beforeEach(inject(function($httpBackend, $compile, $rootScope){
-    
-    httpBackend = $httpBackend;
-    // Setting up mock request
-    $httpBackend.expectGET('/xos/users/?no_hyperlinks=1').respond([
-      {
-        email: 'matteo.scandolo@link-me.it',
-        firstname: 'Matteo',
-        lastname: 'Scandolo' 
-      }
-    ]);
-  
-    scope = $rootScope.$new();
-    element = angular.element('<users-list></users-list>');
-    $compile(element)(scope);
-    scope.$digest();
-    isolatedScope = element.isolateScope().vm;
-  }));
-
-  it('should load 1 users', () => {
-    httpBackend.flush();
-    expect(isolatedScope.users.length).toBe(1);
-    expect(isolatedScope.users[0].email).toEqual('matteo.scandolo@link-me.it');
-    expect(isolatedScope.users[0].firstname).toEqual('Matteo');
-    expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
-  });
-
-});
\ No newline at end of file