3737@ ESTestCase .WithoutSecurityManager
3838public class PolicyUtilsTests extends ESTestCase {
3939
40- public void testCreatePluginPolicyWithOverride () {
40+ public void testCreatePluginPolicyWithPatch () {
4141
42- var policyForOverride = """
42+ var policyPatch = """
4343 versions:
4444 - 9.0.0
4545 - 9.0.0-SNAPSHOT
@@ -50,7 +50,7 @@ public void testCreatePluginPolicyWithOverride() {
5050 - set_https_connection_properties
5151 """ ;
5252 var base64EncodedPolicy = new String (
53- Base64 .getEncoder ().encode (policyForOverride .getBytes (StandardCharsets .UTF_8 )),
53+ Base64 .getEncoder ().encode (policyPatch .getBytes (StandardCharsets .UTF_8 )),
5454 StandardCharsets .UTF_8
5555 );
5656 final Policy expectedPolicy = new Policy (
@@ -61,7 +61,7 @@ public void testCreatePluginPolicyWithOverride() {
6161 )
6262 );
6363
64- var policy = PolicyUtils .parsePolicyOverrideIfExists (
64+ var policy = PolicyUtils .parseEncodedPolicyIfExists (
6565 base64EncodedPolicy ,
6666 "9.0.0" ,
6767 true ,
@@ -72,17 +72,17 @@ public void testCreatePluginPolicyWithOverride() {
7272 assertThat (policy , equalTo (expectedPolicy ));
7373 }
7474
75- public void testCreatePluginPolicyWithOverrideAnyVersion () {
75+ public void testCreatePluginPolicyWithPatchAnyVersion () {
7676
77- var policyForOverride = """
77+ var policyPatch = """
7878 policy:
7979 entitlement-module-name:
8080 - load_native_libraries
8181 entitlement-module-name-2:
8282 - set_https_connection_properties
8383 """ ;
8484 var base64EncodedPolicy = new String (
85- Base64 .getEncoder ().encode (policyForOverride .getBytes (StandardCharsets .UTF_8 )),
85+ Base64 .getEncoder ().encode (policyPatch .getBytes (StandardCharsets .UTF_8 )),
8686 StandardCharsets .UTF_8
8787 );
8888
@@ -94,7 +94,7 @@ public void testCreatePluginPolicyWithOverrideAnyVersion() {
9494 )
9595 );
9696
97- var policy = PolicyUtils .parsePolicyOverrideIfExists (
97+ var policy = PolicyUtils .parseEncodedPolicyIfExists (
9898 base64EncodedPolicy ,
9999 "abcdef" ,
100100 true ,
@@ -105,9 +105,9 @@ public void testCreatePluginPolicyWithOverrideAnyVersion() {
105105 assertThat (policy , equalTo (expectedPolicy ));
106106 }
107107
108- public void testNoOverriddenPolicyWithVersionMismatch () {
108+ public void testNoPatchWithVersionMismatch () {
109109
110- var policyForOverride = """
110+ var policyPatch = """
111111 versions:
112112 - 9.0.0
113113 - 9.0.0-SNAPSHOT
@@ -118,11 +118,11 @@ public void testNoOverriddenPolicyWithVersionMismatch() {
118118 - set_https_connection_properties
119119 """ ;
120120 var base64EncodedPolicy = new String (
121- Base64 .getEncoder ().encode (policyForOverride .getBytes (StandardCharsets .UTF_8 )),
121+ Base64 .getEncoder ().encode (policyPatch .getBytes (StandardCharsets .UTF_8 )),
122122 StandardCharsets .UTF_8
123123 );
124124
125- var policy = PolicyUtils .parsePolicyOverrideIfExists (
125+ var policy = PolicyUtils .parseEncodedPolicyIfExists (
126126 base64EncodedPolicy ,
127127 "9.1.0" ,
128128 true ,
@@ -133,9 +133,9 @@ public void testNoOverriddenPolicyWithVersionMismatch() {
133133 assertThat (policy , nullValue ());
134134 }
135135
136- public void testNoOverriddenPolicyWithValidationError () {
136+ public void testNoPatchWithValidationError () {
137137
138- var policyForOverride = """
138+ var policyPatch = """
139139 versions:
140140 - 9.0.0
141141 - 9.0.0-SNAPSHOT
@@ -146,29 +146,29 @@ public void testNoOverriddenPolicyWithValidationError() {
146146 - set_https_connection_properties
147147 """ ;
148148 var base64EncodedPolicy = new String (
149- Base64 .getEncoder ().encode (policyForOverride .getBytes (StandardCharsets .UTF_8 )),
149+ Base64 .getEncoder ().encode (policyPatch .getBytes (StandardCharsets .UTF_8 )),
150150 StandardCharsets .UTF_8
151151 );
152152
153- var policy = PolicyUtils .parsePolicyOverrideIfExists (base64EncodedPolicy , "9.0.0" , true , "test-plugin" , Set .of ());
153+ var policy = PolicyUtils .parseEncodedPolicyIfExists (base64EncodedPolicy , "9.0.0" , true , "test-plugin" , Set .of ());
154154
155155 assertThat (policy , nullValue ());
156156 }
157157
158- public void testNoOverriddenPolicyWithParsingError () {
158+ public void testNoPatchWithParsingError () {
159159
160- var policyForOverride = """
160+ var policyPatch = """
161161 entitlement-module-name:
162162 - load_native_libraries
163163 entitlement-module-name-2:
164164 - set_https_connection_properties
165165 """ ;
166166 var base64EncodedPolicy = new String (
167- Base64 .getEncoder ().encode (policyForOverride .getBytes (StandardCharsets .UTF_8 )),
167+ Base64 .getEncoder ().encode (policyPatch .getBytes (StandardCharsets .UTF_8 )),
168168 StandardCharsets .UTF_8
169169 );
170170
171- var policy = PolicyUtils .parsePolicyOverrideIfExists (base64EncodedPolicy , "9.0.0" , true , "test-plugin" , Set .of ());
171+ var policy = PolicyUtils .parseEncodedPolicyIfExists (base64EncodedPolicy , "9.0.0" , true , "test-plugin" , Set .of ());
172172
173173 assertThat (policy , nullValue ());
174174 }
0 commit comments