Sha256: cddc62e04ea80c0273de30a292bdd5d819c7fc93a3770aa840025affefcb85ca

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

module JmeterPerf
  class DSL
    # DSL method synonymous with the JMeter Element KeystoreConfiguration
    # @see https://github.com/jlurena/jmeter_perf/wiki/1.-DSL-Documentation#keystoreconfiguration
    # @param [Hash] params Parameters for the KeystoreConfiguration element (default: `{}`).
    # @yield block to attach to the KeystoreConfiguration element
    # @return [JmeterPerf::KeystoreConfiguration], a subclass of JmeterPerf::DSL that can be chained with other DSL methods.
    def keystore_configuration(params = {}, &)
      node = JmeterPerf::KeystoreConfiguration.new(params)
      attach_node(node, &)
    end
  end

  class KeystoreConfiguration
    attr_accessor :doc
    include Helper

    def initialize(params = {})
      testname = params.is_a?(Array) ? "KeystoreConfiguration" : (params[:name] || "KeystoreConfiguration")
      @doc = Nokogiri::XML(<<~EOS.strip_heredoc)
        <KeystoreConfig guiclass="TestBeanGUI" testclass="KeystoreConfig" testname="#{testname}" enabled="true">
          <stringProp name="endIndex"/>
          <stringProp name="preload">True</stringProp>
          <stringProp name="startIndex"/>
          <stringProp name="clientCertAliasVarName"/>
        </KeystoreConfig>
      EOS
      update params
      update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmeter_perf-0.0.7 lib/jmeter_perf/dsl/keystore_configuration.rb