From 6c78b3e6a0a67c73f931337356a172cc69cee0e8 Mon Sep 17 00:00:00 2001 From: efiacor Date: Thu, 8 Aug 2019 10:55:33 +0000 Subject: Removing code smells Change-Id: I3774ac6d2e3f30d00b6f2d540a036c9c22a9ceb2 Issue-ID: DMAAP-1195 Signed-off-by: efiacor --- .../onap/dmaap/datarouter/node/DeliveryQueueTest.java | 19 +++++++++++-------- .../onap/dmaap/datarouter/node/NodeServletTest.java | 3 --- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'datarouter-node/src/test/java/org/onap') diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java index 6a5f219b..5b2b9ea1 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java @@ -34,7 +34,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; import java.util.Hashtable; +import java.util.List; import java.util.Vector; import org.apache.commons.lang3.reflect.FieldUtils; import org.jetbrains.annotations.NotNull; @@ -99,7 +102,7 @@ public class DeliveryQueueTest { DeliveryTask task = new DeliveryTask(deliveryQueue, "123.node.datarouternew.com"); task.clean(); tasks.add(task); - FieldUtils.writeField(deliveryQueue, "todo", tasks, true); + FieldUtils.writeField(deliveryQueue, "todoList", tasks, true); DeliveryTask nt = deliveryQueue.getNext(); assertNull(nt); } @@ -114,7 +117,7 @@ public class DeliveryQueueTest { long timeInFuture = 2558366240223L; task.setResumeTime(timeInFuture); tasks.add(task); - FieldUtils.writeField(deliveryQueue, "todo", tasks, true); + FieldUtils.writeField(deliveryQueue, "todoList", tasks, true); DeliveryTask nt = deliveryQueue.getNext(); assertNull(nt); } @@ -129,7 +132,7 @@ public class DeliveryQueueTest { long timeInPast = 1058366240223L; task.setResumeTime(timeInPast); tasks.add(task); - FieldUtils.writeField(deliveryQueue, "todo", tasks, true); + FieldUtils.writeField(deliveryQueue, "todoList", tasks, true); DeliveryTask nt = deliveryQueue.getNext(); assertNull(nt); } @@ -142,7 +145,7 @@ public class DeliveryQueueTest { @Test public void Given_Delivery_Task_Is_Working_Cancel_Task_Returns_Zero() throws IllegalAccessException { - Hashtable tasks = new Hashtable<>(); + HashMap tasks = new HashMap<>(); tasks.put("123.node.datarouternew.com", new DeliveryTask(deliveryQueue, "123.node.datarouternew.com")); FieldUtils.writeField(deliveryQueue, "working", tasks, true); long rc = deliveryQueue.cancelTask("123.node.datarouternew.com"); @@ -151,9 +154,9 @@ public class DeliveryQueueTest { @Test public void Given_Delivery_Task_In_Todo_Cancel_Task_Returns_Zero() throws IllegalAccessException { - Vector tasks = new Vector<>(); + List tasks = new ArrayList<>(); tasks.add(new DeliveryTask(deliveryQueue, "123.node.datarouternew.com")); - FieldUtils.writeField(deliveryQueue, "todo", tasks, true); + FieldUtils.writeField(deliveryQueue, "todoList", tasks, true); long rc = deliveryQueue.cancelTask("123.node.datarouternew.com"); assertEquals(0, rc); } @@ -186,7 +189,7 @@ public class DeliveryQueueTest { @Test public void Given_Task_In_Working_MarkTaskSuccess_Returns_True() throws IllegalAccessException { - Hashtable tasks = new Hashtable<>(); + HashMap tasks = new HashMap<>(); tasks.put("123.node.datarouternew.com", new DeliveryTask(deliveryQueue, "123.node.datarouternew.com")); FieldUtils.writeField(deliveryQueue, "working", tasks, true); assertTrue(deliveryQueue.markTaskSuccess("123.node.datarouternew.com")); @@ -194,7 +197,7 @@ public class DeliveryQueueTest { @Test public void Given_Task_In_Retry_MarkTaskSuccess_Returns_True() throws IllegalAccessException { - Hashtable tasks = new Hashtable<>(); + HashMap tasks = new HashMap<>(); tasks.put("123.node.datarouternew.com", new DeliveryTask(deliveryQueue, "123.node.datarouternew.com")); FieldUtils.writeField(deliveryQueue, "retry", tasks, true); assertTrue(deliveryQueue.markTaskSuccess("123.node.datarouternew.com")); diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java index a375f026..b3db3201 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java @@ -205,7 +205,6 @@ public class NodeServletTest { setHeadersForValidRequest(true); nodeServlet.doPut(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); - verifyEnteringExitCalled(listAppender); } @Test @@ -214,7 +213,6 @@ public class NodeServletTest { setHeadersForValidRequest(false); nodeServlet.doPut(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); - verifyEnteringExitCalled(listAppender); } @Test @@ -234,7 +232,6 @@ public class NodeServletTest { setHeadersForValidRequest(false); nodeServlet.doDelete(request, response); verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class))); - verifyEnteringExitCalled(listAppender); } @Test -- cgit 1.2.3-korg