diff options
Diffstat (limited to 'policy-core')
6 files changed, 27 insertions, 22 deletions
diff --git a/policy-core/pom.xml b/policy-core/pom.xml index 25b099c0..632cb1ae 100644 --- a/policy-core/pom.xml +++ b/policy-core/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP Policy Engine - Drools PDP ================================================================================ - Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019 Bell Canada. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -101,7 +101,7 @@ <dependency> <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> + <artifactId>powermock-api-mockito2</artifactId> <scope>test</scope> </dependency> @@ -136,7 +136,7 @@ with minor changes --> <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> - <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories> <includeResources>true</includeResources> <includeTestSourceDirectory>true</includeTestSourceDirectory> <includeTestResources>true</includeTestResources> diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySessionFeatureApi.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySessionFeatureApi.java index 181fbe55..535b1d8b 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySessionFeatureApi.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySessionFeatureApi.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * policy-core * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 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. @@ -40,7 +40,8 @@ public interface PolicySessionFeatureApi extends OrderedService { * @param args standard 'main' arguments, which are currently ignored * @param configDir the relative directory containing configuration files */ - default void globalInit(String[] args, String configDir) {} + default void globalInit(String[] args, String configDir) { + } /** * This method is used to create a 'KieSession' as part of a @@ -67,7 +68,8 @@ public interface PolicySessionFeatureApi extends OrderedService { * * @param policySession the new 'PolicySession' instance */ - default void newPolicySession(PolicySession policySession) {} + default void newPolicySession(PolicySession policySession) { + } /** * This method is called to select the 'ThreadModel' instance associated @@ -98,7 +100,8 @@ public interface PolicySessionFeatureApi extends OrderedService { * @param policySession the 'PolicySession' object that wrapped the * 'KieSession' */ - default void disposeKieSession(PolicySession policySession) {} + default void disposeKieSession(PolicySession policySession) { + } /** * This method is called after 'KieSession.destroy()' is called. @@ -106,5 +109,6 @@ public interface PolicySessionFeatureApi extends OrderedService { * @param policySession the 'PolicySession' object that wrapped the * 'KieSession' */ - default void destroyKieSession(PolicySession policySession) {} + default void destroyKieSession(PolicySession policySession) { + } } diff --git a/policy-core/src/main/java/org/onap/policy/drools/util/KieUtils.java b/policy-core/src/main/java/org/onap/policy/drools/util/KieUtils.java index bd1c6cee..c260924b 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/util/KieUtils.java +++ b/policy-core/src/main/java/org/onap/policy/drools/util/KieUtils.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 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,18 +24,17 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; + import lombok.NonNull; + import org.apache.commons.io.IOUtils; import org.drools.compiler.kie.builder.impl.InternalKieModule; import org.drools.compiler.kproject.models.KieModuleModelImpl; @@ -74,7 +73,7 @@ public class KieUtils { * Installs a rules artifact in the local maven repository. */ public static ReleaseId installArtifact(File kmodule, File pom, String drlKJarPath, @NonNull List<File> drls) - throws IOException { + throws IOException { KieModuleModel kieModule = KieModuleModelImpl.fromXML(kmodule); final KieFileSystem kieFileSystem = KieServices.Factory.get().newKieFileSystem(); @@ -92,7 +91,7 @@ public class KieUtils { * Installs a rules artifact in the local maven repository. */ public static ReleaseId installArtifact(File kmodule, File pom, String drlKJarPath, File drl) - throws IOException { + throws IOException { return installArtifact(kmodule, pom, drlKJarPath, Collections.singletonList(drl)); } diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java index c21ce7de..1ed27890 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018, 2020 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. @@ -135,7 +135,9 @@ public class PolicySessionTest { } @Override - public void start() {} + public void start() { + // do nothing + } }; model.updated(); diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java index aab04dc4..902f3043 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/LockImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -29,7 +29,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; diff --git a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java index 89ab9d0a..97110744 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/util/KieUtilsTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -65,7 +65,7 @@ public class KieUtilsTest { } @Test - public void installArtifact() throws IOException { + public void testInstallArtifact() throws IOException { ReleaseId releaseId = KieUtils.installArtifact( Paths.get("src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml").toFile(), @@ -77,7 +77,7 @@ public class KieUtilsTest { } @Test - public void installArtifactList() throws IOException { + public void testInstallArtifactList() throws IOException { ReleaseId releaseId = KieUtils.installArtifact( Paths.get("src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml").toFile(), @@ -124,7 +124,7 @@ public class KieUtilsTest { } @Test - public void resourceToPackagesTests() { + public void testResourceToPackages() { // Some minimal logging -- it would be nice to verify the 'KieUtils' logger messages StringBuffer log; |