summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
authorrb7147 <rb7147@att.com>2018-02-26 18:04:46 -0500
committerrb7147 <rb7147@att.com>2018-02-27 09:56:31 -0500
commitccc932599675c927519040399b031ff1d10d9510 (patch)
tree83b43e211d982e2c80eee09e355844dd1b7c8145 /POLICY-SDK-APP
parent47c1630d48e40e1fbc051fa6eae251ffbe1d4945 (diff)
Code Clean Up for Policy PAP-REST
Cleaned the duplicate code for all dictionary controllers and created Utils class. Issue-ID: POLICY-600 Change-Id: I65b8574d9f667758407515a5c55bc28f636be477 Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js20
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js20
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java3
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java6
4 files changed, 22 insertions, 27 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js
index 1065da508..a1b703880 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSConfigNameDictController.js
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
app.controller('editMSConfigController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){
- if(message.microServiceCongigNameDictionaryData==null)
+ if(message.microServiceConfigNameDictionaryData==null)
$scope.label='Add Config Name'
else{
$scope.label='Edit Config Name'
@@ -33,15 +33,15 @@ app.controller('editMSConfigController' , function ($scope, $modalInstance, mes
userid = response.userid;
});
- $scope.editMSConfig = message.microServiceCongigNameDictionaryData;
+ $scope.editMSConfig = message.microServiceConfigNameDictionaryData;
- $scope.saveMSConfig = function(microServiceCongigNameDictionaryData) {
+ $scope.saveMSConfig = function(microServiceConfigNameDictionaryData) {
var regex = new RegExp("^[a-zA-Z0-9_]*$");
- if(!regex.test(microServiceCongigNameDictionaryData.name)) {
+ if(!regex.test(microServiceConfigNameDictionaryData.name)) {
Notification.error("Enter Valid Config Name without spaces or special characters");
}else{
var uuu = "saveDictionary/ms_dictionary/save_configName";
- var postData={microServiceCongigNameDictionaryData: microServiceCongigNameDictionaryData, userid: userid};
+ var postData={microServiceConfigNameDictionaryData: microServiceConfigNameDictionaryData, userid: userid};
$.ajax({
type : 'POST',
url : uuu,
@@ -50,12 +50,12 @@ app.controller('editMSConfigController' , function ($scope, $modalInstance, mes
data: JSON.stringify(postData),
success : function(data){
$scope.$apply(function(){
- $scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;});
- if($scope.microServiceCongigNameDictionaryDatas == "Duplicate"){
+ $scope.microServiceConfigNameDictionaryDatas=data.microServiceConfigNameDictionaryDatas;});
+ if($scope.microServiceConfigNameDictionaryDatas == "Duplicate"){
Notification.error("MS ConfigName Dictionary exists with Same Config Name.")
}else{
- console.log($scope.microServiceCongigNameDictionaryDatas);
- $modalInstance.close({microServiceCongigNameDictionaryDatas:$scope.microServiceCongigNameDictionaryDatas});
+ console.log($scope.microServiceConfigNameDictionaryDatas);
+ $modalInstance.close({microServiceConfigNameDictionaryDatas:$scope.microServiceConfigNameDictionaryDatas});
}
},
error : function(data){
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js
index 8b4d014f1..295d1b803 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSConfigNameDictGridController.js
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
var j = data;
$scope.data = JSON.parse(j.data);
console.log($scope.data);
- $scope.microServiceCongigNameDictionaryDatas = JSON.parse($scope.data.microServiceCongigNameDictionaryDatas);
- console.log($scope.microServiceCongigNameDictionaryDatas);
+ $scope.microServiceConfigNameDictionaryDatas = JSON.parse($scope.data.microServiceConfigNameDictionaryDatas);
+ console.log($scope.microServiceConfigNameDictionaryDatas);
}, function (error) {
console.log("failed");
});
@@ -69,7 +69,7 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
resolve: {
message: function () {
var message = {
- microServiceCongigNameDictionaryDatas: $scope.editMSConfig
+ microServiceConfigNameDictionaryDatas: $scope.editMSConfig
};
return message;
}
@@ -77,12 +77,12 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
});
modalInstance.result.then(function(response){
console.log('response', response);
- $scope.microServiceCongigNameDictionaryDatas=response.microServiceCongigNameDictionaryDatas;
+ $scope.microServiceConfigNameDictionaryDatas=response.microServiceConfigNameDictionaryDatas;
});
};
- $scope.editMSConfigNameWindow = function(microServiceCongigNameDictionaryData) {
- $scope.editMSConfig = microServiceCongigNameDictionaryData;
+ $scope.editMSConfigNameWindow = function(microServiceConfigNameDictionaryData) {
+ $scope.editMSConfig = microServiceConfigNameDictionaryData;
var modalInstance = $modal.open({
backdrop: 'static', keyboard: false,
templateUrl : 'add_msConfigName_popup.html',
@@ -90,7 +90,7 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
resolve: {
message: function () {
var message = {
- microServiceCongigNameDictionaryData: $scope.editMSConfig
+ microServiceConfigNameDictionaryData: $scope.editMSConfig
};
return message;
}
@@ -98,7 +98,7 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
});
modalInstance.result.then(function(response){
console.log('response', response);
- $scope.microServiceCongigNameDictionaryDatas = response.microServiceCongigNameDictionaryDatas;
+ $scope.microServiceConfigNameDictionaryDatas = response.microServiceConfigNameDictionaryDatas;
});
};
@@ -114,7 +114,7 @@ app.controller('msConfigNameDictGridController', function ($scope, PolicyAppServ
contentType: 'application/json',
data: JSON.stringify(postData),
success : function(data){
- $scope.$apply(function(){$scope.microServiceCongigNameDictionaryDatas=data.microServiceCongigNameDictionaryDatas;});
+ $scope.$apply(function(){$scope.microServiceConfigNameDictionaryDatas=data.microServiceConfigNameDictionaryDatas;});
},
error : function(data){
console.log(data);
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
index 7ca788995..be0a92e55 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ package org.onap.policy.admin;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
import java.io.BufferedReader;
import java.io.File;
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
index a2f24ebe1..8d8f57b0d 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -558,10 +558,6 @@ public class CreateDcaeMicroServiceControllerTest {
public void testSetMSModelData() {
logger.debug("testSetMSModelData: enter");
-
- CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
-
- MockHttpServletResponse response = new MockHttpServletResponse();
HttpServletRequest request = createMock(HttpServletRequest.class);
expect(request.getContentType()).andReturn("multipart/form-data; boundary=----WebKitFormBoundaryWcRUaIbC8kXgjr3p");