aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-06 20:53:31 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-06 20:53:31 +0000
commitae9ff22bb349f9ad2b0339ab60a6fc3c67652432 (patch)
tree8650b85fb37424541b42d159b93a10642a58be07
parentc80e986f041bd69d0325ac47b139002a8f5ad0da (diff)
parentb447f17ca2c277ee3c06d5b8a56fd49a60a3c1ff (diff)
Merge "Use apache Triple"
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java34
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java12
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java6
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java99
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java93
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java62
6 files changed, 79 insertions, 227 deletions
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java
index e24c3c1e..d8ed62c8 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,6 +38,7 @@ import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.drools.pooling.message.BucketAssignments;
@@ -46,7 +47,6 @@ import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
import org.onap.policy.drools.pooling.message.Offline;
import org.onap.policy.drools.pooling.message.Query;
-import org.onap.policy.drools.utils.Triple;
public class ActiveStateTest extends SupportBasicStateTester {
@@ -304,18 +304,18 @@ public class ActiveStateTest extends SupportBasicStateTester {
// heart beat generator
timer = repeatedTasks.remove();
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getMiddle().longValue());
// my heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
// predecessor's heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
}
@Test
@@ -333,13 +333,13 @@ public class ActiveStateTest extends SupportBasicStateTester {
// heart beat generator
timer = repeatedTasks.remove();
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getMiddle().longValue());
// my heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
}
@Test
@@ -356,7 +356,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
verify(mgr).publish(anyString(), any(Heartbeat.class));
// fire the task
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
// should have generated a second pair of heart beats
verify(mgr, times(2)).publish(anyString(), any(Heartbeat.class));
@@ -381,7 +381,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goInactive()).thenReturn(next);
// fire the task - should not transition
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
verify(mgr, never()).publishAdmin(any(Query.class));
}
@@ -398,7 +398,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goStart()).thenReturn(next);
// fire the task - should transition
- assertEquals(next, task.third().fire());
+ assertEquals(next, task.getRight().fire());
// should continue to distribute
verify(mgr, never()).startDistributing(null);
@@ -423,7 +423,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goQuery()).thenReturn(next);
// fire the task - should NOT transition
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
verify(mgr, never()).publishAdmin(any(Query.class));
}
@@ -440,7 +440,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goQuery()).thenReturn(next);
// fire the task - should transition
- assertEquals(next, task.third().fire());
+ assertEquals(next, task.getRight().fire());
verify(mgr).publishAdmin(any(Query.class));
}
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java
index 1fd49c50..142fbf7e 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,6 +33,7 @@ import static org.mockito.Mockito.when;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.drools.pooling.message.Forward;
@@ -42,7 +43,6 @@ import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
import org.onap.policy.drools.pooling.message.Offline;
import org.onap.policy.drools.pooling.message.Query;
-import org.onap.policy.drools.utils.Triple;
public class StartStateTest extends SupportBasicStateTester {
@@ -92,15 +92,15 @@ public class StartStateTest extends SupportBasicStateTester {
*/
Triple<Long, Long, StateTimerTask> generator = repeatedTasks.removeFirst();
- assertEquals(STD_INTER_HEARTBEAT_MS, generator.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, generator.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, generator.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, generator.getMiddle().longValue());
// invoke the task - it should generate another heartbeat
- assertEquals(null, generator.third().fire());
+ assertEquals(null, generator.getRight().fire());
verify(mgr, times(2)).publish(MY_HOST, msg.getRight());
// and again
- assertEquals(null, generator.third().fire());
+ assertEquals(null, generator.getRight().fire());
verify(mgr, times(3)).publish(MY_HOST, msg.getRight());
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java
index a1246938..1a65c802 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,13 +37,13 @@ import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.onap.policy.drools.pooling.CancellableScheduledTask;
import org.onap.policy.drools.pooling.PoolingManager;
import org.onap.policy.drools.pooling.PoolingProperties;
import org.onap.policy.drools.pooling.message.BucketAssignments;
import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
-import org.onap.policy.drools.utils.Triple;
/**
* Superclass used to test subclasses of {@link State}.
@@ -179,7 +179,7 @@ public class SupportBasicStateTester {
// capture scheduleWithFixedDelay() arguments, and return a new future
when(mgr.scheduleWithFixedDelay(anyLong(), anyLong(), any(StateTimerTask.class))).thenAnswer(invocation -> {
Object[] args = invocation.getArguments();
- repeatedTasks.add(new Triple<>((Long) args[0], (Long) args[1], (StateTimerTask) args[2]));
+ repeatedTasks.add(Triple.of((Long) args[0], (Long) args[1], (StateTimerTask) args[2]));
CancellableScheduledTask sched = mock(CancellableScheduledTask.class);
repeatedSchedules.add(sched);
diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
index 6b497fa3..abf9b387 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
@@ -26,6 +26,8 @@ import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Properties;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -42,7 +44,6 @@ import org.onap.policy.drools.properties.DroolsPropertyConstants;
import org.onap.policy.drools.protocol.coders.EventProtocolCoder.CoderFilters;
import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration.CustomGsonCoder;
import org.onap.policy.drools.util.KieUtils;
-import org.onap.policy.drools.utils.Triple;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,11 +69,10 @@ public class ProtocolCoderToolsetTest {
*/
@BeforeClass
public static void setUpClass() throws IOException {
- releaseId = KieUtils.installArtifact(
- Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_PATH).toFile(),
- Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_POM_PATH).toFile(),
- MavenDroolsControllerTest.JUNIT_ECHO_KJAR_DRL_PATH,
- Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_DRL_PATH).toFile());
+ releaseId = KieUtils.installArtifact(Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_PATH).toFile(),
+ Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_POM_PATH).toFile(),
+ MavenDroolsControllerTest.JUNIT_ECHO_KJAR_DRL_PATH,
+ Paths.get(MavenDroolsControllerTest.JUNIT_ECHO_KMODULE_DRL_PATH).toFile());
}
/**
@@ -104,28 +104,25 @@ public class ProtocolCoderToolsetTest {
* @param protocolFilter protocol filter
*/
private void testGsonToolset(JsonProtocolFilter protocolFilter) {
- GsonProtocolCoderToolset gsonToolset = new GsonProtocolCoderToolset(
- EventProtocolParams.builder().topic(JUNIT_PROTOCOL_CODER_TOPIC)
- .groupId(releaseId.getGroupId())
- .artifactId(releaseId.getArtifactId())
- .eventClass(Triple.class.getName())
- .protocolFilter(protocolFilter)
- .customGsonCoder(null)
- .modelClassLoaderHash(12345678), CONTROLLER_ID);
+ GsonProtocolCoderToolset gsonToolset =
+ new GsonProtocolCoderToolset(EventProtocolParams.builder().topic(JUNIT_PROTOCOL_CODER_TOPIC)
+ .groupId(releaseId.getGroupId()).artifactId(releaseId.getArtifactId())
+ .eventClass(ThreeStrings.class.getName()).protocolFilter(protocolFilter)
+ .customGsonCoder(null).modelClassLoaderHash(12345678), CONTROLLER_ID);
Assert.assertNotNull(gsonToolset.getEncoder());
Assert.assertNotNull(gsonToolset.getDecoder());
testToolset(protocolFilter, gsonToolset);
- Triple<String, String, String> triple = createTriple();
+ ThreeStrings triple = createTriple();
gsonToolset.setCustomCoder(new CustomGsonCoder(this.getClass().getName(), "customCoder"));
String tripleEncoded = encode(gsonToolset, triple);
decode(protocolFilter, gsonToolset, triple, tripleEncoded);
}
- private Triple<String, String, String> createTriple() {
- return new Triple<>("v1", "v2", "v3");
+ private ThreeStrings createTriple() {
+ return new ThreeStrings("v1", "v2", "v3");
}
private void testToolset(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset) {
@@ -137,61 +134,59 @@ public class ProtocolCoderToolsetTest {
addRemoveCoder(coderToolset);
/* restore original filters */
- coderToolset.addCoder(Triple.class.getName(), protocolFilter, 654321);
+ coderToolset.addCoder(ThreeStrings.class.getName(), protocolFilter, 654321);
- Triple<String, String, String> triple = createTriple();
+ ThreeStrings triple = createTriple();
String tripleEncoded = encode(coderToolset, triple);
decode(protocolFilter, coderToolset, triple, tripleEncoded);
}
- @SuppressWarnings("unchecked")
private void decode(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset,
- Triple<String, String, String> triple, String tripleEncoded) {
+ ThreeStrings triple, String tripleEncoded) {
- Triple<String, String, String> tripleDecoded = null;
+ ThreeStrings tripleDecoded = null;
try {
- tripleDecoded = (Triple<String, String, String>) coderToolset.decode(tripleEncoded);
+ tripleDecoded = (ThreeStrings) coderToolset.decode(tripleEncoded);
} catch (UnsupportedOperationException e) {
/* OK */
logger.trace("Junit expected exception - decode does not pass filtering", e);
}
- CoderFilters coderFilters = coderToolset.getCoder(Triple.class.getName());
- Assert.assertSame(coderFilters.getCodedClass(), Triple.class.getName());
+ CoderFilters coderFilters = coderToolset.getCoder(ThreeStrings.class.getName());
+ Assert.assertSame(coderFilters.getCodedClass(), ThreeStrings.class.getName());
Assert.assertSame(coderFilters.getFilter(), protocolFilter);
Assert.assertNotNull(coderFilters.getFilter().getRule());
coderFilters.getFilter().setRule("[?($.second =~ /^v2$/ && $.third =~ /.*v3.*/)]");
- tripleDecoded = (Triple<String, String, String>) coderToolset.decode(tripleEncoded);
+ tripleDecoded = (ThreeStrings) coderToolset.decode(tripleEncoded);
- Assert.assertEquals(triple.first(), tripleDecoded.first());
- Assert.assertEquals(triple.second(), tripleDecoded.second());
- Assert.assertEquals(triple.third(), tripleDecoded.third());
+ Assert.assertEquals(triple.getFirst(), tripleDecoded.getFirst());
+ Assert.assertEquals(triple.getSecond(), tripleDecoded.getSecond());
+ Assert.assertEquals(triple.getThird(), tripleDecoded.getThird());
coderFilters.getFilter().setRule(null);
Assert.assertEquals("[?($ =~ /.*/)]", coderFilters.getFilter().getRule());
- tripleDecoded = (Triple<String, String, String>) coderToolset.decode(tripleEncoded);
+ tripleDecoded = (ThreeStrings) coderToolset.decode(tripleEncoded);
- Assert.assertEquals(tripleDecoded.first(), triple.first());
- Assert.assertEquals(tripleDecoded.second(), triple.second());
- Assert.assertEquals(tripleDecoded.third(), triple.third());
+ Assert.assertEquals(tripleDecoded.getFirst(), triple.getFirst());
+ Assert.assertEquals(tripleDecoded.getSecond(), triple.getSecond());
+ Assert.assertEquals(tripleDecoded.getThird(), triple.getThird());
coderFilters.getFilter().setRule("[?($.third =~ /.*v3.*/)]");
}
- private String encode(ProtocolCoderToolset coderToolset, Triple<String, String, String> triple) {
+ private String encode(ProtocolCoderToolset coderToolset, ThreeStrings triple) {
String tripleEncoded = coderToolset.encode(triple);
Assert.assertTrue(!tripleEncoded.isEmpty());
return tripleEncoded;
}
private void addRemoveCoder(ProtocolCoderToolset coderToolset) {
- coderToolset.addCoder(this.getClass().getName(),
- new JsonProtocolFilter("[?($.second =~ /.*/)]"), 654321);
+ coderToolset.addCoder(this.getClass().getName(), new JsonProtocolFilter("[?($.second =~ /.*/)]"), 654321);
Assert.assertEquals(2, coderToolset.getCoders().size());
coderToolset.removeCoders(this.getClass().getName());
@@ -199,18 +194,16 @@ public class ProtocolCoderToolsetTest {
}
private void updateCoderFilterRule(ProtocolCoderToolset coderToolset) {
- coderToolset.addCoder(Triple.class.getName(), new JsonProtocolFilter("[?($.third =~ /.*/)]"), 654321);
+ coderToolset.addCoder(ThreeStrings.class.getName(), new JsonProtocolFilter("[?($.third =~ /.*/)]"), 654321);
Assert.assertEquals(1, coderToolset.getCoders().size());
- Assert.assertEquals(654321, coderToolset.getCoder(Triple.class.getName()).getModelClassLoaderHash());
+ Assert.assertEquals(654321, coderToolset.getCoder(ThreeStrings.class.getName()).getModelClassLoaderHash());
- Assert.assertNotNull(
- coderToolset.getCoder(
- Triple.class.getName()).getFilter().getRule());
+ Assert.assertNotNull(coderToolset.getCoder(ThreeStrings.class.getName()).getFilter().getRule());
- Assert.assertEquals("[?($.third =~ /.*/)]", coderToolset.getCoder(Triple.class.getName())
- .getFilter().getRule());
+ Assert.assertEquals("[?($.third =~ /.*/)]",
+ coderToolset.getCoder(ThreeStrings.class.getName()).getFilter().getRule());
}
private void validateInitialization(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset) {
@@ -224,7 +217,7 @@ public class ProtocolCoderToolsetTest {
CoderFilters coderFilters = coderToolset.getCoder(CONTROLLER_ID);
Assert.assertNull(coderFilters);
- coderFilters = coderToolset.getCoder(Triple.class.getName());
+ coderFilters = coderToolset.getCoder(ThreeStrings.class.getName());
Assert.assertNotNull(coderFilters);
Assert.assertEquals(coderFilters.getFilter(), protocolFilter);
@@ -243,8 +236,10 @@ public class ProtocolCoderToolsetTest {
droolsControllerConfig.put(DroolsPropertyConstants.RULES_GROUPID, releaseId.getGroupId());
droolsControllerConfig.put(DroolsPropertyConstants.RULES_ARTIFACTID, releaseId.getArtifactId());
droolsControllerConfig.put(DroolsPropertyConstants.RULES_VERSION, releaseId.getVersion());
- droolsControllerConfig.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC
- + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX, Triple.class.getName());
+ droolsControllerConfig.put(
+ PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC
+ + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX,
+ ThreeStrings.class.getName());
return DroolsControllerConstants.getFactory().build(droolsControllerConfig, null, noopTopics);
}
@@ -252,4 +247,16 @@ public class ProtocolCoderToolsetTest {
private JsonProtocolFilter createFilterSet() {
return new JsonProtocolFilter("[?($.first =~ /.*/ && $.second =~ /^blah.*/ && $.third =~ /^hello$/)]");
}
+
+ /**
+ * Note: We need an object that can be constructed, but the apache Triple cannot, thus
+ * we create our own class just for these tests.
+ */
+ @Getter
+ @AllArgsConstructor
+ public static class ThreeStrings {
+ private String first;
+ private String second;
+ private String third;
+ }
}
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java
deleted file mode 100644
index d37a5d92..00000000
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/Triple.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * 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 Triple<F, S, T> {
-
- private F first;
- private S second;
- private T third;
-
- public Triple() {
- // empty constructor
- }
-
- /**
- * Constructor.
- *
- * @param first first
- * @param second second
- * @param third third
- */
- public Triple(F first, S second, T third) {
- this.first = first;
- this.second = second;
- this.third = third;
- }
-
- public F first() {
- return this.getFirst();
- }
-
- public void first(F first) {
- this.setFirst(first);
- }
-
- public F getFirst() {
- return first;
- }
-
- public void setFirst(F first) {
- this.first = first;
- }
-
- public S second() {
- return this.getSecond();
- }
-
- public void second(S second) {
- this.setSecond(second);
- }
-
- public S getSecond() {
- return second;
- }
-
- public void setSecond(S second) {
- this.second = second;
- }
-
- public T third() {
- return this.getThird();
- }
-
- public void third(T third) {
- this.setThird(third);
- }
-
- public T getThird() {
- return this.third;
- }
-
- public void setThird(T third) {
- this.third = 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
deleted file mode 100644
index b62c9530..00000000
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * 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.
- * 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 org.junit.Assert;
-import org.junit.Test;
-
-public class TripleTest {
-
- @Test
- public void test() {
- Triple<String, String, String> triple =
- new Triple<>("one", "two", "three");
-
- Assert.assertEquals("one", triple.first());
- Assert.assertEquals("one", triple.getFirst());
-
- Assert.assertEquals("two", triple.second());
- Assert.assertEquals("two", triple.getSecond());
-
- Assert.assertEquals("three", triple.third());
- Assert.assertEquals("three", triple.getThird());
-
- triple.first("I");
- Assert.assertEquals("I", triple.first());
-
- triple.setFirst("1");
- Assert.assertEquals("1", triple.first());
-
- triple.second("2");
- Assert.assertEquals("2", triple.second());
-
- triple.setSecond("II");
- Assert.assertEquals("II", triple.second());
-
- triple.third("3");
- Assert.assertEquals("3", triple.third());
-
- triple.setThird("III");
- Assert.assertEquals("III", triple.third());
-
- }
-} \ No newline at end of file