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

rspec with redstorm : uninitialized constant RedStorm::SimpleBolt::Values #17

Closed
stonegao opened this issue Feb 18, 2012 · 6 comments
Closed
Assignees
Milestone

Comments

@stonegao
Copy link
Contributor

This may related to the classpath issue. I have tried run CLASSPATH="./target/dependency/*" but still got the following error:

     NameError:
       uninitialized constant RedStorm::SimpleBolt::Values
@ghost ghost assigned colinsurprenant Feb 20, 2012
@colinsurprenant
Copy link
Owner

Stone,

are you trying to run the specs on redstorm project itself or specs of your own project using redstorm?

@stonegao
Copy link
Contributor Author

My own project using redstorm.

@stonegao
Copy link
Contributor Author

jruby -J-cp "target/dependency/*" -S rspec ./spec/ also not works. the same error. Maybe it's time to create a redstorm-starter project to demonstrate the usage of redstorm with specs.

@colinsurprenant
Copy link
Owner

redstorm-starter is a good idea.
For the specs, I believe this is because the Backtype (Java) classes are not defined when running the specs. You can probably mock theses classes in your test for now. I am not sure what is the best approach for this globally at this point. Maybe provide a set of mocks for specs? I am not sure, I will have to research a bit more about this to see if there are some "best practices" in JRuby in regards to specs with references to Java classes etc.

@colinsurprenant
Copy link
Owner

as an example, I am including the backtype.storm.tuple.Values class in the spec/red_storm/dsl/tuple_spec (in v0.6.6 branch and forward).

I am first requiring the jars in spec_helper.rb with

storm_jars = File.dirname(__FILE__) + '/../target/dependency/storm/default/*.jar'
Dir.glob(storm_jars).each{|f| require f}

this is equivalent to specifying the jars in the classpath.

then including the Values class

java_import 'backtype.storm.tuple.Values'

@colinsurprenant
Copy link
Owner

I have created a redstorm-starter https://github.com/colinsurprenant/redstorm-starter/ project which include example specs for bolts and complete topology.

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

No branches or pull requests

2 participants