From d7630c4c59a2d5947d942684bbe4ce8741a8fa7b Mon Sep 17 00:00:00 2001 From: ramverma Date: Thu, 25 Oct 2018 17:19:16 +0100 Subject: Fix refering to snapshot in policy/engine Issue-ID: POLICY-1213 Change-Id: I6666585a176b9e981976777018e4b7616e47ffc7 Signed-off-by: ramverma --- BRMSGateway/config.properties | 2 +- BRMSGateway/dependency.json | 58 +++++++++++----------- BRMSGateway/pom.xml | 4 +- .../java/org/onap/policy/brms/api/BrmsPush.java | 52 +++++++++---------- BRMSGateway/src/test/resources/config.properties | 2 +- 5 files changed, 57 insertions(+), 61 deletions(-) (limited to 'BRMSGateway') diff --git a/BRMSGateway/config.properties b/BRMSGateway/config.properties index 45ce3f02c..c795aa4a3 100644 --- a/BRMSGateway/config.properties +++ b/BRMSGateway/config.properties @@ -77,6 +77,6 @@ ping_interval=30000 # # # -brms.dependency.version=1.3.0-SNAPSHOT +brms.dependency.version=1.3.1-SNAPSHOT ENVIRONMENT = DEVL diff --git a/BRMSGateway/dependency.json b/BRMSGateway/dependency.json index d4ed9c78c..32f6bc927 100644 --- a/BRMSGateway/dependency.json +++ b/BRMSGateway/dependency.json @@ -3,120 +3,120 @@ "default": [{ "groupId": "org.onap.policy.drools-applications.controlloop.templates", "artifactId": "template.demo", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "events", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "rest", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "appc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "aai", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "so", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "sdnc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "sdnr", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "trafficgenerator", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }], "amsterdam": [{ "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "events", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "appc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "appclcm", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "vfc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "so", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "sdnr", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "sdnc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "aai", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "sdc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.model-impl", "artifactId": "trafficgenerator", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common", "artifactId": "eventmanager", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common", "artifactId": "guard", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actorServiceProvider", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.appc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.appclcm", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.so", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.sdnc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.sdnr", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.vfc", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications.controlloop.common", "artifactId": "policy-yaml", - "version": "1.3.0-SNAPSHOT" + "version": "1.3.1-SNAPSHOT" }, { "groupId": "com.att.research.xacml", "artifactId": "xacml-pdp", diff --git a/BRMSGateway/pom.xml b/BRMSGateway/pom.xml index 4071eac27..62c6e55e4 100644 --- a/BRMSGateway/pom.xml +++ b/BRMSGateway/pom.xml @@ -24,7 +24,7 @@ org.onap.policy.engine PolicyEngineSuite - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT BRMSGateway This application will take in BRMS rules and acts as interface between PR and PDP XACML @@ -58,7 +58,7 @@ org.onap.policy.common integrity-monitor - ${project.version} + ${version.policy.common} com.thoughtworks.xstream diff --git a/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java index 8181c0004..a7c21a890 100644 --- a/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java +++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -74,7 +74,6 @@ import org.apache.maven.shared.invoker.InvocationRequest; import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.invoker.Invoker; import org.codehaus.plexus.util.IOUtil; - import org.codehaus.plexus.util.WriterFactory; import org.eclipse.persistence.config.PersistenceUnitProperties; import org.onap.policy.api.PEDependency; @@ -98,9 +97,9 @@ import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; /** - * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR). - * Mavenize and push policy to PR - * + * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR). Mavenize and push policy + * to PR + * * @version 1.0 */ @@ -118,8 +117,8 @@ public class BrmsPush { private static final String RESOURCES = "resources"; private static final Logger LOGGER = FlexLogger.getLogger(BrmsPush.class.getName()); private static final String PROJECTSLOCATION = "RuleProjects"; - private static final String[] GOALS = {"clean", "deploy"}; - private static final String DEFAULT_VERSION = "1.3.0-SNAPSHOT"; + private static final String[] GOALS = { "clean", "deploy" }; + private static final String DEFAULT_VERSION = "1.3.1-SNAPSHOT"; private static final String DEPENDENCY_FILE = "dependency.json"; private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml"; @@ -151,7 +150,7 @@ public class BrmsPush { /** * Responsible to push policies to the BRMS PDP Policy Repository (PR). - * + * * @param propertiesFile the properties file * @param handler the {@link BackUpHandler} * @throws PolicyException PolicyException related to the operation @@ -415,7 +414,7 @@ public class BrmsPush { final ArrayList userDependencies = new ArrayList<>(); for (final Map.Entry entry : responseAttributes.entrySet()) { final String key = entry.getKey(); - String value = entry.getValue(); + final String value = entry.getValue(); if (key.equals(policyKeyId)) { selectedName = value; } @@ -462,14 +461,13 @@ public class BrmsPush { } } - private String getUserControllerName(String key, String value) { + private String getUserControllerName(final String key, final String value) { String userControllerName = null; // Check User Specific values. try { final PEDependency dependency = PolicyUtils.jsonStringToObject(value, PEDependency.class); userControllerName = key.replaceFirst("$controller:", ""); - LOGGER.info("addRule: userControllerName - " + userControllerName + ", dependency: - " - + dependency); + LOGGER.info("addRule: userControllerName - " + userControllerName + ", dependency: - " + dependency); addToGroup(userControllerName, dependency); } catch (final Exception e) { LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Controller: " + e); @@ -477,16 +475,15 @@ public class BrmsPush { return userControllerName; } - private void updateUserDependencies(ArrayList userDependencies, String value) { - //update the user dependencies supplied as parameter to this method + private void updateUserDependencies(final ArrayList userDependencies, String value) { + // update the user dependencies supplied as parameter to this method value = value.substring(1, value.length() - 1).trim(); final List dependencyStrings = Arrays.asList(value.split(Pattern.quote("},{"))); for (final String dependencyString : dependencyStrings) { try { userDependencies.add(PolicyUtils.jsonStringToObject(dependencyString, PEDependency.class)); } catch (final Exception e) { - LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Dependencies: " - + e); + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Dependencies: " + e); } } } @@ -643,13 +640,13 @@ public class BrmsPush { } } - private void parseJarContents(String artifactId, JarFile jar, Enumeration enumEntries) { + private void parseJarContents(final String artifactId, final JarFile jar, final Enumeration enumEntries) { final JarEntry jarEntry = (JarEntry) enumEntries.nextElement(); File file = null; final String fileName = jarEntry.getName().substring(jarEntry.getName().lastIndexOf("/") + 1); if (jarEntry.getName().endsWith(".drl")) { - final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" - + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES; + final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator + + "main" + File.separator + RESOURCES + File.separator + RULES; new File(path).mkdirs(); if (syncFlag && policyMap.containsKey(fileName.replace(".drl", ""))) { file = new File(path + File.separator + fileName); @@ -661,14 +658,13 @@ public class BrmsPush { new File(path).mkdirs(); file = new File(path + File.separator + fileName); } else if (jarEntry.getName().endsWith(KMODULE_XML_FILE)) { - final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" - + File.separator + "main" + File.separator + RESOURCES + File.separator + META_INF; + final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator + + "main" + File.separator + RESOURCES + File.separator + META_INF; new File(path).mkdirs(); file = new File(path + File.separator + fileName); } if (file != null) { - try (InputStream is = jar.getInputStream(jarEntry); - FileOutputStream fos = new FileOutputStream(file)) { + try (InputStream is = jar.getInputStream(jarEntry); FileOutputStream fos = new FileOutputStream(file)) { while (is.available() > 0) { fos.write(is.read()); } @@ -775,7 +771,7 @@ public class BrmsPush { /** * Will Push policies to the PolicyRepo. - * + * * @throws PolicyException PolicyException related to the operation */ public void pushRules() throws PolicyException { @@ -1005,7 +1001,7 @@ public class BrmsPush { /** * Default Dependency Section. Can be changed as required. - * + * * @param controllerName the controller name * @return changed dependency list */ @@ -1090,7 +1086,7 @@ public class BrmsPush { if (config.getProperty(GROUP_NAMES).contains(",")) { groupNames = config.getProperty(GROUP_NAMES).replaceAll(" ", "").split(","); } else { - groupNames = new String[] {config.getProperty(GROUP_NAMES).replaceAll(" ", "")}; + groupNames = new String[] { config.getProperty(GROUP_NAMES).replaceAll(" ", "") }; } if (groupNames == null || groupNames.length == 0) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError); @@ -1247,7 +1243,7 @@ public class BrmsPush { /** * Get URL List Size. - * + * * @return URL list size */ public int urlListSize() { diff --git a/BRMSGateway/src/test/resources/config.properties b/BRMSGateway/src/test/resources/config.properties index ff2e121ee..a90d4513c 100644 --- a/BRMSGateway/src/test/resources/config.properties +++ b/BRMSGateway/src/test/resources/config.properties @@ -81,6 +81,6 @@ ping_interval=30000 # # # -brms.dependency.version=1.3.0-SNAPSHOT +brms.dependency.version=1.3.1-SNAPSHOT ENVIRONMENT = DEVL -- cgit 1.2.3-korg