@@ -22,9 +22,6 @@ class ValidationTestCase(unittest.TestCase):
22
22
_program_name = 'validation_test'
23
23
_class_name = 'ValidationTestCase'
24
24
_resources_dir = '../../test-classes'
25
- _model_file = _resources_dir + '/test_jms_mail.json'
26
- _variable_file = None
27
- _archive_file = None
28
25
# _variable_file = _resources_dir + "/test_sub_variable_file.properties"
29
26
# _model_file = _resources_dir + '/test_empty.json'
30
27
# _variable_file = _resources_dir + "/test_invalid_variable_file.properties"
@@ -37,20 +34,15 @@ def setUp(self):
37
34
38
35
def testModelValidation (self ):
39
36
37
+ _model_file = self ._resources_dir + '/test_jms_mail.json'
40
38
_method_name = 'testModelValidation'
41
39
42
40
mw_home = os .environ ['MW_HOME' ]
43
41
args_map = {
44
42
'-oracle_home' : mw_home ,
45
- '-model_file' : self . _model_file
43
+ '-model_file' : _model_file
46
44
}
47
45
48
- if self ._variable_file is not None :
49
- args_map ['-variable_file' ] = self ._variable_file
50
-
51
- if self ._variable_file is not None :
52
- args_map ['-archive_file' ] = self ._archive_file
53
-
54
46
model_context = ModelContext ('ValidationTestCase' , args_map )
55
47
56
48
try :
@@ -85,5 +77,43 @@ def testIsCompatibleDataType(self):
85
77
class_name = self ._class_name , method_name = _method_name )
86
78
self .assertEqual (retval , True )
87
79
80
+ def testYamlModelValidation (self ):
81
+ """
82
+ Parse and validate a YAML model with '-' list type and attributes with negative values.
83
+ """
84
+
85
+ _model_file = self ._resources_dir + '/simple-model.yaml'
86
+ _archive_file = self ._resources_dir + "/SingleAppDomain.zip"
87
+ _method_name = 'testYamlModelValidation'
88
+
89
+ mw_home = os .environ ['MW_HOME' ]
90
+ args_map = {
91
+ '-oracle_home' : mw_home ,
92
+ '-model_file' : _model_file ,
93
+ '-archive_file' : _archive_file
94
+ }
95
+
96
+ model_context = ModelContext ('ValidationTestCase' , args_map )
97
+
98
+ try :
99
+ model_dictionary = FileToPython (model_context .get_model_file ()).parse ()
100
+ model_validator = Validator (model_context ,
101
+ wlst_mode = WlstModes .ONLINE )
102
+ return_code = model_validator .validate_in_tool_mode (model_dictionary ,
103
+ model_context .get_variable_file (),
104
+ model_context .get_archive_file_name ())
105
+ self ._logger .info ('The Validator.validate_in_tool_mode() call returned {0}' ,
106
+ Validator .ReturnCode .from_value (return_code ),
107
+ class_name = self ._class_name , method_name = _method_name )
108
+ except TranslateException , te :
109
+ return_code = Validator .ReturnCode .STOP
110
+ self ._logger .severe ('WLSDPLY-20009' ,
111
+ self ._program_name ,
112
+ model_context .get_model_file (),
113
+ te .getLocalizedMessage (), error = te ,
114
+ class_name = self ._class_name , method_name = _method_name )
115
+
116
+ self .assertNotEqual (return_code , Validator .ReturnCode .STOP )
117
+
88
118
if __name__ == '__main__' :
89
119
unittest .main ()
0 commit comments