@@ -190,6 +190,60 @@ def testCompareModelInvalidFile(self):
190190
191191 self .assertNotEqual (return_code , 0 )
192192
193+ def testDeleteModelAppDeployments (self ):
194+ _method_name = 'testCompareModelFull'
195+
196+ _variables_file = self ._resources_dir + '/compare_model_model1.10.properties'
197+ _new_model_file = self ._resources_dir + '/compare_model_model5.yaml'
198+ _old_model_file = self ._resources_dir + '/compare_model_model1.yaml'
199+ _temp_dir = os .path .join (tempfile .gettempdir (), _method_name )
200+
201+ if os .path .exists (_temp_dir ):
202+ shutil .rmtree (_temp_dir )
203+
204+ os .mkdir (_temp_dir )
205+
206+ mw_home = os .environ ['MW_HOME' ]
207+ args_map = {
208+ '-oracle_home' : mw_home ,
209+ '-variable_file' : _variables_file ,
210+ '-output_dir' : _temp_dir ,
211+ '-domain_type' : 'WLS' ,
212+ '-trailing_arguments' : [ _new_model_file , _old_model_file ]
213+ }
214+
215+ try :
216+ model_context = ModelContext ('CompareModelTestCase' , args_map )
217+ obj = ModelFileDiffer (_new_model_file , _old_model_file , model_context , _temp_dir )
218+ return_code = obj .compare ()
219+ self .assertEqual (return_code , 0 )
220+
221+ yaml_result = _temp_dir + os .sep + 'diffed_model.yaml'
222+ stdout_result = obj .get_compare_msgs ()
223+ model_dictionary = FileToPython (yaml_result ).parse ()
224+ yaml_exists = os .path .exists (yaml_result )
225+
226+ self .assertEqual (yaml_exists , True )
227+ self .assertEqual (len (stdout_result ), 1 )
228+
229+ self .assertEqual (model_dictionary .has_key ('appDeployments' ), True )
230+ self .assertEqual (model_dictionary ['appDeployments' ].has_key ('Library' ), True )
231+ self .assertEqual (model_dictionary ['appDeployments' ].has_key ('Application' ), True )
232+ self .assertEqual (model_dictionary ['appDeployments' ]['Application' ].has_key ('!myear' ), True )
233+ self .assertEqual (model_dictionary ['appDeployments' ]['Library' ].has_key ('!jax-rs#2.0@2.22.4.0' ), True )
234+ self .assertEqual (model_dictionary ['appDeployments' ]['Library' ].has_key ('!jsf#1.2@1.2.9.0' ), True )
235+
236+ except (CompareException , PyWLSTException ), te :
237+ return_code = 2
238+ self ._logger .severe ('WLSDPLY-05709' ,
239+ te .getLocalizedMessage (), error = te ,
240+ class_name = self ._program_name , method_name = _method_name )
241+
242+ if os .path .exists (_temp_dir ):
243+ shutil .rmtree (_temp_dir )
244+
245+ self .assertEqual (return_code , 0 )
246+
193247
194248if __name__ == '__main__' :
195249 unittest .main ()
0 commit comments