Exemplo n.º 1
0
    def test_plugin_should_be_recompiled_when_pom_newer_than_target(self):
        module_name = 'module1'
        self.prepare_bp_ok()
        self.prepare_plugin_that_should_not_be_recompiled()
        self.file_utils.expect_file_exists(JMAKE_PROFILES_PLUGINS_LIST,
                                           toReturn=True)
        self.file_utils.expect_read_lines(JMAKE_PROFILES_PLUGINS_LIST,
                                          toReturn=[])
        plugin_jar = JIRA_PLUGINS_DIR_ABS + os.sep + module_name + os.sep + 'target' + os.sep + 'test.jar'
        self.file_utils.expect_read_lines(BUNDLED_PLUGINS_LIST,
                                          toReturn=[plugin_jar])
        self.file_utils.expect_file_exists(plugin_jar, toReturn=True)
        self.file_utils.expect_getmtime('root' + os.sep + 'src', toReturn=100)
        self.file_utils.expect_getmtime('root' + os.sep + 'target',
                                        toReturn=200)
        self.file_utils.expect_getmtime(PLUGIN_POM_DIR.format(module_name),
                                        toReturn=300)
        self.file_utils.expect_walk(PLUGIN_TARGET_DIR.format(module_name),
                                    {'files': ['target']})
        self.file_utils.expect_walk(PLUGIN_SRC_DIR.format(module_name),
                                    {'files': ['src']})

        plugins = self.finder.find_plugins_to_recompile([])

        self.assertListEqual(plugins, ['jira-components/jira-plugins/module1'])
 def prepare_plugin_that_should_not_be_recompiled(self):
     """
     This method adds some noise to files structure to make sure that 'good' plugins are not recompiled
     """
     module_name = 'goodModule'
     plugin_jar = JIRA_PLUGINS_DIR_ABS + os.sep + module_name + os.sep + 'target' + os.sep + 'test.jar'
     self.file_utils.expect_read_lines(BUNDLED_PLUGINS_LIST, toReturn=[plugin_jar])
     self.file_utils.expect_file_exists(plugin_jar, toReturn=True)
     self.file_utils.expect_getmtime('root' + os.sep + 'srcGood', toReturn=100)
     self.file_utils.expect_getmtime('root' + os.sep + 'targetGood', toReturn=200)
     self.file_utils.expect_getmtime(PLUGIN_POM_DIR.format(module_name), toReturn=150)
     self.file_utils.expect_walk(PLUGIN_TARGET_DIR.format(module_name), {'files': ['targetGood']})
     self.file_utils.expect_walk(PLUGIN_SRC_DIR.format(module_name), {'files': ['srcGood']})
    def test_plugin_should_be_recompiled_when_src_newer_than_target(self):
        self.prepare_bp_ok()
        self.prepare_plugin_that_should_not_be_recompiled()
        self.file_utils.expect_file_exists(JMAKE_PROFILES_PLUGINS_LIST, toReturn=True)
        self.file_utils.expect_read_lines(JMAKE_PROFILES_PLUGINS_LIST, toReturn=[])
        module_name = 'module1'
        plugin_jar = JIRA_PLUGINS_DIR_ABS + os.sep + module_name + os.sep + 'target' + os.sep + 'test.jar'
        self.file_utils.expect_read_lines(BUNDLED_PLUGINS_LIST, toReturn=[plugin_jar])
        self.file_utils.expect_file_exists(plugin_jar, toReturn=True)
        self.file_utils.expect_getmtime('root' + os.sep + 'src', toReturn=200)
        self.file_utils.expect_getmtime('root' + os.sep + 'target', toReturn=100)
        self.file_utils.expect_walk(PLUGIN_TARGET_DIR.format(module_name), {'files': ['target']})
        self.file_utils.expect_walk(PLUGIN_SRC_DIR.format(module_name), {'files': ['src']})
        plugins = self.finder.find_plugins_to_recompile([])

        self.assertListEqual(plugins, ['jira-components/jira-plugins/module1'])
Exemplo n.º 4
0
 def prepare_plugin_that_should_not_be_recompiled(self):
     """
     This method adds some noise to files structure to make sure that 'good' plugins are not recompiled
     """
     module_name = 'goodModule'
     plugin_jar = JIRA_PLUGINS_DIR_ABS + os.sep + module_name + os.sep + 'target' + os.sep + 'test.jar'
     self.file_utils.expect_read_lines(BUNDLED_PLUGINS_LIST,
                                       toReturn=[plugin_jar])
     self.file_utils.expect_file_exists(plugin_jar, toReturn=True)
     self.file_utils.expect_getmtime('root' + os.sep + 'srcGood',
                                     toReturn=100)
     self.file_utils.expect_getmtime('root' + os.sep + 'targetGood',
                                     toReturn=200)
     self.file_utils.expect_getmtime(PLUGIN_POM_DIR.format(module_name),
                                     toReturn=150)
     self.file_utils.expect_walk(PLUGIN_TARGET_DIR.format(module_name),
                                 {'files': ['targetGood']})
     self.file_utils.expect_walk(PLUGIN_SRC_DIR.format(module_name),
                                 {'files': ['srcGood']})