diff options
author | efiacor <fiachra.corcoran@est.tech> | 2019-08-08 10:55:33 +0000 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2019-08-08 10:55:33 +0000 |
commit | 6c78b3e6a0a67c73f931337356a172cc69cee0e8 (patch) | |
tree | 3d12ade7a92541e0332c6dc75e6f9522c65a1917 /datarouter-node/src/test/java | |
parent | bc1df610cddfb558cf6bde90c269b4af59768648 (diff) |
Removing code smells
Change-Id: I3774ac6d2e3f30d00b6f2d540a036c9c22a9ceb2
Issue-ID: DMAAP-1195
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Diffstat (limited to 'datarouter-node/src/test/java')
-rw-r--r-- | datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/DeliveryQueueTest.java | 19 | ||||
-rw-r--r-- | datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeServletTest.java | 3 |
2 files changed, 11 insertions, 11 deletions
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<String, DeliveryTask> tasks = new Hashtable<>(); + HashMap<String, DeliveryTask> 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<DeliveryTask> tasks = new Vector<>(); + List<DeliveryTask> 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<String, DeliveryTask> tasks = new Hashtable<>(); + HashMap<String, DeliveryTask> 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<String, DeliveryTask> tasks = new Hashtable<>(); + HashMap<String, DeliveryTask> 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 |