From a2a84654f27648091db9c49abc8f7b8afa391e73 Mon Sep 17 00:00:00 2001 From: waynedunican Date: Fri, 19 Jun 2020 15:23:27 +0100 Subject: Clean up of Pair classes - drools-pdp Removed Pair class from drools-pdp and replaced with Apache Common Pair class Issue-ID: POLICY-2202 Change-Id: Ica2a5b734fb6eebfc0713027c1c4dc3b8d3882c8 Signed-off-by: waynedunican --- .../java/org/onap/policy/drools/utils/Pair.java | 63 -------------------- .../onap/policy/drools/utils/PairTripleTest.java | 68 ---------------------- .../org/onap/policy/drools/utils/TripleTest.java | 2 + 3 files changed, 2 insertions(+), 131 deletions(-) delete mode 100644 policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java delete mode 100644 policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java (limited to 'policy-utils') diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java deleted file mode 100644 index c37084f4..00000000 --- a/policy-utils/src/main/java/org/onap/policy/drools/utils/Pair.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * policy-utils - * ================================================================================ - * 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. - * 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.utils; - -public class Pair { - - protected F first; - protected S second; - - public Pair(F first, S second) { - this.first = first; - this.second = second; - } - - public F first() { - return this.first; - } - - public void first(F first) { - this.first = first; - } - - public S second() { - return this.second; - } - - public void second(S second) { - this.second = second; - } - - public F getFirst() { - return this.first; - } - - public S getSecond() { - return this.second; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("Pair [first=").append(first).append(", second=").append(second).append("]"); - return builder.toString(); - } -} diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java deleted file mode 100644 index ca792a1c..00000000 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PairTripleTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * policy-utils - * ================================================================================ - * Copyright (C) 2017-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. - * 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.utils; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class PairTripleTest { - - @Test - public void testPair() { - Pair pair = new Pair("foo", "bar"); - - assertEquals("foo", pair.first()); - assertEquals("bar", pair.second()); - assertEquals("foo", pair.getFirst()); - assertEquals("bar", pair.getSecond()); - - pair.first("one"); - pair.second("two"); - - assertEquals("one", pair.first()); - assertEquals("two", pair.second()); - assertEquals("one", pair.getFirst()); - assertEquals("two", pair.getSecond()); - - assertNotNull(pair.toString()); - - } - - @Test - public void testTriple() { - Triple triple = new Triple("foo", "bar", "fiz"); - - assertEquals("foo", triple.first()); - assertEquals("bar", triple.second()); - assertEquals("fiz", triple.third()); - - triple.first("one"); - triple.second("two"); - triple.third("three"); - - assertEquals("one", triple.first()); - assertEquals("two", triple.second()); - assertEquals("three", triple.third()); - } - -} diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java index ff613938..7f04b163 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,5 +57,6 @@ public class TripleTest { triple.setThird("III"); Assert.assertTrue("III".equals(triple.third())); + } } \ No newline at end of file -- cgit 1.2.3-korg