use of jakarta.ws.rs.core.CacheControl in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method maxAgeTest.
/*
* @testName: maxAgeTest
*
* @assertion_ids: JAXRS:JAVADOC:24; JAXRS:JAVADOC:28; JAXRS:JAVADOC:29;
* JAXRS:JAVADOC:30; JAXRS:JAVADOC:32; JAXRS:JAVADOC:33; JAXRS:JAVADOC:34;
* JAXRS:JAVADOC:35; JAXRS:JAVADOC:36; JAXRS:JAVADOC:37; JAXRS:JAVADOC:38;
*
* @test_Strategy: Client instantiate a CacheControl instance using Constructor
* CacheControl(). Verify all values are set correctly.
*/
@Test
public void maxAgeTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
int maxAge = -1;
CacheControl ccl1 = new CacheControl();
ccl1.setMaxAge(maxAge);
pass = verifyList(expected, ccl1, sb);
pass &= verifyMaxAge(ccl1, maxAge, sb);
maxAge = 2000;
ccl1.setMaxAge(maxAge);
pass &= verifyList(expected, ccl1, sb);
pass &= verifyMaxAge(ccl1, maxAge, sb);
assertTrue(pass, "At least one assertion failed: " + sb);
}
use of jakarta.ws.rs.core.CacheControl in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method noStoreTest.
/*
* @testName: noStoreTest
*
* @assertion_ids: JAXRS:JAVADOC:24; JAXRS:JAVADOC:28; JAXRS:JAVADOC:29;
* JAXRS:JAVADOC:32; JAXRS:JAVADOC:33; JAXRS:JAVADOC:34; JAXRS:JAVADOC:35;
* JAXRS:JAVADOC:36; JAXRS:JAVADOC:37; JAXRS:JAVADOC:41;
*
* @test_Strategy: Client instantiate a CacheControl instance using Constructor
* CacheControl(). Verify all values are set correctly.
*/
@Test
public void noStoreTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
boolean nostore = false;
expected[3] = nostore;
CacheControl ccl4 = new CacheControl();
ccl4.setNoStore(nostore);
pass = verifyList(expected, ccl4, sb);
nostore = true;
expected[3] = nostore;
ccl4.setNoStore(nostore);
pass &= verifyList(expected, ccl4, sb);
assertTrue(pass, "At least one assertion failed: " + sb);
}
use of jakarta.ws.rs.core.CacheControl in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method sMaxAgeTest.
/*
* @testName: sMaxAgeTest
*
* @assertion_ids: JAXRS:JAVADOC:24; JAXRS:JAVADOC:27; JAXRS:JAVADOC:28;
* JAXRS:JAVADOC:29; JAXRS:JAVADOC:32; JAXRS:JAVADOC:33; JAXRS:JAVADOC:34;
* JAXRS:JAVADOC:35; JAXRS:JAVADOC:36; JAXRS:JAVADOC:37; JAXRS:JAVADOC:45;
*
* @test_Strategy: Client instantiate a CacheControl instance using Constructor
* CacheControl(). Verify all values are set correctly.
*/
@Test
public void sMaxAgeTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
int sMaxAge = -1;
CacheControl ccl1 = new CacheControl();
ccl1.setSMaxAge(sMaxAge);
pass = verifyList(expected, ccl1, sb);
pass &= verifySMaxAge(ccl1, sMaxAge, sb);
sMaxAge = 2000;
ccl1.setSMaxAge(sMaxAge);
pass &= verifyList(expected, ccl1, sb);
pass &= verifySMaxAge(ccl1, sMaxAge, sb);
assertTrue(pass, "At least one assertion failed: " + sb);
}
use of jakarta.ws.rs.core.CacheControl in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getExtensionTest.
/*
* @testName: getExtensionTest
*
* @assertion_ids: JAXRS:JAVADOC:26;
*
* @test_Strategy: Client instantiate one CacheControl instance using
* Constructor CacheControl(). verify getCacheExtension method work correctly.
*/
@Test
public void getExtensionTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
Map<String, String> map_exp = new HashMap<String, String>();
map_exp.put("community", "\"UCI\"");
CacheControl ccl8 = new CacheControl();
ccl8.setProxyRevalidate(true);
ccl8.setPrivate(true);
ccl8.setNoTransform(true);
ccl8.setNoStore(true);
ccl8.setNoCache(true);
ccl8.setMustRevalidate(false);
ccl8.setSMaxAge(-1);
ccl8.setMaxAge(200);
Map<String, String> map_actual = ccl8.getCacheExtension();
if (map_actual.size() != 0) {
pass = false;
sb.append("Expected map size 0, got" + map_actual.size() + newline);
}
map_actual.put("community", "\"UCI\"");
map_actual = ccl8.getCacheExtension();
if (!map_exp.equals(map_actual)) {
pass = false;
sb.append("Map comparison failed" + newline);
}
sb.append("Expected Map: ");
for (Entry<String, String> entry : map_exp.entrySet()) {
sb.append("key=" + entry.getKey() + "; value=" + entry.getValue() + ";" + newline);
}
if (!pass) {
for (Entry<String, String> entry : map_actual.entrySet()) {
sb.append("key= " + entry.getKey() + "; value=" + entry.getValue() + ";");
sb.append(newline);
}
throw new Fault("At least one assertion failed: " + sb.toString());
}
TestUtil.logTrace(sb.toString());
}
use of jakarta.ws.rs.core.CacheControl in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method proxyRevalidateTest.
/*
* @testName: proxyRevalidateTest
*
* @assertion_ids: JAXRS:JAVADOC:24; JAXRS:JAVADOC:28; JAXRS:JAVADOC:29;
* JAXRS:JAVADOC:32; JAXRS:JAVADOC:33; JAXRS:JAVADOC:34; JAXRS:JAVADOC:35;
* JAXRS:JAVADOC:36; JAXRS:JAVADOC:37; JAXRS:JAVADOC:44;
*
* @test_Strategy: Client instantiate a CacheControl instance using Constructor
* CacheControl(). Verify all values are set correctly.
*/
@Test
public void proxyRevalidateTest() throws Fault {
boolean pass = true;
StringBuffer sb = new StringBuffer();
boolean proxyRevalidate = false;
expected[6] = proxyRevalidate;
CacheControl ccl5 = new CacheControl();
ccl5.setProxyRevalidate(proxyRevalidate);
pass = verifyList(expected, ccl5, sb);
proxyRevalidate = true;
expected[6] = proxyRevalidate;
ccl5.setProxyRevalidate(proxyRevalidate);
pass &= verifyList(expected, ccl5, sb);
assertTrue(pass, "At least one assertion failed: " + sb);
}
Aggregations