def gen_undeploy_events(provider):
    server = get_eap_server(provider)
    runtime_name = gen_deploy_events(provider)
    check_deployment_appears(provider, server, runtime_name)
    undeploy(provider, server, runtime_name)
    check_deployment_not_listed(provider, server, runtime_name)
    return runtime_name
def gen_deploy_fail_events(provider):
    server = get_eap_server(provider)
    file_path = get_resource_path(RESOURCE_WAR_NAME)
    runtime_name = generate_runtime_name(file_path)
    deploy_archive(provider, server, file_path, runtime_name)
    check_deployment_appears(provider, server, runtime_name)
    with error.expected(
            'Deployment "{}" already exists on this server.'.format(
                runtime_name)):
        deploy_archive(provider, server, file_path, runtime_name)
    check_deployment_appears(provider, server, runtime_name)
    return runtime_name