Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncs_mdes does not work on JRuby #5

Closed
rsutphin opened this issue Aug 25, 2011 · 6 comments
Closed

ncs_mdes does not work on JRuby #5

rsutphin opened this issue Aug 25, 2011 · 6 comments
Assignees
Labels

Comments

@rsutphin
Copy link
Contributor

Several specs fail under JRuby 1.6.4. All of them appear to be related to extracting namespaced attribute values, so I'm guessing it's an incompatibility with Nokogiri. Determine who's at fault and fix it.

/var/lib/hudson/runner-home/.rvm/rubies/jruby-1.6.4/bin/jruby -S bundle exec rspec spec/ncs_navigator/mdes_spec.rb spec/ncs_navigator/mdes/source_documents_spec.rb spec/ncs_navigator/mdes/transmission_table_spec.rb spec/ncs_navigator/mdes/variable_type_spec.rb spec/ncs_navigator/mdes/variable_spec.rb spec/ncs_navigator/mdes/specification_spec.rb spec/ncs_navigator/mdes/version_spec.rb
............................................F.......FFF.......................FFFF.FFFFF................................................................................................

Failures:

 1) NcsNavigator::Mdes::VariableType.from_xsd_simple_type#code_list when there are enumerated values has the description
    Failure/Error: subject.code_list.description.should == "Eq"
      expected: "Eq"
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_type_spec.rb:119:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 2) NcsNavigator::Mdes::VariableType::CodeListEntry.from_xsd_enumeration#label is set
    Failure/Error: missing.label.should == "Missing in Error"
      expected: "Missing in Error"
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_type_spec.rb:179:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 3) NcsNavigator::Mdes::VariableType::CodeListEntry.from_xsd_enumeration#global_value is set
    Failure/Error: missing.global_value.should == '99-4'
      expected: "99-4"
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_type_spec.rb:185:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 4) NcsNavigator::Mdes::VariableType::CodeListEntry.from_xsd_enumeration#master_cl is set
    Failure/Error: missing.master_cl.should == 'missing_data'
      expected: "missing_data"
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_type_spec.rb:191:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 5) NcsNavigator::Mdes::Variable.from_element#pii is false when blank
    Failure/Error: variable('<xs:element ncsdoc:pii=""/>').pii.should == false
      expected: false
           got: :unknown (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:140:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 6) NcsNavigator::Mdes::Variable.from_element#pii is true when "Y"
    Failure/Error: variable('<xs:element ncsdoc:pii="Y"/>').pii.should == true
      expected: true
           got: :unknown (using ==)
      Diff:
      @@ -1,2 +1,2 @@
      -true
      +:unknown
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:144:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 7) NcsNavigator::Mdes::Variable.from_element#pii is :possible when "P"
    Failure/Error: variable('<xs:element ncsdoc:pii="P"/>').pii.should == :possible
      expected: :possible
           got: :unknown (using ==)
      Diff:
      @@ -1,2 +1,2 @@
      -:possible
      +:unknown
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:148:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 8) NcsNavigator::Mdes::Variable.from_element#pii is the literal value when some other value
    Failure/Error: variable('<xs:element ncsdoc:pii="7"/>').pii.should == '7'
      expected: "7"
           got: :unknown (using ==)
      Diff:
      @@ -1,2 +1,2 @@
      -7
      +:unknown
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:152:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 9) NcsNavigator::Mdes::Variable.from_element#status is :active for 1
    Failure/Error: variable('<xs:element ncsdoc:status="1"/>').status.should == :active
      expected: :active
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:162:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 10) NcsNavigator::Mdes::Variable.from_element#status is :new for 2
    Failure/Error: variable('<xs:element ncsdoc:status="2"/>').status.should == :new
      expected: :new
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:166:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 11) NcsNavigator::Mdes::Variable.from_element#status is :modified for 3
    Failure/Error: variable('<xs:element ncsdoc:status="3"/>').status.should == :modified
      expected: :modified
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:170:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 12) NcsNavigator::Mdes::Variable.from_element#status is :retired for 4
    Failure/Error: variable('<xs:element ncsdoc:status="4"/>').status.should == :retired
      expected: :retired
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:174:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

 13) NcsNavigator::Mdes::Variable.from_element#status is the literal value for some other value
    Failure/Error: variable('<xs:element ncsdoc:status="P4"/>').status.should == 'P4'
      expected: "P4"
           got: nil (using ==)
    # org/jruby/RubyProc.java:274:in `call'
    # ./spec/ncs_navigator/mdes/variable_spec.rb:178:in `Mdes'
    # org/jruby/RubyKernel.java:2061:in `instance_eval'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'
    # org/jruby/RubyArray.java:2336:in `collect'

When it is working, enable JRuby in the CI build.

@rsutphin
Copy link
Contributor Author

rsutphin commented Apr 6, 2012

Tests continue to fail with JRuby 1.6.7 and Nokogiri 1.5.2.

@rsutphin
Copy link
Contributor Author

Same tests fail with JRuby 1.7.1 and Nokogiri 1.5.5.

@rsutphin
Copy link
Contributor Author

According to sparklemotion/nokogiri#712 the behavior that Nokogiri-Java is exhibiting here is the desired behavior while the behavior of Nokogiri-C < 1.5.5 that the library is uses is a bug. The bug is fixed in Nokogiri 1.5.6; making 1.5.6 the minimum requirement for this library and adapting to that change so that the tests pass will restore JRuby (and now C-Ruby) compatibility.

@rsutphin
Copy link
Contributor Author

making 1.5.6 the minimum requirement for this library and adapting to that change so that the tests pass will restore JRuby (and now C-Ruby) compatibility.

Correction: adapting to Nokogiri 1.5.6 fixes 12 out of the 13 JRuby failures. There is still one behavior difference. On JRuby the following test fails:

  1) NcsNavigator::Mdes::Variable.from_element#pii is false when blank
     Failure/Error: variable('<xs:element ncsdoc:pii=""/>').pii.should == false
       expected: false
            got: :unknown (using ==)
     # ./spec/ncs_navigator/mdes/variable_spec.rb:140:in `Mdes'
     # org/jruby/RubyBasicObject.java:1691:in `instance_eval'
     # org/jruby/RubyArray.java:2360:in `map'
     # org/jruby/RubyArray.java:2360:in `map'
     # org/jruby/RubyArray.java:2360:in `map'
     # org/jruby/RubyArray.java:2360:in `map'

rsutphin added a commit that referenced this issue Dec 20, 2012
This is a breaking change in Nokogiri 1.5.6 and so makes this library
only work with Nokogiri 1.5.6 and later.

This also fixes a bunch (but not all) of the spec failures under JRuby
discussed under #5.
@rsutphin
Copy link
Contributor Author

sparklemotion/nokogiri#818 covers the last of these behavior differences.

@ghost ghost assigned rsutphin May 6, 2013
@rsutphin
Copy link
Contributor Author

rsutphin commented May 6, 2013

This is fixed now, but there's still quite a performance gap between MRI and JRuby, at least for the spec suite. On my machine the spec suite runs in 113s on 1.9.3-p327 vs. 2103s on JRuby 1.7.3 (on Java HotSpot(TM) 64-Bit Server VM 1.6.0_29-b11-402-11E2068 [darwin-x86_64]) — it's more than 18x faster on MRI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant