aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java')
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java54
1 files changed, 27 insertions, 27 deletions
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
index cf3ddb3b2..841fad641 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PDP-REST
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2019 Samsung
* ================================================================================
@@ -28,7 +28,7 @@ import java.util.Date;
import java.util.Properties;
import org.junit.Assert;
import org.junit.Test;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
public class PapUrlResolverTest {
@@ -41,7 +41,7 @@ public class PapUrlResolverTest {
String failed = "-1,-1,-1,-1";
String succeeded = "-1,-1,-1,-1";
PapUrlResolver rs = PapUrlResolver.getInstance(urls, failed, succeeded);
- Assert.assertEquals(rs.getProperties().getProperty(XACMLRestProperties.PROP_PAP_URLS),
+ Assert.assertEquals(rs.getProperties().getProperty(XacmlRestProperties.PROP_PAP_URLS),
urls);
rs.failed();
@@ -51,14 +51,17 @@ public class PapUrlResolverTest {
Assert.assertFalse(rs.hasMoreUrls());
Properties prop = rs.getProperties();
Assert.assertEquals(df.format(new Date()) + ",-1,-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
Assert.assertEquals("-1," + df.format(new Date()) + ",-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS));
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
+ Assert.assertEquals("http://one.localhost.com", rs.getUrl());
+ rs.getNext();
+ Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://two.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
@@ -66,18 +69,15 @@ public class PapUrlResolverTest {
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://four.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
rs.succeeded();
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
Assert.assertEquals("-1,-1,-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -85,8 +85,8 @@ public class PapUrlResolverTest {
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -94,8 +94,8 @@ public class PapUrlResolverTest {
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -104,7 +104,7 @@ public class PapUrlResolverTest {
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
}
@SuppressWarnings("unused")
@@ -128,13 +128,13 @@ public class PapUrlResolverTest {
String succeeded = "-1,8/13/15 5:41 PM,8/13/15 4:41 PM,-1";
PapUrlResolver rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://one.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://two.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://three.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://four.localhost.com", rs.getUrl());
@@ -186,13 +186,13 @@ public class PapUrlResolverTest {
succeeded = "-1,-1,-1,-1";
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://one.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://two.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
+ Assert.assertEquals("http://three.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://four.localhost.com", rs.getUrl());
@@ -204,6 +204,9 @@ public class PapUrlResolverTest {
succeeded = "-1,-1,-1,-1";
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
+ Assert.assertEquals("http://one.localhost.com", rs.getUrl());
+ rs.getNext();
+ Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://two.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertTrue(rs.hasMoreUrls());
@@ -212,9 +215,6 @@ public class PapUrlResolverTest {
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://four.localhost.com", rs.getUrl());
rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
- rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
urls = "http://one.localhost.com,http://two.localhost.com,http://three.localhost.com,http://four.localhost.com";