Configuring Geb and Spock on Jenkins (Grails) - grails

I cannot use port 8080 for my testing. When I set the port to another open port (8090) Geb-Spock tests work fine, but only while running locally on IntelliJ. However, if I try and run a Jenkins build, I come out empty handed. I am pretty certain the problem has something to do with my GebConfig.groovy.
Note: I am using xvfb to aid the browser, and I am fairly certain it is configured correctly as it is producing results when configured to 8080.
Running on port 8090...
Running on port 8080...
Attempted Solutions:
Specify which port to use in Jenkins run configuration (which seems to get the server running just fine)
grails -Dgrails.server.port.http=8090 test-app functional: -echoOut --refresh-dependencies
There is also an option in the Jenkins grails build to set the port, which works just as well
peform a grails clean before running
Various configurations within GebConfig.groovy, including changing the baseUrl
The first example from Book of Geb
import org.openqa.selenium.firefox.FirefoxDriver
driver = { new FirefoxDriver() }
The geb-grails example - https://github.com/geb/geb-example-grails/blob/master/test/functional/GebConfig.groovy
No GebConfig at all
Other info:
Grails Version: 2.3.6
Java Version: 1.7.0_79 (open jdk)
OS: Fedora 20 (local), Ubuntu server 12 lts (Jenkins)
IntelliJ: 14.0
BuildConfig.groovy
dependencies{
test "org.gebish:geb-spock:0.10.0"
test "org.seleniumhq.selenium:selenium-support:2.45.0"
test "org.seleniumhq.selenium:selenium-firefox-driver:2.45.0"
}
plugins{
test ":geb:0.10.0"
}

Related

Running more than one Grails application on Amazon's EC2

Can I run more than one Grails application on a virtual Linux machine in Amazon's cloud? I start one application on port 8080 and the other on say port 8090? Basically, I am trying to run two versions of the same application, one that testers can use to test and the other on which I can continue development. I seem to be able to launch the second application but I cannot get to it with my browser. The way I am doing it now is launching the first application by grails run-war and the development version with grails run-app of course. I can get to my first application by doing www.hostname.com:8080 but the one on www.hostname.com:8090 is not available in the browser.

How to have grails run-app use https by default (without the -https command line option)

I would like to be able to run
grails run-app
and have it, by default, use ssl as if I ran
grails run-app -https
I would like this behavior for a couple reasons. The most important is that I want the Netbeans IDE grails integration to start up the https connection by default. But also, running on the command line, I won't have to remember or type the https since I always want that in my development environment.
The most important is that I want the Netbeans IDE grails integration to start up the https connection by default.
Surely this can be configured within the IDE?
also, running on the command line, I won't have to remember or type the https since I always want that in my development environment.
If you're using Linux or Mac, I would define an alias
alias run-app='grails run-app -https'
so you can get the behaviour you want simply by typing run-app on the command line. You could similarly achieve this on windows by creating a file run-app.bat whose contents are
grails run-app -https
and put this file in a directory that's on the PATH

How to solve cross domain errors when running two grails apps on localhost

I am trying to run-app my project with other wars/wars also running. So for example we have a war/ear that has legacy web services that I would like to access. My goal is to deploy those existing wars/ears with my run-app. I can deploy both separately, as grails run-app on port 8081 and jboss on port 8080. The problem was when I tried to do a ajax POST, DELETE, or PUT I get a cross-domain error because each app is on its own port. Is there a way to use run-app so that my grails project is at localhost:8080/grails and the webservices are at localhost:8080/webservices
Env: Grails 2.1.1
Server: Jboss (perfered) or vFabric tc Server (by dropping in existing war/war)
I don't believe that you can "run-app" both projects on the same port because you're running an embedded container. However, what you can do is check out the Grails CORS plugin which will allow other domains to access your grails app during run-app or otherwise.
http://grails.org/plugin/cors

Can't get highcharts export server working using Java

everyone,
I followed instructions on highcharts export server. And my test environment is Ubuntu Server, tomcat 7.x, java 1.7.x, the latest highcharts export server code cloned by git. No problem occurred during mvn install and mvn clean package. And soem settings of my app-convert.properties is
port=8080 # the same port with my tomcat
exec = /home/{my user name}/phantomjs-1.9.1-linux-x86_64/bin/phantomjs
And from the logs of Tomcat, I can see that phantomjs is started and listening on port 8080. Also when I access http://{myservername}:8080/highchars-export-web/, it's loaded correctly, even when I click 'Generate Image' button, it gave me a file named 'Charts.png'. However, the image's size is 1kb, not the one as getting from http://export.highcharts.com/demo. I don't know what I am missing. I need you guys help on this.
Best wishes,
Arthur
Pick a different port other than the one your tomcat (or other service) is listening on. That port you set in the app.properties files is for the phatomjs service to listen on.

how can i convert my grails application from http to https under Linux operating system?

how can i convert my grails application from http to https under Linux operating system
the configuration depends on what container you are running the application in your production environment. You should be deploying a war to your Production Server not doing a grails run-app -https
here is a stackoverflow question with a configuration for Tomcat.
I am certain you can google around and find proper configuration based on your application server
What do you mean by "convert"?
You can run the embedded tomcat with HTTPS enabled by adding -https to the run-app command:
grails run-app -https
If you want HTTPS enabled in production then you need to configure your app server to support it.

Resources