Ejemplo n.º 1
0
 def test_deploy_plugins_must_not_clean_prev_plugins_if_not_jc_is_deployed(
         self):
     logger = Logger(
         'plugins_must_not_clean_prev_plugins_if_not_jc_is_deployed')
     jcsettings = self._scriptsettings(build=2843)
     antsettings = self._scriptsettings(build=574, project='antarcticle')
     try:
         logger.info('Given JCommune was deployed with one of its plugins')
         self._deploy(jcsettings)
         logger.info('When deploying Antarcticle')
         self._deploy(antsettings)
     except:
         logger.error('Oops, error happened during deployment')
         self._read_log_if_available(
             '/home/jtalks/tomcat/logs/catalina.out')
         self._read_log_if_available(
             '/home/jtalks/tomcat/logs/jcommune.log')
         raise
     plugins = os.listdir('/home/jtalks/.jtalks/plugins/system-test')
     logger.info('Then plugins stayed from prev jcommune deployment: [{0}]',
                 ', '.join(plugins))
     self.assertNotEqual(0, len(plugins),
                         'Actual plugins: ' + ', '.join(plugins))
     logger.info('And precisely the same plugin was left (QnA)')
     self.assertEqual(['questions-n-answers-plugin.jar'], plugins)
Ejemplo n.º 2
0
class Main:
    def __init__(self):
        self.logger = Logger("Main")

    def main(self, args, options):
        command = args[0]
        if command == "version":
            print __version__
            exit(0)
        script_settings = ScriptSettings(options)
        app_context = ApplicationContext(script_settings)
        if script_settings.grab_envs == "true":
            app_context.environment_config_grabber().grab_jtalks_configs()
            # recreating them after configs were updated
            script_settings = ScriptSettings(options)
            app_context = ApplicationContext(script_settings)
        try:
            if command == "deploy":
                LibVersion().log_lib_versions()
                app_context.deploy_command().deploy(
                    script_settings.project,
                    script_settings.build,
                    script_settings.get_app_final_name(),
                    script_settings.get_plugins(),
                )
            elif command == "upload-to-nexus":
                LibVersion().log_lib_versions()
                app_context.old_nexus().upload_war("pom.xml")
            elif command == "list-envs":
                app_context.env_list().list_envs()
            elif command == "load-db-from-backup":
                LibVersion().log_lib_versions()
                app_context.load_db_from_backup().load()
            else:
                error = (
                    "Command was not recognized, you can use: deploy, list-envs, load-db-from-backup. "
                    "Also see jtalks -h"
                )
                self.logger.error(error)
                raise RuntimeError(error)
        except:
            self.logger.error("Program finished with errors")
            if options.debug:
                print ("Root cause: %s" % traceback.format_exc())
                sys.exit(1)
Ejemplo n.º 3
0
 def test_deploy_plugins_must_not_clean_prev_plugins_if_not_jc_is_deployed(self):
     logger = Logger("plugins_must_not_clean_prev_plugins_if_not_jc_is_deployed")
     jcsettings = self._scriptsettings(build=2843)
     antsettings = self._scriptsettings(build=574, project="antarcticle")
     try:
         logger.info("Given JCommune was deployed with one of its plugins")
         self._deploy(jcsettings)
         logger.info("When deploying Antarcticle")
         self._deploy(antsettings)
     except:
         logger.error("Oops, error happened during deployment")
         self._read_log_if_available("/home/jtalks/tomcat/logs/catalina.out")
         self._read_log_if_available("/home/jtalks/tomcat/logs/jcommune.log")
         raise
     plugins = os.listdir("/home/jtalks/.jtalks/plugins/system-test")
     logger.info("Then plugins stayed from prev jcommune deployment: [{0}]", ", ".join(plugins))
     self.assertNotEqual(0, len(plugins), "Actual plugins: " + ", ".join(plugins))
     logger.info("And precisely the same plugin was left (QnA)")
     self.assertEqual(["questions-n-answers-plugin.jar"], plugins)
Ejemplo n.º 4
0
class Main:
    def __init__(self):
        self.logger = Logger('Main')

    def main(self, args, options):
        command = args[0]
        if command == 'version':
            print __version__
            exit(0)
        script_settings = ScriptSettings(options)
        app_context = ApplicationContext(script_settings)
        if script_settings.grab_envs == "true":
            app_context.environment_config_grabber().grab_jtalks_configs()
            # recreating them after configs were updated
            script_settings = ScriptSettings(options)
            app_context = ApplicationContext(script_settings)
        try:
            if command == 'deploy':
                LibVersion().log_lib_versions()
                app_context.deploy_command().deploy(
                    script_settings.project, script_settings.build,
                    script_settings.get_app_final_name(),
                    script_settings.get_plugins())
            elif command == "upload-to-nexus":
                LibVersion().log_lib_versions()
                app_context.old_nexus().upload_war('pom.xml')
            elif command == "list-envs":
                app_context.env_list().list_envs()
            elif command == 'load-db-from-backup':
                LibVersion().log_lib_versions()
                app_context.load_db_from_backup().load()
            else:
                error = 'Command was not recognized, you can use: deploy, list-envs, load-db-from-backup. ' \
                        'Also see jtalks -h'
                self.logger.error(error)
                raise RuntimeError(error)
        except:
            self.logger.error("Program finished with errors")
            if options.debug:
                print("Root cause: %s" % traceback.format_exc())
                sys.exit(1)