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

Getting the disabled property from the grails javamelody config instead ... #16

Merged
merged 1 commit into from Jan 18, 2014
Merged

Getting the disabled property from the grails javamelody config instead ... #16

merged 1 commit into from Jan 18, 2014

Conversation

stiancor
Copy link
Contributor

...of using the Parameters class from javamelody. The last option doesn't work when running test-app because there is no servletContext and therefore the Parameters.getParameter(...) returns null.

…ad of using the Parameters class from javamelody. The last option doesn't work when running test-app because there is no servletContext to get parameters from.
@evernat
Copy link
Member

evernat commented Jan 14, 2014

@sergiomichels @macrosak @yunpengbai
If you can, I would be interested of another read of this PR. I am just a bit more confident for this one.

@stiancor
Thanks for this PR. Note that I don't yet understand it myself.

@stiancor
Copy link
Contributor Author

Thanks for taking a look at this one @evernat. This is how I tested this one.

  1. Create a new grails app
  2. Add the newest version of the grails-melody-plugin (currently 1.4.9).
  3. Set a breakpoint in the GrailsMelodyGrailsPlugin.groovy class right after DISABLED has been fetched (line 127).
  4. Use "grails run-app" and verify that it is false
  5. Set "javamelody.disabled = true" in GrailsMelodyConfig and run "grails run-app" again. Verify that DISABLED is true.
  6. Now try running "grails test-app". This time however DISABLED is false. Hence "javamelody.disabled" is not used when running in test mode. The reason i found this one was because I got an exception in issue Verifying that property exists using hasProperty.  #17 and wanted to try to disable javamelody.
  7. However, with the fix I provided DISABLED is also set correctly when running "grails test-app"

As a side note I would like to add that I also tried the option below in GrailsMelodyConfig. However, this does not work. Not even with "grails run-app".

environments {
test {
javamelody.disabled = false
}
}

@evernat
Copy link
Member

evernat commented Jan 18, 2014

I will add " || Boolean.parseBoolean(Parameters.getParameter(Parameter.DISABLED)) ", because it does more than just reading a config file.
Done : 4325e6c

evernat added a commit that referenced this pull request Jan 18, 2014
Getting the disabled property from the grails javamelody config when running test-app
@evernat evernat merged commit 9317d59 into javamelody:master Jan 18, 2014
@stiancor stiancor deleted the disabled-param branch January 18, 2014 18:54
@stiancor
Copy link
Contributor Author

Great, thanks :-)

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

Successfully merging this pull request may close these issues.

None yet

2 participants