Skip to content

Commit 4d4bf02

Browse files
CarolynRountreeddsharpe
authored andcommitted
Wdt support for 1411 (#464)
* Add unit test and fixes found by testing * validation support for unicode * message for jrf in 14.1.1 no supported and pom changes * updated shell scripts to support JDK greater than 1.8 * toString no longer exists in Jython 2.7.1
1 parent 3822dd1 commit 4d4bf02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+241
-124
lines changed

core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,10 @@ public void __setitem__(PyObject key, PyObject value) {
280280
synchronized (this.linkedHashMap) {
281281
this.linkedHashMap.put(key, value);
282282
}
283-
synchronized (super.table) {
284-
super.table.put(key, value);
285-
}
283+
// do not access protected field directly.
284+
// 2.7 version does not have table variable.
285+
// Neither version has synchronization on the table.
286+
super.__setitem__(key, value);
286287
}
287288

288289
/**
@@ -291,7 +292,7 @@ public void __setitem__(PyObject key, PyObject value) {
291292
@Override
292293
public void clear() {
293294
this.linkedHashMap.clear();
294-
super.table.clear();;
295+
super.clear();
295296
}
296297

297298
/**
@@ -503,6 +504,7 @@ private static PyObject doDeepCopy(PyObject orig, PyObject memo) {
503504
case "long":
504505
case "NoneType":
505506
case "str":
507+
case "unicode":
506508
result = orig;
507509
break;
508510

core/src/main/python/create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The main module for the WLSDeploy tool to create empty domains.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99
from java.io import IOException
1010
from java.lang import IllegalArgumentException
@@ -487,6 +487,6 @@ def main(args):
487487
return
488488

489489

490-
if __name__ == "main":
490+
if __name__ == '__main__' or __name__ == 'main':
491491
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
492492
main(sys.argv)

core/src/main/python/deploy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The entry point for the deployApps tool.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99

1010
from java.io import IOException, PrintStream
@@ -437,6 +437,6 @@ def main(args):
437437
return
438438

439439

440-
if __name__ == "main":
440+
if __name__ == '__main__' or __name__ == 'main':
441441
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
442442
main(sys.argv)

core/src/main/python/discover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The entry point for the discoverDomain tool.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99

1010
from java.io import File
@@ -525,6 +525,6 @@ def main(args):
525525

526526
__log_and_exit(model_context, exit_code, _class_name, _method_name)
527527

528-
if __name__ == 'main':
528+
if __name__ == '__main__' or __name__ == 'main':
529529
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
530530
main(sys.argv)

core/src/main/python/encrypt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The main module for the WLSDeploy tool to encrypt passwords.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99

1010
from java.io import IOException
@@ -285,6 +285,6 @@ def main(args):
285285
sys.exit(exit_code)
286286

287287

288-
if __name__ == "main":
288+
if __name__ == '__main__' or __name__ == 'main':
289289
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
290290
main(sys.argv)

core/src/main/python/update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The entry point for the updateDomain tool.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99

1010
from java.io import IOException, PrintStream
@@ -454,6 +454,6 @@ def main(args):
454454
return
455455

456456

457-
if __name__ == "main":
457+
if __name__ == '__main__' or __name__ == 'main':
458458
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
459459
main(sys.argv)

core/src/main/python/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
The WLS Deploy tooling entry point for the validateModel tool.
66
"""
7-
import javaos as os
7+
import os
88
import sys
99
from java.util.logging import Level
1010

@@ -254,6 +254,6 @@ def main(args):
254254
return
255255

256256

257-
if __name__ == "main":
257+
if __name__ == '__main__' or __name__ == 'main':
258258
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
259259
main(sys.argv)

core/src/main/python/variable_inject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,6 @@ def main(args):
310310
__logger.exiting(result=exit_code, class_name=_class_name, method_name=_method_name)
311311
sys.exit(exit_code)
312312

313-
if __name__ == 'main':
313+
if __name__ == '__main__' or __name__ == 'main':
314314
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
315315
main(sys.argv)

core/src/main/python/wlsdeploy/aliases/alias_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def merge_model_and_existing_lists(model_list, existing_list, string_list_separa
7474
result = model_list
7575
elif model_list is None or len(model_list) == 0:
7676
result = existing_list
77-
if type(model_list) is str and type(existing_list) is not str:
77+
if isinstance(model_list, basestring) and not isinstance(existing_list, basestring):
7878
result = string_list_separator_char.join(existing_list)
7979
else:
80-
model_list_is_string = type(model_list) is str
80+
model_list_is_string = isinstance(model_list, basestring)
8181
model_set = _create_set(model_list, string_list_separator_char, 'WLSDPLY-08000')
8282
existing_set = _create_set(existing_list, string_list_separator_char, 'WLSDPLY-08001')
8383

@@ -107,7 +107,7 @@ def merge_model_and_existing_properties(model_props, existing_props, string_prop
107107
result = model_props
108108
elif model_props is None or len(model_props) == 0:
109109
result = existing_props
110-
if type(model_props) is str and type(existing_props) is not str:
110+
if isinstance(model_props, basestring) and isinstance(existing_props, basestring):
111111
result = _properties_to_string(existing_props, string_props_separator_char)
112112
else:
113113
model_props_is_string = False
@@ -517,7 +517,7 @@ def convert_boolean(value):
517517
result = True
518518
elif value == 0:
519519
result = False
520-
elif type(value) is str:
520+
elif isinstance(value, basestring):
521521
if value.lower() == 'true':
522522
result = True
523523
elif value.lower() == 'false':
@@ -844,7 +844,7 @@ def _get_path_separator(value):
844844
_logger.entering(value, class_name=_class_name, method_name=_method_name)
845845

846846
result = File.pathSeparator
847-
if type(value) is str and len(value) > 0:
847+
if isinstance(value, basestring) and len(value) > 0:
848848
# If the value has a windows separator or a single directory that starts with a drive letter
849849
if ';' in value or _windows_path_regex.match(value):
850850
result = ';'
@@ -972,7 +972,7 @@ def _properties_to_string(props, string_props_separator_char):
972972
_logger.entering(props, string_props_separator_char, class_name=_class_name, method_name=_method_name)
973973
if props is None:
974974
result = ''
975-
elif type(props) is str:
975+
elif isinstance(props, basestring):
976976
result = props
977977
else:
978978
result = ''

core/src/main/python/wlsdeploy/json/json_translator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
This model provider translation classes that convert between JSON and Python Dictionaries.
66
"""
7+
import types
8+
79
import java.io.FileNotFoundException as JFileNotFoundException
810
import java.io.FileOutputStream as JFileOutputStream
911
import java.io.IOException as JIOException
@@ -202,21 +204,22 @@ def _format_json_value(value):
202204
"""
203205
import java.lang.StringBuilder as StringBuilder
204206
builder = StringBuilder()
205-
if type(value) == bool or (type(value) == str and (value == 'true' or value == 'false')):
207+
if type(value) == bool or (isinstance(value, types.StringTypes) and (value == 'true' or value == 'false')):
206208
builder.append(JBoolean.toString(value))
207-
elif type(value) == str:
208-
builder.append('"').append(_quote_embedded_quotes(value)).append('"')
209+
elif isinstance(value, types.StringTypes):
210+
builder.append('"').append(_quote_embedded_quotes(value.strip())).append('"')
209211
else:
210212
builder.append(value)
211213
return builder.toString()
212214

215+
213216
def _quote_embedded_quotes(text):
214217
"""
215218
Quote all embedded double quotes in a string with a backslash.
216219
:param text: the text to quote
217220
:return: the quotes result
218221
"""
219222
result = text
220-
if type(text) is str and '"' in text:
223+
if isinstance(text, types.StringTypes) and '"' in text:
221224
result = text.replace('"', '\\"')
222225
return result

0 commit comments

Comments
 (0)