Sha256: 7d7d56c81cd079f35cd7f8a698848330079a0633b235c49a05335535e464824b

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

describe Elasticity::JobFlow do

  before do
    describe_jobflows_xml = <<-JOBFLOWS
      <DescribeJobFlowsResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31">
        <DescribeJobFlowsResult>
          <JobFlows>
            <member>
              <ExecutionStatusDetail>
                <State>TERMINATED</State>
              </ExecutionStatusDetail>
              <JobFlowId>j-p</JobFlowId>
              <Name>Pig Job</Name>
            </member>
            <member>
              <ExecutionStatusDetail>
                <State>TERMINATED</State>
              </ExecutionStatusDetail>
              <JobFlowId>j-h</JobFlowId>
              <Name>Hive Job</Name>
            </member>
          </JobFlows>
        </DescribeJobFlowsResult>
      </DescribeJobFlowsResponse>
    JOBFLOWS
    @describe_jobflows_document = Nokogiri::XML(describe_jobflows_xml)
    @describe_jobflows_document.remove_namespaces!
    @members_nodeset = @describe_jobflows_document.xpath('/DescribeJobFlowsResponse/DescribeJobFlowsResult/JobFlows/member')
  end

  describe ".from_xml" do
    it "should return a JobFlow with the appropriate fields initialized" do
      jobflow = Elasticity::JobFlow.from_member_element(@members_nodeset[0])
      jobflow.name.should == "Pig Job"
      jobflow.jobflow_id.should == "j-p"
      jobflow.state.should == "TERMINATED"
    end
  end

  describe ".from_jobflows_nodeset" do
    it "should return JobFlows with the appropriate fields initialized" do
      jobflow = Elasticity::JobFlow.from_members_nodeset(@members_nodeset)
      jobflow.map(&:name).should == ["Pig Job", "Hive Job"]
      jobflow.map(&:jobflow_id).should == ["j-p", "j-h"]
      jobflow.map(&:state).should == ["TERMINATED", "TERMINATED"]
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
elasticity-0.6 spec/lib/elasticity/job_flow_spec.rb
elasticity-0.5 spec/lib/elasticity/job_flow_spec.rb
elasticity-0.4 spec/lib/elasticity/job_flow_spec.rb
elasticity-0.3.5 spec/lib/elasticity/job_flow_spec.rb
elasticity-0.3 spec/lib/elasticity/job_flow_spec.rb
elasticity-0.0.1 spec/lib/elasticity/job_flow_spec.rb