def get_variable_file(self):
        if self._variable_file is None:
            variable_file_name = dictionary_utils.get_element(self._settings_id_dict,
                                                              TestDefSettings.VARIABLE_FILE)
            self._variable_file = testing_helper.verify_file_exists(variable_file_name, self._logger)

        return self._variable_file
    def __run_using_script_to_run(self, script_path, settings):
        script_to_run = testing_helper.verify_file_exists(script_path, self._logger)

        env = _populate_env_map(settings)

        args = _populate_tool_args([], settings)

        script_runner = ScriptRunner(env, self._stage.get_name())
        exit_code = script_runner.executeScript(script_to_run, True, None, args)
        self.assertEqual(exit_code, 0, testing_helper.format_message('WLSDPLY-09835', script_to_run, exit_code))
Beispiel #3
0
        def verify_test_def_metadata(self, metadata_file_name):
            """

            :param metadata_file_name: File name for the test definition metadata file
            :return: A TestResult object containing the results of the verification test
            :raises VerificationException: if one is thrown while running the verification test stage's steps
            """
            _method_name = 'verify_test_def_metadata'

            self._logger.entering(class_name=self._class_name, method_name=_method_name)

            self._logger.info('WLSDPLY-09859', metadata_file_name,
                              class_name=self._class_name, method_name=_method_name)

            test_def_metadata_file = testing_helper.verify_file_exists(metadata_file_name, self._logger)
            test_def_metadata_dict = testing_helper.translate_file(test_def_metadata_file, self._logger)

            verify_test_def_file_path = \
                '%s/%s/%s' % (testing_constants.VERIFICATION_TEST_DIR,
                              testing_constants.CERTIFIED_DIR,
                              testing_constants.DEFAULT_TEST_DEF_METADATA_VERIFIER_TEST)

            stage_name = testing_constants.METADATA_FILE_VERIFICATION_STAGE_NAME

            verify_test_def_file = testing_helper.extract_file(verify_test_def_file_path, self._logger)
            verify_test_def = TestDef(verify_test_def_file, self._logger)

            stage = verify_test_def.get_stage(stage_name)

            if stage is None:
                ex = \
                    exception_helper.create_verification_exception('WLSDPLY-09815',
                                                                   stage_name,
                                                                   verify_test_def.get_def_file_name())
                self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
                raise ex

            stage_module = self._stage_runner.get_stage_module(stage)
            stage_class = getattr(stage_module, stage.get_class_name())

            suite = unittest.TestSuite()

            test_result = TestResult(stage_name)

            for step_name in stage.get_step_names():
                suite.addTest(stage_class(step_name, test_def_metadata_file, test_def_metadata_dict,
                                          stage, test_result, self._logger))

            suite.run(test_result)

            self._logger.exiting(class_name=self._class_name, method_name=_method_name)

            return test_result
Beispiel #4
0
    def stepShutdownAdminServer(self):
        _method_name = 'stepShutdownAdminServer'

        settings_1 = self._test_def.get_settings(_SETTINGS_1)

        can_proceed = (settings_1.is_field_set(
            TestDefSettings.ADMIN_SERVER_NAME),
                       settings_1.is_field_set(TestDefSettings.DOMAIN_HOME),
                       settings_1.is_field_set(TestDefSettings.DOMAIN_NAME))

        if 0 in can_proceed:
            needed_fields = [
                TestDefSettings.ADMIN_SERVER_NAME, TestDefSettings.DOMAIN_HOME,
                TestDefSettings.DOMAIN_NAME
            ]

            missing_fields = [
                needed_fields[i] for i, x in enumerate(can_proceed) if x == 0
            ]
            self.fail(
                testing_helper.format_message('WLSDPLY-09854',
                                              settings_1.get_id(),
                                              ', '.join(missing_fields)))

        admin_server_name = settings_1.get_admin_server_name()
        domain_name = settings_1.get_domain_name()
        domain_home = settings_1.get_domain_home()

        script_runner = ScriptRunner(HashMap(), admin_server_name)
        script_to_run = testing_helper.verify_file_exists(
            '%s/%s' % (domain_home, self._stage.get_script_to_run()),
            self._logger)

        admin_user = settings_1.get_admin_user()
        admin_url = settings_1.get_admin_url()

        args = list()

        args.append('%s' % admin_user)
        args.append('%s' % settings_1.get_admin_pass())
        args.append('%s' % admin_url)

        self._logger.info('WLSDPLY-09846',
                          admin_server_name,
                          domain_name,
                          admin_url,
                          admin_user,
                          class_name=_class_name,
                          method_name=_method_name)

        exit_code = script_runner.executeScript(script_to_run, True, None,
                                                args)
        self.assertEqual(
            exit_code, 0,
            testing_helper.format_message('WLSDPLY-09835', script_to_run,
                                          exit_code))

        self._logger.info('WLSDPLY-09847',
                          admin_server_name,
                          domain_name,
                          class_name=_class_name,
                          method_name=_method_name)

        return
    def get_prev_model_file(self):
        if self._prev_model_file is None:
            prev_model_file_name = self.get_prev_model_file_name()
            self._prev_model_file = testing_helper.verify_file_exists(prev_model_file_name, self._logger)

        return self._prev_model_file
    def get_archive_file(self):
        if self._archive_file is None:
            archive_file_name = self.get_archive_file_name()
            self._archive_file = testing_helper.verify_file_exists(archive_file_name, self._logger)

        return self._archive_file