Server wants to push notification to client. How to provide an unified way of pushing notification? Aerogear Unified push. See spec for explanation.
You want to contribute to this effort? What about writing functional tests! Yes... It's fun it's with Spock.
Let's setup your environment for pushee (unified push server) + simplePush Note that this is a work in progress.
=> Install pushee and run it
git clone https://github.com/matzew/pushee.git
cd pushee
mvn package jboss-as:deploy
./bin/standalone.sh -b 0.0.0.0
=> Register app: send te curl described here
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name" : "MyApp", "description" : "awesome app" }' http://localhost:8080/ag-push/rest/applications
=> Register variant for app id: get id from previous response and send curl
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"pushNetworkURL" : "http://localhost:7777/endpoint/"}' http://localhost:8080/ag-push/rest/applications/{PUSH_ID}/simplePush
Keep you variant id, you will use it later! Note that all thoses ids (push app id + variant id) are stored in database. Even restarting your server you won't need to do thoses steps again.
=> Modify HTML page with variant id
vi pushee/src/main/webapp/websocket.html
Enter your variant id
<!-- Config for AeroGear.SimplePush -->
<script>
var AeroGearSimplePush = {
ariantID: "402881ef3ea36c3e013ea36c8de90001"
};
</script>
=> Rebuid and redeploy
cd pushee
mvn package jboss-as:deploy
=> Clone SimplePush
git clone https://github.com/danbev/aerogear-simplepush-server
=> SimplePush required vert.x to build
git clone https://github.com/vert-x/vert.x
cd vert.x
./gradlew install
If you run into the same problems I had here is my tip
- removing mavenCentral: https://gist.github.com/bobmcwhirter/4683052
- removing js mimify: https://github.com/eriwen/gradle-js-plugin
=> SimplePush required netty-component
git clone https://github.com/danbev/netty-subsystem.git
cd netty-subsystem
mvn install
=> Build SimplePush
cd aerogear-simplepush-server
mvn install
=> Launch SimplePush
mvn exec:java -Dexec.args="8888 false 10000 60000"
=> send msg using web interface
http://localhost:8080/ag-push/websocket.html
=> fork or clone Karels's repo
git clone https://github.com/kpiwko/pushee-integration-tests.git
Note You should install pushee-integration-tests as a sibling of pushee. Those two need each other.
=> follow requirements section on readme. https://github.com/kpiwko/pushee-integration-tests#requirements. To sum up you will need to clone and build those
git clone https://github.com/kpiwko/arquillian-testrunner-spock.git
cd arquillian-testrunner-spock
git checkout spock-0.7-update
mvn install
cd ..
git clone https://github.com/shrinkwrap/resolver.git
cd resolver
mvn install
I had to update pon.xml file of shrinkwrap and rolllbact to previous version
<version.org.jboss.shrinkwrap.resolver>2.0.0-cr-1-SNAPSHOT</version.org.jboss.shrinkwrap.resolver>
=> Once all pre-requisites are done, launch integration test(s)
cd pushee-integration-tests
mvn verify
as you can see there is only one test. Time to contribute!
We going to write in-container tests using arquillian + Spock.
- Referece doc https://code.google.com/p/spock/wiki/SpockBasics
- Great samples from Rob Fletcher https://github.com/robfletcher/vending-machine
If your favorite IDE is Intellij, add the property Configure test... in VM option add:
-DjbossHome=/Users/corinne/aerogear/pushee-test/pushee-integration-tests/target/jboss-as-7.1.1.Final
-DjbossHome=/Users/corinne/aerogear/unified-push/aerogear-unified-push-server/target/jboss-as-7.1.1.Final
in working directory set the path to your current module