diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2021-02-17 18:07:25 +0000 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-02-19 20:16:00 +0000 |
commit | e3771883bafbf8a3848f47cd2e02c9f7ffc6030a (patch) | |
tree | 8a7a3c72026ab419f43bbef4232d10cd40d6377e /main/src/test/java/org | |
parent | cd8c7690c302973da1811be81a5453aef7469c10 (diff) |
Refactor Pap code to use Instant from Date
Issue-ID: POLICY-3069
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I0e1b8ccc41749cd53a299397c8399f833279df59
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java | 5 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java index 1fdbfe65..01edbdcf 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java @@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.Instant; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -57,7 +58,7 @@ public class PdpHeartbeatListenerTest extends End2EndBase { private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; - private Date timeStamp; + private Instant timeStamp; private PdpHeartbeatListener pdpHeartbeatListener; @Test @@ -207,7 +208,7 @@ public class PdpHeartbeatListenerTest extends End2EndBase { public void testPdpStatistics() throws CoderException, PfModelException, ParseException { addGroups("PdpGroups.json"); pdpHeartbeatListener = new PdpHeartbeatListener(new PdpParameters()); - timeStamp = new SimpleDateFormat("yyyy-MM-dd").parse("2020-01-01"); + timeStamp = Instant.parse("2021-02-12T17:48:01.029211400Z"); // init default pdp group final PdpStatus status1 = new PdpStatus(); diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java index 75aafba6..2f6cc3a1 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/StatisticsTest.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ package org.onap.policy.pap.main.rest.e2e; import static org.junit.Assert.assertEquals; import java.net.HttpURLConnection; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Map; import javax.ws.rs.client.Invocation; @@ -117,7 +117,7 @@ public class StatisticsTest extends End2EndBase { pdpStatisticsRecord.setPdpGroupName("defaultGroup"); pdpStatisticsRecord.setPdpSubGroupName("apex"); pdpStatisticsRecord.setPdpInstanceId("pdp1"); - pdpStatisticsRecord.setTimeStamp(new Date()); + pdpStatisticsRecord.setTimeStamp(Instant.now()); pdpStatisticsRecord.setPolicyDeployCount(1); pdpStatisticsRecord.setPolicyDeployFailCount(0); pdpStatisticsRecord.setPolicyDeploySuccessCount(1); |