summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test
diff options
context:
space:
mode:
authorBalaji, Ramya (rb111y) <rb111y@att.com>2018-09-07 16:00:46 -0400
committerTakamune Cho <tc012c@att.com>2018-09-11 15:10:09 +0000
commitf1b353074c937b473e23e717966d97602bc981f8 (patch)
treef35ef0d0571f898ac7c9bf1d435da9d47effe944 /appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test
parent99043712640be0ffc317f95d0630b2119998cb2b (diff)
In progress trxns criteria fix
Changed the criteria for inprogress transactions to the last X hours. This will eliminate stale transactions causing an incorrect scope overlap error. Issue-ID: APPC-1194 Change-Id: I2f3147503f4202e8e8931b2615e626e3b9af8261 Signed-off-by: Balaji, Ramya (rb111y) <rb111y@att.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test')
-rw-r--r--appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test/java/org/onap/appc/transactionrecorder/impl/TransactionRecorderImplTest.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test/java/org/onap/appc/transactionrecorder/impl/TransactionRecorderImplTest.java b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test/java/org/onap/appc/transactionrecorder/impl/TransactionRecorderImplTest.java
index fd1790d49..1418e89c6 100644
--- a/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test/java/org/onap/appc/transactionrecorder/impl/TransactionRecorderImplTest.java
+++ b/appc-dispatcher/appc-dispatcher-common/transaction-recorder/src/test/java/org/onap/appc/transactionrecorder/impl/TransactionRecorderImplTest.java
@@ -9,15 +9,15 @@
* 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=========================================================
*/
@@ -45,8 +45,10 @@ import java.sql.*;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -152,7 +154,21 @@ public class TransactionRecorderImplTest {
input.setStartTime(Instant.now());
Mockito.when(dbLibService.getData(anyString(), anyObject(), anyString())).thenAnswer(invocation ->
inMemoryExecutionWithResultSet(invocation.getArguments()));
- Assert.assertEquals(1, transactionRecorderImpl.getInProgressRequests(input).size());
+ Assert.assertEquals(1, transactionRecorderImpl.getInProgressRequests(input,0).size());
+
+ }
+
+ @Test
+ public void testGetInProgressRequestsWithinTimeInterval() throws SQLException, APPCException {
+ TransactionRecord record1 = prepareTransactionsInput();
+ record1.setStartTime(Instant.now().minus(4,ChronoUnit.HOURS));
+ insertRecord(record1);
+ TransactionRecord input = prepareTransactionsInput();
+ input.setStartTime(Instant.now());
+ Mockito.when(dbLibService.getData(anyString(), anyObject(), anyString())).thenAnswer(invocation ->
+ inMemoryExecutionWithResultSet(invocation.getArguments()));
+ List<TransactionRecord> aList= transactionRecorderImpl.getInProgressRequests(input,12);
+ Assert.assertEquals(1, transactionRecorderImpl.getInProgressRequests(input,12).size());
}