aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java
diff options
context:
space:
mode:
authorITSERVICES\rb7147 <rb7147@att.com>2017-04-25 11:46:00 -0400
committerITSERVICES\rb7147 <rb7147@att.com>2017-05-03 09:58:17 -0400
commite0addf5b588a1244f9679becd90999dfcb4c3a94 (patch)
tree1212772d6366730266ff0e093c874b07aa716c29 /ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java
parent39fb0f30472777e4b60d6a7ac8aa4eb9773961ff (diff)
Policy 1707 commit to LF
Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java')
-rw-r--r--ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java137
1 files changed, 3 insertions, 134 deletions
diff --git a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java
index 7a8060114..1811d8912 100644
--- a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java
+++ b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/PapUrlResolverTest.java
@@ -19,24 +19,20 @@
*/
package org.openecomp.policy.pdp.rest;
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.policy.pdp.rest.PapUrlResolver;
-import org.openecomp.policy.rest.XACMLRestProperties;
-
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.policy.rest.XACMLRestProperties;
public class PapUrlResolverTest {
@Test
public void testPropertyModifications(){
- long currentTime = new Date().getTime();
DateFormat df = new SimpleDateFormat();
//first sort order
String urls = "http://one.localhost.com,http://two.localhost.com,http://three.localhost.com,http://four.localhost.com";
@@ -104,20 +100,8 @@ public class PapUrlResolverTest {
prop = rs.getProperties();
succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
- System.out.println(succeeded);
- //can't test this in a timely manner since it will need to wait a minute, since they all succeeded at the same time
- /*
- prop = rs.getProperties();
- 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://two.localhost.com", rs.getUrl());
- rs.succeeded();
- rs.getNext();
- Assert.assertFalse(rs.hasMoreUrls());
- */
}
+ @SuppressWarnings("unused")
@Test
public void testModifyUrl(){
String newUrl = PapUrlResolver.modifyUrl("http://mypap1.com/pap?id=987654", "http://mypap2.com:45/pap/");
@@ -236,120 +220,5 @@ public class PapUrlResolverTest {
Assert.assertEquals("http://four.localhost.com", rs.getUrl());
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
-
-
-
-
- //not used because we are no longer sorting based on success time, only failed time. Modified above.
- /*
- //first sort order
- String urls = "http://one.localhost.com,http://two.localhost.com,http://three.localhost.com,http://four.localhost.com";
- String failed = df.format(new Date(currentTime-3600000))+",-1,-1,"+df.format(new Date(currentTime-3200000));
- 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://three.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://four.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";
- failed = "-1,-1,-1,-1";
- succeeded = "-1,"+df.format(new Date(currentTime-3600000))+","+df.format(new Date(currentTime-6600000))+",-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://four.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.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";
- failed = "-1,-1,-1,-1";
- 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());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://four.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";
- failed = df.format(new Date(currentTime-3900000))+","+df.format(new Date(currentTime-5600000))+","+df.format(new Date(currentTime-4600000))+","+df.format(new Date(currentTime-3600000));
- succeeded = "-1,-1,-1,-1";
- rs = PapUrlResolver.getInstance(urls, failed, succeeded);
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://one.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://four.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";
- failed = df.format(new Date(currentTime-(3600000*4)))+",-1,-1,-1";
- succeeded = "-1,-1,-1,-1";
- rs = PapUrlResolver.getInstance(urls, failed, succeeded);
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://two.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
- 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.getNext();
- Assert.assertFalse(rs.hasMoreUrls());
-
- urls = "http://one.localhost.com,http://two.localhost.com,http://three.localhost.com,http://four.localhost.com";
- failed = df.format(new Date(currentTime-(3600000*6)))+",-1,-1,-1";
- 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());
- Assert.assertEquals("http://three.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertTrue(rs.hasMoreUrls());
- Assert.assertEquals("http://four.localhost.com", rs.getUrl());
- rs.getNext();
- Assert.assertFalse(rs.hasMoreUrls());
- */
}
}