From a0e0c7840f72392152a970d88a5a66d394c4a793 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 28 Sep 2018 04:58:26 -0400 Subject: Set drools-pdp checkstyle config Fixed last remaining checkstyle issues along with setting the pom.xml to the correct path setting. Fixed forbidden summary fragments, not allowed to prepend summary with "This method returns" Issue-ID: POLICY-1153 Change-Id: I267842080494132a7b5507731e14f027a3f6fe44 Signed-off-by: Pamela Dragosh --- .../lock/PolicyResourceLockFeatureAPITest.java | 92 ---------------------- .../lock/PolicyResourceLockFeatureApiTest.java | 92 ++++++++++++++++++++++ .../core/lock/PolicyResourceLockManagerTest.java | 16 ++-- 3 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java create mode 100644 policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java (limited to 'policy-core/src/test/java') diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java deleted file mode 100644 index 522a3f51..00000000 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * api-resource-locks - * ================================================================================ - * Copyright (C) 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. - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.drools.core.lock; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -import org.junit.Before; -import org.junit.Test; -import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult; - -public class PolicyResourceLockFeatureAPITest { - - private static final String RESOURCE_ID = "the resource"; - private static final String OWNER = "the owner"; - - private PolicyResourceLockFeatureAPI api; - - /** - * set up. - */ - @Before - public void setUp() { - api = new PolicyResourceLockFeatureAPI() { - @Override - public int getSequenceNumber() { - return 0; - } - }; - } - - @Test - public void testBeforeLock() { - assertEquals(OperResult.OPER_UNHANDLED, api.beforeLock(RESOURCE_ID, OWNER, 0)); - } - - @Test - public void testAfterLock() { - assertFalse(api.afterLock(RESOURCE_ID, OWNER, true)); - assertFalse(api.afterLock(RESOURCE_ID, OWNER, false)); - } - - @Test - public void testBeforeRefresh() { - assertEquals(OperResult.OPER_UNHANDLED, api.beforeRefresh(RESOURCE_ID, OWNER, 0)); - } - - @Test - public void testAfterRefresh() { - assertFalse(api.afterRefresh(RESOURCE_ID, OWNER, true)); - assertFalse(api.afterRefresh(RESOURCE_ID, OWNER, false)); - } - - @Test - public void testBeforeUnlock() { - assertEquals(OperResult.OPER_UNHANDLED, api.beforeUnlock(RESOURCE_ID, OWNER)); - } - - @Test - public void testAfterUnlock() { - assertFalse(api.afterUnlock(RESOURCE_ID, OWNER, true)); - assertFalse(api.afterUnlock(RESOURCE_ID, OWNER, false)); - } - - @Test - public void testBeforeIsLocked() { - assertEquals(OperResult.OPER_UNHANDLED, api.beforeIsLocked(RESOURCE_ID)); - } - - @Test - public void testBeforeIsLockedBy() { - assertEquals(OperResult.OPER_UNHANDLED, api.beforeIsLockedBy(RESOURCE_ID, OWNER)); - } -} diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java new file mode 100644 index 00000000..999ae50f --- /dev/null +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java @@ -0,0 +1,92 @@ +/* + * ============LICENSE_START======================================================= + * api-resource-locks + * ================================================================================ + * Copyright (C) 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.core.lock; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureApi.OperResult; + +public class PolicyResourceLockFeatureApiTest { + + private static final String RESOURCE_ID = "the resource"; + private static final String OWNER = "the owner"; + + private PolicyResourceLockFeatureApi api; + + /** + * set up. + */ + @Before + public void setUp() { + api = new PolicyResourceLockFeatureApi() { + @Override + public int getSequenceNumber() { + return 0; + } + }; + } + + @Test + public void testBeforeLock() { + assertEquals(OperResult.OPER_UNHANDLED, api.beforeLock(RESOURCE_ID, OWNER, 0)); + } + + @Test + public void testAfterLock() { + assertFalse(api.afterLock(RESOURCE_ID, OWNER, true)); + assertFalse(api.afterLock(RESOURCE_ID, OWNER, false)); + } + + @Test + public void testBeforeRefresh() { + assertEquals(OperResult.OPER_UNHANDLED, api.beforeRefresh(RESOURCE_ID, OWNER, 0)); + } + + @Test + public void testAfterRefresh() { + assertFalse(api.afterRefresh(RESOURCE_ID, OWNER, true)); + assertFalse(api.afterRefresh(RESOURCE_ID, OWNER, false)); + } + + @Test + public void testBeforeUnlock() { + assertEquals(OperResult.OPER_UNHANDLED, api.beforeUnlock(RESOURCE_ID, OWNER)); + } + + @Test + public void testAfterUnlock() { + assertFalse(api.afterUnlock(RESOURCE_ID, OWNER, true)); + assertFalse(api.afterUnlock(RESOURCE_ID, OWNER, false)); + } + + @Test + public void testBeforeIsLocked() { + assertEquals(OperResult.OPER_UNHANDLED, api.beforeIsLocked(RESOURCE_ID)); + } + + @Test + public void testBeforeIsLockedBy() { + assertEquals(OperResult.OPER_UNHANDLED, api.beforeIsLockedBy(RESOURCE_ID, OWNER)); + } +} diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java index 962fb96a..8acafccf 100644 --- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java +++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java @@ -41,7 +41,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult; +import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureApi.OperResult; import org.onap.policy.drools.core.lock.PolicyResourceLockManager.Factory; public class PolicyResourceLockManagerTest { @@ -64,9 +64,9 @@ public class PolicyResourceLockManagerTest { */ private static Factory saveFactory; - private PolicyResourceLockFeatureAPI impl1; - private PolicyResourceLockFeatureAPI impl2; - private List implList; + private PolicyResourceLockFeatureApi impl1; + private PolicyResourceLockFeatureApi impl2; + private List implList; private PolicyResourceLockManager mgr; @@ -85,8 +85,8 @@ public class PolicyResourceLockManagerTest { */ @Before public void setUp() { - impl1 = mock(PolicyResourceLockFeatureAPI.class); - impl2 = mock(PolicyResourceLockFeatureAPI.class); + impl1 = mock(PolicyResourceLockFeatureApi.class); + impl2 = mock(PolicyResourceLockFeatureApi.class); initImplementer(impl1); initImplementer(impl2); @@ -97,7 +97,7 @@ public class PolicyResourceLockManagerTest { PolicyResourceLockManager.setFactory(new Factory() { @Override - public List getImplementers() { + public List getImplementers() { return implList; } }); @@ -110,7 +110,7 @@ public class PolicyResourceLockManagerTest { * * @param impl implementer */ - private void initImplementer(PolicyResourceLockFeatureAPI impl) { + private void initImplementer(PolicyResourceLockFeatureApi impl) { when(impl.beforeLock(anyString(), anyString(), anyInt())).thenReturn(OperResult.OPER_UNHANDLED); when(impl.beforeRefresh(anyString(), anyString(), anyInt())).thenReturn(OperResult.OPER_UNHANDLED); when(impl.beforeUnlock(anyString(), anyString())).thenReturn(OperResult.OPER_UNHANDLED); -- cgit 1.2.3-korg