From aff7dbd3713e42412bcc7b5f6416896e16e82898 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Thu, 5 Apr 2018 09:08:44 -0500 Subject: [PATCH] Modified DB Upgrade script for OptimizationModels Changed the incorrect column 'dataorder' to 'dataorderinfo' Made changes to pom and AAF client code per AAF API changes in new depedency. Change-Id: Ic9bf0edec8282cc0f96d6fedd62fa9253d52070f Issue-ID: POLICY-731 Signed-off-by: Michael Mokry --- PolicyEngineUtils/pom.xml | 6 +++--- .../java/org/onap/policy/utils/AAFPolicyClientImpl.java | 14 ++++++++------ .../src/files/install/mysql/data/180601_upgrade_script.sql | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/PolicyEngineUtils/pom.xml b/PolicyEngineUtils/pom.xml index 9ae92caa8..e9662d8c9 100644 --- a/PolicyEngineUtils/pom.xml +++ b/PolicyEngineUtils/pom.xml @@ -97,9 +97,9 @@ - org.onap.aaf.cadi - cadi-aaf - 1.0.0 + org.onap.aaf.authz + aaf-cadi-aaf + 2.1.0 com.google.code.gson diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java index 7abf60dae..732183d47 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PolicyEngineUtils * ================================================================================ - * 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. @@ -17,10 +17,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - - package org.onap.policy.utils; +import java.security.Principal; import java.util.Properties; import org.apache.log4j.Logger; @@ -30,9 +29,11 @@ import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.aaf.AAFPermission; import org.onap.aaf.cadi.aaf.v2_0.AAFAuthn; import org.onap.aaf.cadi.aaf.v2_0.AAFCon; -import org.onap.aaf.cadi.aaf.v2_0.AAFConDME2; +import org.onap.aaf.cadi.aaf.v2_0.AAFConHttp; import org.onap.aaf.cadi.aaf.v2_0.AAFLurPerm; import org.onap.aaf.cadi.config.Config; +import org.onap.aaf.cadi.locator.PropertyLocator; +import org.onap.aaf.cadi.principal.UnAuthPrincipal; @@ -187,7 +188,8 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ try { aafCon.basicAuth(userName, pass); AAFPermission perm = new AAFPermission(type, instance, action); - result = aafLurPerm.fish(userName, perm); + final Principal p = new UnAuthPrincipal(userName); + result = aafLurPerm.fish(p, perm); } catch (CadiException e) { logger.error(e.getMessage() + e); aafLurPerm.destroy(); @@ -200,7 +202,7 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ private static boolean setUpAAF(){ try { - aafCon = new AAFConDME2(access); + aafCon = new AAFConHttp(access,new PropertyLocator("https://aaf-onap-beijing-test.osaaf.org:8100")); aafLurPerm = aafCon.newLur(); aafAuthn = aafCon.newAuthn(aafLurPerm); return true; diff --git a/packages/base/src/files/install/mysql/data/180601_upgrade_script.sql b/packages/base/src/files/install/mysql/data/180601_upgrade_script.sql index 1b1fb76a3..56615df06 100644 --- a/packages/base/src/files/install/mysql/data/180601_upgrade_script.sql +++ b/packages/base/src/files/install/mysql/data/180601_upgrade_script.sql @@ -32,7 +32,7 @@ create table `onap_sdk`.`optimizationmodels` ( `version` varchar(45) default null, `annotation` longtext, `enumValues` longtext, -`dataOrder` varchar(2000) DEFAULT NULL, +`dataOrderInfo` varchar(2000) DEFAULT NULL, primary key (`id`), unique key `optimizationmodels_uniq` (`modelname`,`version`) ); -- 2.16.6