Advertisement
Guest User

Untitled

a guest
Sep 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.87 KB | None | 0 0
  1. require 'nokogiri'
  2. filename = 'pom.xml'
  3. scenario_name = ENV['scenario_name']
  4. scenario_name2 = ENV['scenario_full_name']
  5. builder = Nokogiri::XML::Builder.new do
  6.   project('xmlns' => "http://maven.apache.org/POM/4.0.0",
  7.           'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
  8.           'xsi:schemaLocation' => "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd") do
  9.  
  10.     parent_ do
  11.       groupId 'us.cipherhealth.jmeter'
  12.       artifactId 'evolve-performance'
  13.       version '0.1.0-SNAPSHOT'
  14.       relativePath '../../pom.xml'
  15.     end
  16.     modelVersion '4.0.0'
  17.  
  18.     groupId 'us.cipherhealth.jmeter'
  19.     artifactId scenario_name
  20.     version '0.1.0-SNAPSHOT'
  21.     packaging 'jar'
  22.     name scenario_name2
  23.     description ''
  24.     build {
  25.       plugins {
  26.         plugin {
  27.           groupId 'com.lazerycode.jmeter'
  28.           artifactId 'jmeter-maven-plugin'
  29.           version '1.9.0'
  30.           configuration {
  31.             testResultsTimestamp 'false'
  32.             overrideRootLogLevel 'DEBUG'
  33.             suppressJMeterOutput 'false'
  34.             ignoreResultFailures 'true'
  35.             propertiesUser {
  36.               webservice.host '${performancetest.webservice.host}'
  37.               webservice.port '${performancetest.webservice.port}'
  38.               webservice.path '${performancetest.webservice.path}'
  39.               webservice.connectTimeout '${performancetest.connectTimeout}'
  40.               webservice.responseTimeout '${performancetest.responseTimeout}'
  41.               threadCount '${performancetest.threadCount}'
  42.               loopCount '${performancetest.threadCount}'
  43.             }
  44.             propertiesJMeter {
  45.               jmeter.save.saveservice.thread_counts 'true'
  46.             }
  47.             jmeterPlugins {
  48.               plugin {
  49.                 groupId 'kg.apc'
  50.                 artifactId 'jmeter-plugins'
  51.               }
  52.             }
  53.           }
  54.           executions {
  55.             execution {
  56.               id 'execute-jmeter-tests'
  57.               goals {
  58.                 goal 'jmeter'
  59.               }
  60.  
  61.               phase 'integration-test'
  62.             }
  63.           }
  64.           dependencies {
  65.             dependency {
  66.               groupId 'kg.apc'
  67.               artifactId 'jmeter-plugins'
  68.               version '1.0.0'
  69.               exclusions {
  70.                 exclusion {
  71.                   groupId 'kg.apc'
  72.                   artifactId 'perfmon'
  73.                 }
  74.                 exclusion {
  75.                   groupId 'org.apache.hadoop'
  76.                   artifactId 'hadoop-core'
  77.                 }
  78.                 exclusion {
  79.                   groupId 'org.apache.hbase'
  80.                   artifactId 'hbase'
  81.                 }
  82.                 exclusion {
  83.                   groupId 'org.apache.jmeter'
  84.                   artifactId 'jorphan'
  85.                 }
  86.                 exclusion {
  87.                   groupId 'org.apache.bsf'
  88.                   artifactId 'bsf-api'
  89.                 }
  90.                 exclusion {
  91.                   groupId 'org.bouncycastle'
  92.                   artifactId 'bcmail-jdk15'
  93.                 }
  94.                 exclusion {
  95.                   groupId 'org.bouncycastle'
  96.                   artifactId 'bcprov-jdk15'
  97.                 }
  98.                 exclusion {
  99.                   groupId 'javax.activation'
  100.                   artifactId 'activation'
  101.                 }
  102.                 exclusion {
  103.                   groupId 'commons-logging'
  104.                   artifactId 'commons-logging'
  105.                 }
  106.               }
  107.             }
  108.           }
  109.         }
  110.         plugin {
  111.           groupId 'com.lazerycode.jmeter'
  112.           artifactId 'jmeter-analysis-maven-plugin'
  113.           version '1.0.4'
  114.           configuration {
  115.             source "${project.build.directory}/jmeter/results/#{scenario_name}.jtl"
  116.           }
  117.           executions {
  118.             execution {
  119.               id 'create-html-report'
  120.               goals {
  121.                 goal 'analyze'
  122.               }
  123.               phase 'verify'
  124.  
  125.             }
  126.           }
  127.  
  128.         }
  129.         plugin {
  130.           groupId 'org.mortbay.jetty'
  131.           artifactId 'jetty-maven-plugin'
  132.           version '8.1.14.v20131031'
  133.           configuration {
  134.             connectors {
  135.               connector 'implementation' => "org.eclipse.jetty.server.nio.SelectChannelConnector"
  136.               port '${jetty.port}'
  137.             }
  138.             stopPort '${jetty.stopPort}'
  139.             stopKey 'STOP'
  140.           }
  141.         }
  142.         plugin {
  143.           groupId 'de.codecentric'
  144.           artifactId 'jmeter-graph-maven-plugin'
  145.           version '0.1.0'
  146.           executions {
  147.             execution {
  148.               id 'create-graph-threads'
  149.               goals {
  150.                 goal 'create-graph'
  151.               }
  152.               phase 'verify'
  153.             }
  154.           }
  155.           configuration {
  156.             inputFile "${project.build.directory}/jmeter/results/#{scenario_name}"
  157.             graphs {
  158.               graph {
  159.                 pluginType 'ThreadsStateOverTime'
  160.                 width '800'
  161.                 height '600'
  162.                 outputFile "${project.build.directory}/jmeter/results/#{scenario_name}-ThreadsStateOverTime.png"
  163.               }
  164.               graph {
  165.                 pluginType 'ResponseTimesOverTime'
  166.                 width '800'
  167.                 height '600'
  168.                 outputFile "${project.build.directory}/jmeter/results/#{scenario_name}-ResponseTimesOverTime.png"
  169.               }
  170.               graph {
  171.                 pluginType 'TransactionsPerSecond'
  172.                 width '800'
  173.                 height '600'
  174.                 outputFile "${project.build.directory}/jmeter/results/#{scenario_name}-TransactionsPerSecond.png"
  175.               }
  176.             }
  177.           }
  178.         }
  179.       }
  180.  
  181.     }
  182.  
  183.   end
  184. end
  185. #puts builder.to_xml
  186. File.write("scenarios/#{scenario_name}/#{filename}", builder.to_xml)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement