1313
1414public class CoreRefreshTest {
1515 @ ParameterizedTest (name = "Refresh test - UrlPath: {1} - JsonPath: {2}" )
16- @ MethodSource ({"suite.core.TestData#refreshArgs" })
16+ @ MethodSource ({"suite.core.TestData#refreshArgs" , "suite.core.TestData#refreshArgsEncrypted" })
1717 public void testLocationRefresh_Public_Success (Core core , String urlPath , String jsonPath ) throws Exception {
18- JsonNode response = core .getWithCoreApiToken (urlPath );
18+ JsonNode response = core .getWithCoreApiToken (urlPath , "5.0.1" );
1919
2020 assertAll ("testLocationRefresh_Public_Success has version and location" ,
2121 () -> assertNotNull (response ),
2222 () -> assertNotEquals ("" , response .at ("/version" ).asText (), "Version was empty" ),
23- () -> assertNotEquals ("" , response .at ("/" + jsonPath + "/location" ).asText (), "/" + jsonPath + "/location was empty" ));
23+ () -> assertNotEquals ("" , response .at ("/" + jsonPath + "/location" ).asText (), "/" + jsonPath + "/location was empty" ),
24+ () -> assertFalse (response .at ("/" + jsonPath + "/location" ).asText ().contains ("encrypted" )));
25+ }
26+
27+ @ ParameterizedTest (name = "Refresh test - UrlPath: {1} - JsonPath: {2}" )
28+ @ MethodSource ({"suite.core.TestData#refreshArgsEncrypted" })
29+ public void testLocationRefreshCloudEncryption_Public_Success (Core core , String urlPath , String jsonPath ) throws Exception {
30+ JsonNode response = core .getWithCoreApiToken (urlPath , "10000.0.1" );
31+
32+ assertAll ("testLocationRefresh_Public_Success has version and location" ,
33+ () -> assertNotNull (response ),
34+ () -> assertNotEquals ("" , response .at ("/version" ).asText (), "Version was empty" ),
35+ () -> assertNotEquals ("" , response .at ("/" + jsonPath + "/location" ).asText (), "/" + jsonPath + "/location was empty" ),
36+ () -> assertTrue (response .at ("/" + jsonPath + "/location" ).asText ().contains ("encrypted" )));
2437 }
2538
2639 @ ParameterizedTest (name = "Refresh test - UrlPath: {1} - CollectionName: {2}" )
@@ -42,6 +55,26 @@ public void testCollectionRefresh_Public_Success(Core core, String urlPath, Stri
4255 }
4356 }
4457
58+ @ ParameterizedTest (name = "Refresh test - UrlPath: {1} - CollectionName: {2}" )
59+ @ MethodSource ({"suite.core.TestData#collectionEndpointArgs" })
60+ public void testCollectionRefreshCloud_Encryption_Public_Success (Core core , String urlPath , String collectionName ) throws Exception {
61+ JsonNode response = core .getWithCoreApiToken (urlPath , "10000.0.1" );
62+
63+ assertAll ("testCollectionRefresh_Public_Success has version and collection" ,
64+ () -> assertNotNull (response , "Response should not be null" ),
65+ () -> assertNotEquals ("" , response .at ("/version" ).asText (), "Version was empty" ),
66+ () -> assertNotNull (response .at ("/" + collectionName ), "Collection should not be null" )
67+ );
68+
69+ ArrayNode nodes = (ArrayNode ) response .at ("/" + collectionName );
70+ for (JsonNode node : nodes ) {
71+ assertTrue (JsonAssert .hasContentInFields (
72+ node , List .of ("/effective" , "/expires" , "/location" , "/size" )
73+ ), "Collection node was missing expected content" );
74+ assertTrue (node .get ("location" ).asText ().contains ("encrypted" ));
75+ }
76+ }
77+
4578 @ ParameterizedTest (name = "Refresh test - UrlPath: {1} - JsonPath: {2}" )
4679 @ MethodSource ({"suite.core.TestData#optOutRefreshArgs" })
4780 public void testOptOut_LocationRefresh_Public_Success (Core core , String urlPath , String jsonPath ) throws Exception {
0 commit comments