tested Origin Server
diff --git a/xos/core/xoslib/spec/views/contentprovider.test.js b/xos/core/xoslib/spec/views/contentprovider.test.js
index 55a78b6..64b676a 100644
--- a/xos/core/xoslib/spec/views/contentprovider.test.js
+++ b/xos/core/xoslib/spec/views/contentprovider.test.js
@@ -144,4 +144,35 @@
expect(isolatedScope.cp_prf.length).toBe(0);
});
});
+
+ describe('the contentProviderServer directive', () => {
+ beforeEach(inject(($compile, $rootScope) => {
+ scope = $rootScope.$new();
+ element = angular.element('<content-provider-server></content-provider-server>');
+ $compile(element)(scope);
+ httpBackend.expectGET('/hpcapi/contentproviders/1/').respond(CPmock.CPlist[0]);
+ httpBackend.expectGET('/hpcapi/originservers/?contentProvider=1').respond(CPmock.OSlist);
+ httpBackend.whenPOST('/hpcapi/originservers/').respond(CPmock.OSlist[0]);
+ httpBackend.whenDELETE('/hpcapi/originservers/8/').respond();
+ scope.$digest();
+ httpBackend.flush();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should load associated OriginServer', () => {
+ expect(isolatedScope.cp_os.length).toBe(4);
+ });
+
+ it('should add a OriginServer', () => {
+ isolatedScope.addOrigin({protocol: 'http', url: 'test.io'});
+ httpBackend.flush();
+ expect(isolatedScope.cp_os.length).toBe(5);
+ });
+
+ it('should remove a OriginServer', () => {
+ isolatedScope.removeOrigin(isolatedScope.cp_os[0]);
+ httpBackend.flush();
+ expect(isolatedScope.cp_os.length).toBe(3);
+ });
+ });
});
diff --git a/xos/core/xoslib/spec/views/mocks/contentProvider.mock.js b/xos/core/xoslib/spec/views/mocks/contentProvider.mock.js
index 0bbd7ce..c0d1750 100644
--- a/xos/core/xoslib/spec/views/mocks/contentProvider.mock.js
+++ b/xos/core/xoslib/spec/views/mocks/contentProvider.mock.js
@@ -359,5 +359,331 @@
'defaultOriginServer':'http://0.0.0.0:9000/hpcapi/originservers/1/',
'enabled':true
}
+ ],
+ OSlist: [
+ {
+ 'humanReadableName':'another.it',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':8,
+ 'created':'2015-10-26T13:40:36.878Z',
+ 'updated':'2015-10-26T13:40:36.878Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'another.it',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'http',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'test.it',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':7,
+ 'created':'2015-10-26T13:36:42.567Z',
+ 'updated':'2015-10-26T13:36:42.567Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'test.it',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'http',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'onlab.vicci.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':2,
+ 'created':'2015-10-26T13:09:44.286Z',
+ 'updated':'2015-10-26T13:09:44.286Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'onlab.vicci.org',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'HTTP',
+ 'redirects':true,
+ 'description':null
+ },
+ {
+ 'humanReadableName':'downloads.onosproject.org',
+ 'validators':{
+ 'updated':[
+
+ ],
+ 'contentProvider':[
+ 'notBlank'
+ ],
+ 'origin_server_id':[
+
+ ],
+ 'policed':[
+
+ ],
+ 'created':[
+
+ ],
+ 'deleted':[
+
+ ],
+ 'description':[
+
+ ],
+ 'enabled':[
+
+ ],
+ 'redirects':[
+
+ ],
+ 'protocol':[
+ 'notBlank'
+ ],
+ 'lazy_blocked':[
+
+ ],
+ 'backend_register':[
+ 'notBlank'
+ ],
+ 'write_protect':[
+
+ ],
+ 'url':[
+ 'notBlank'
+ ],
+ 'authenticated':[
+
+ ],
+ 'backend_status':[
+ 'notBlank'
+ ],
+ 'id':[
+
+ ],
+ 'no_sync':[
+
+ ],
+ 'enacted':[
+
+ ]
+ },
+ 'id':1,
+ 'created':'2015-10-26T13:09:44.182Z',
+ 'updated':'2015-10-26T13:09:44.182Z',
+ 'enacted':null,
+ 'policed':null,
+ 'backend_register':'{}',
+ 'backend_status':'0 - Provisioning in progress',
+ 'deleted':false,
+ 'write_protect':false,
+ 'lazy_blocked':false,
+ 'no_sync':false,
+ 'origin_server_id':null,
+ 'url':'downloads.onosproject.org',
+ 'contentProvider':'http://0.0.0.0:9000/hpcapi/contentproviders/1/',
+ 'authenticated':false,
+ 'enabled':true,
+ 'protocol':'HTTP',
+ 'redirects':true,
+ 'description':null
+ }
]
};
\ No newline at end of file
diff --git a/xos/core/xoslib/static/js/xosContentProvider.js b/xos/core/xoslib/static/js/xosContentProvider.js
index 4b5677e..0c21fe3 100644
--- a/xos/core/xoslib/static/js/xosContentProvider.js
+++ b/xos/core/xoslib/static/js/xosContentProvider.js
@@ -268,6 +268,7 @@
return{
restrict: 'E',
controllerAs: 'vm',
+ scope: {},
templateUrl: '../../static/templates/contentProvider/cp_origin_server.html',
controller: function() {
this.pageName = 'server';