aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-28 16:55:24 -0400
committerJim Hahn <jrh3@att.com>2020-04-29 10:02:25 -0400
commited81ba9cc8e54c3c2d8c70972a6307a1b5bbe86a (patch)
tree5ba1d466265a6114d3d682694538b87ead120fa6 /main/src/test/java
parent0f4acdbe709ec9e96e3984cc4541bce0b4096d4e (diff)
PAP should discard responses for old requests
This is a more robust solution to the race condition previously identified with back-to-back deployment requests. The old fix has been rolled back and replaced with this fix. Issue-ID: POLICY-2527 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I2ea93f3a5eaac822abecf5d0745429b95712c861
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
index efd380ec..414c1dbb 100644
--- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,6 +40,7 @@ import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.models.pdp.concepts.PdpMessage;
+import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
@@ -66,6 +67,8 @@ public class RequestImplTest extends CommonRequestBase {
msg = new PdpStateChange();
response.setName(PDP1);
+ response.setResponse(new PdpResponseDetails());
+ response.getResponse().setResponseTo(msg.getRequestId());
msg.setName(PDP1);
req = new MyRequest(reqParams, MY_REQ_NAME, msg);
@@ -306,6 +309,19 @@ public class RequestImplTest extends CommonRequestBase {
}
@Test
+ public void testProcessResponse_WrongRequest() {
+ req.startPublishing();
+
+ response.getResponse().setResponseTo(DIFFERENT);
+
+ invokeProcessResponse(response);
+
+ verify(listener, never()).success(any());
+ verify(listener, never()).failure(any(), any());
+ verify(timer, never()).cancel();
+ }
+
+ @Test
public void testProcessResponse_ResponseFailed() {
req.startPublishing();