Skip to content

Commit 8a5eced

Browse files
authored
Don't capitalize true/false values when parsing model (#745)
* JIRA WDT-463 - Don't capitalize true/false values when parsing model * JIRA WDT-463 - Combine else clause
1 parent 8b28bff commit 8a5eced

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

core/src/main/java/oracle/weblogic/deploy/yaml/AbstractYamlTranslator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ private PyObject getBooleanValue(String name, String text) {
305305
String booleanValue = "False";
306306
if (!StringUtils.isEmpty(text)) {
307307
text = StringUtils.stripQuotes(text.trim());
308-
if ("true".equalsIgnoreCase(text)) {
309-
booleanValue = "True";
310-
} else if ("false".equalsIgnoreCase(text)) {
311-
booleanValue = "False";
308+
// don't adjust value, it may not be intended as boolean
309+
if ("true".equalsIgnoreCase(text) || "false".equalsIgnoreCase(text)) {
310+
booleanValue = text;
312311
} else {
313312
getLogger().warning("WLSDPLY-18000", name, text);
314313
}

core/src/test/python/variable_injector_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2018, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import unittest
@@ -215,8 +215,8 @@ def testWithMBeanName(self):
215215
def testWithListMBeanName(self):
216216
expected = dict()
217217
short_name = self._helper.get_folder_short_name(LocationContext().append_location('Server'))
218-
expected[short_name + '.m1.SSL.Enabled'] = 'True'
219-
expected[short_name + '.m2.SSL.Enabled'] = 'True'
218+
expected[short_name + '.m1.SSL.Enabled'] = 'true'
219+
expected[short_name + '.m2.SSL.Enabled'] = 'true'
220220
replacement_dict = dict()
221221
replacement_dict['Server[m1,m2].SSL.Enabled'] = dict()
222222
actual = self._helper.inject_variables(replacement_dict)
@@ -225,18 +225,18 @@ def testWithListMBeanName(self):
225225
def testWithManagedServerKeyword(self):
226226
short_name = self._helper.get_folder_short_name(LocationContext().append_location('Server'))
227227
expected = dict()
228-
expected[short_name + '.m1.SSL.Enabled'] = 'True'
229-
expected[short_name + '.m2.SSL.Enabled'] = 'True'
228+
expected[short_name + '.m1.SSL.Enabled'] = 'true'
229+
expected[short_name + '.m2.SSL.Enabled'] = 'true'
230230
replacement_dict = dict()
231231
replacement_dict['Server[MANAGED_SERVERS].SSL.Enabled'] = dict()
232232
actual = self._helper.inject_variables(replacement_dict)
233233
self._compare_to_expected_dictionary(expected, actual)
234234

235235
def testWithMultiKeyword(self):
236236
expected = dict()
237-
expected['Server.AdminServer.SSL.Enabled'] = 'True'
238-
expected['Server.m1.SSL.Enabled'] = 'True'
239-
expected['Server.m2.SSL.Enabled'] = 'True'
237+
expected['Server.AdminServer.SSL.Enabled'] = 'true'
238+
expected['Server.m1.SSL.Enabled'] = 'true'
239+
expected['Server.m2.SSL.Enabled'] = 'true'
240240
replacement_dict = dict()
241241
replacement_dict['Server[MANAGED_SERVERS,ADMIN_SERVER].SSL.Enabled'] = dict()
242242
actual = self._helper.inject_variables(replacement_dict)

0 commit comments

Comments
 (0)