コード例 #1
0
class TestHordeRunner(TestCase):
    def setUp(self):
        LOG.set_none()
        self.layout = MockLayout(True)
        self.horde_layout = HordeLayout(self.layout.jira_home())
        self.args = Mock()
        self.args.layout = self.layout
        self.args.horde_layout = self.horde_layout
        self.args.with_workspace = False
        self.args.mvn_clean = False
        self.horde_status_checker = MockStatusChecker()

    def test_horde_is_not_run_when_one_is_already_running(self):
        horde_runner = MockHordeRunner(self.args, MockFileUtils(), Mock(), self.horde_status_checker.running())
        horde_runner(Mock())
        self.assertFalse(horde_runner.executed,
                         "Parent class should not be executed when another instance is already running")

    def test_horde_skeleton_is_not_copied_when_directory_exists(self):
        file_utils = MockFileUtils()
        process_utils = Mock().default_check_output('Maven:3.3.2\nJava home:jdk_home\n:Java version 1.2.3_123'.encode())
        horde_runner = MockHordeRunner(self.args, file_utils, process_utils, self.horde_status_checker.not_running())
        horde_runner(Mock())
        self.assertTrue(file_utils.verify_copy_tree(self.horde_layout.horde_skeleton_dir(),
                                                    self.horde_layout.horde_home_dir(False)))
        self.assertFalse(file_utils.verify_remove_dir(self.horde_layout.horde_home_dir(False)))

    def test_clean_removes_old_home(self):
        self.args.mvn_clean = True
        file_utils = MockFileUtils()
        process_utils = Mock().default_check_output('Maven:3.3.2\nJava home:jdk_home\n:Java version 1.2.3_123'.encode())
        horde_runner = MockHordeRunner(self.args, file_utils, process_utils, self.horde_status_checker.not_running())
        horde_runner(Mock())
        self.assertTrue(file_utils.verify_remove_dir(self.horde_layout.horde_home_dir(False)))
コード例 #2
0
ファイル: HordeRunner_test.py プロジェクト: linuxscn/mysource
 def setUp(self):
     LOG.set_none()
     self.layout = MockLayout(True)
     self.horde_layout = HordeLayout(self.layout.jira_home())
     self.args = Mock()
     self.args.layout = self.layout
     self.args.horde_layout = self.horde_layout
     self.args.with_workspace = False
     self.args.mvn_clean = False
     self.horde_status_checker = MockStatusChecker()
コード例 #3
0
ファイル: HordeRunner_test.py プロジェクト: linuxscn/mysource
class TestHordeRunner(TestCase):
    def setUp(self):
        LOG.set_none()
        self.layout = MockLayout(True)
        self.horde_layout = HordeLayout(self.layout.jira_home())
        self.args = Mock()
        self.args.layout = self.layout
        self.args.horde_layout = self.horde_layout
        self.args.with_workspace = False
        self.args.mvn_clean = False
        self.horde_status_checker = MockStatusChecker()

    def test_horde_is_not_run_when_one_is_already_running(self):
        horde_runner = MockHordeRunner(self.args, MockFileUtils(), Mock(),
                                       self.horde_status_checker.running())
        horde_runner(Mock())
        self.assertFalse(
            horde_runner.executed,
            "Parent class should not be executed when another instance is already running"
        )

    def test_horde_skeleton_is_not_copied_when_directory_exists(self):
        file_utils = MockFileUtils()
        process_utils = Mock().default_check_output(
            'Maven:3.3.2\nJava home:jdk_home\n:Java version 1.2.3_123'.encode(
            ))
        horde_runner = MockHordeRunner(self.args, file_utils, process_utils,
                                       self.horde_status_checker.not_running())
        horde_runner(Mock())
        self.assertTrue(
            file_utils.verify_copy_tree(
                self.horde_layout.horde_skeleton_dir(),
                self.horde_layout.horde_home_dir(False)))
        self.assertFalse(
            file_utils.verify_remove_dir(
                self.horde_layout.horde_home_dir(False)))

    def test_clean_removes_old_home(self):
        self.args.mvn_clean = True
        file_utils = MockFileUtils()
        process_utils = Mock().default_check_output(
            'Maven:3.3.2\nJava home:jdk_home\n:Java version 1.2.3_123'.encode(
            ))
        horde_runner = MockHordeRunner(self.args, file_utils, process_utils,
                                       self.horde_status_checker.not_running())
        horde_runner(Mock())
        self.assertTrue(
            file_utils.verify_remove_dir(
                self.horde_layout.horde_home_dir(False)))
コード例 #4
0
 def setUp(self):
     LOG.set_none()
     self.layout = MockLayout(True)
     self.horde_layout = HordeLayout(self.layout.jira_home())
     self.args = Mock()
     self.args.layout = self.layout
     self.args.horde_layout = self.horde_layout
     self.args.with_workspace = False
     self.args.mvn_clean = False
     self.horde_status_checker = MockStatusChecker()
コード例 #5
0
 def test_ondemand_option_adds_properties(self):
     #having
     self.args.layout.ondemand = True
     self.args.horde_layout = HordeLayout(self.layout.jira_home())
     tomcat_starter = MockTomcatStarter(self.args, True, MockFileUtils())
     #when
     tomcat_starter(Mock())
     #then
     opts = self.__get_opts_dict(tomcat_starter)
     self.__assertParameter(opts, '-Dstudio.initial.data.xml',
                            self.layout.studio_initial_data())
     self.__assertParameter(opts, '-Dstudio.home', self.layout.jira_home())
     self.__assertParameter(
         opts,
         '-Datlassian.darkfeature.com.atlassian.jira.config.CoreFeatures.ON_DEMAND',
         'true')
     self.__assertParameter(
         opts, '-Dcrowd.property.application.login.url',
         self.args.horde_layout.horde_application_login_url())
     self.__assertParameter(opts, '-Dcrowd.property.crowd.server.url',
                            self.args.horde_layout.horde_server_url())
     self.__assertParameter(opts, '-Dstudio.webdav.directory',
                            self.layout.webdav_dir())
     self.assertNotIn('-Djira.dev.bundledplugins.url', opts)