def testWLSRolesValidation(self):
        """
        Run the validation portion of the WLSRoles helper and check for expected results.
        """
        _method_name = 'testWLSRolesValidation'

        wlsroles_dict = {'Admin':     {'UpdateMode': 'append',
                                       'Expression': 'Grp(AppAdmin)'},
                         'Deployer':  {'UpdateMode': 'prepend',
                                       'Expression': 'Grp(AppDeployer)'},
                         'Tester':    {'Expression': 'Grp(AppTester)'},
                         'MyEmpty':   { },
                         'MyTester':  {'UpdateMode': 'append',
                                       'Expression': 'Grp(MyTester)'},
                         'MyTester2': {'UpdateMode': 'replace',
                                       'Expression': 'Grp(MyTester2)'},
                         'MyTester3': {'UpdateMode': 'bad',
                                       'Expression': 'Grp(MyTester3)'}}

        wlsroles_validator = wlsroles_helper.validator(wlsroles_dict, self._logger)
        wlsroles_validator.validate_roles()

        handler = SummaryHandler.findInstance()
        self.assertNotEqual(handler, None, "Summary handler is not present")

        # Verify only warnings resulted
        self.assertEqual(handler.getMessageCount(Level.SEVERE), 0)
        self.assertEqual(handler.getMessageCount(Level.WARNING), 3)
Beispiel #2
0
    def setUp(self):
        self.name = 'ValidationTestCase'
        self._logger = PlatformLogger('wlsdeploy.validate')
        self.wls_helper = WebLogicHelper(self._logger)

        # add summary handler to validate logger to check results
        self._summary_handler = SummaryHandler()
        self._logger.logger.addHandler(self._summary_handler)
    def setUp(self):
        self.name = 'CompareModelTestCase'
        self._logger = PlatformLogger('wlsdeploy.compare_model')
        self._program_name = 'CompareModelTestCase'

        # add summary handler to validate logger to check results
        self._summary_handler = SummaryHandler()
        PlatformLogger('wlsdeploy.validate').logger.addHandler(
            self._summary_handler)
Beispiel #4
0
    def setUp(self):
        self.name = 'ValidationTestCase'
        self._logger = PlatformLogger('wlsdeploy.validate')
        self.wls_helper = WebLogicHelper(self._logger)

        # add summary handler to validate logger to check results
        self._summary_handler = SummaryHandler()
        self._logger.logger.addHandler(self._summary_handler)

        # Define custom configuration path for WDT
        os.environ['WDT_CUSTOM_CONFIG'] = self._resources_dir
        # Indicate that WDT should persist model file
        os.environ['__WLSDEPLOY_STORE_MODEL__'] = self._wlsdeply_store_model
    def setUp(self):
        self.name = 'CompareModelTestCase'
        self._logger = PlatformLogger('wlsdeploy.compare_model')
        self._program_name = 'CompareModelTestCase'

        if not os.path.isdir(self._tests_dir):
            os.mkdir(self._tests_dir)

        if not os.path.isdir(self._results_dir):
            os.mkdir(self._results_dir)

        # add summary handler to validate logger to check results
        self._summary_handler = SummaryHandler()
        PlatformLogger('wlsdeploy.validate').logger.addHandler(
            self._summary_handler)
Beispiel #6
0
        except ValidateException, ve:
            __logger.severe('WLSDPLY-05404',
                            _program_name,
                            ve.getLocalizedMessage(),
                            error=ve,
                            class_name=_class_name,
                            method_name=_method_name)
            sys.exit(CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
    else:
        try:
            model_file_name = model_context.get_model_file()

            if model_file_name is not None:
                __perform_model_file_validation(model_file_name, model_context)

                summary_handler = SummaryHandler.findInstance()
                if summary_handler is not None:
                    summary_level = summary_handler.getMaximumMessageLevel()
                    if summary_level == Level.SEVERE:
                        exit_code = CommandLineArgUtil.PROG_ERROR_EXIT_CODE
                    elif summary_level == Level.WARNING:
                        exit_code = CommandLineArgUtil.PROG_WARNING_EXIT_CODE

        except ValidateException, ve:
            __logger.severe('WLSDPLY-20000',
                            _program_name,
                            ve.getLocalizedMessage(),
                            error=ve,
                            class_name=_class_name,
                            method_name=_method_name)
            cla_helper.clean_up_temp_files()
 def setUp(self):
     self.name = 'ValidationTestCase'
     self._logger = PlatformLogger('wlsdeploy.validate')
     self.wls_helper = WebLogicHelper(self._logger)
     self._logger.logger.addHandler(SummaryHandler())