aerogear/aerogear-unified-push-server — pull request #71 by matzew (2013-08-09 10:01:24+00:00)
Title: Supporting the 'pushEndpoint' change for SimplePush server(s)

Done for [AGPUSH-262](https://issues.jboss.org/browse/AGPUSH-262).

Tested against the _official_ SimplePush network from Mozilla:

_Perhaps not a bad idea to reset the database and do the admin/default password reset..._

Steps for testing:

* Create (new) PushAPP
```
curl -v -b cookies.txt -c cookies.txt -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
```

* create SP variant
```
curl -v -b cookies.txt -c cookies.txt -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name" : "AeroGear-FFOS"}' http://localhost:8080/ag-push/rest/applications/{pushAppId}/simplePush
```

* run the JAVASCRIPT hacks in this gist:
https://gist.github.com/matzew/cbda360d72eaaef75971
( **not the CURL part of the gist** )

* create a installation for that JS hack....:
* for the ```deviceToken``` use the **RETURNED** ```channelID``` on the last ```console.log``` statement;
* for the ```simplePushEndpoint``` use the **RETURNED** ```pushEndpoint``` on the last ```console.log``` statement;

Fill that into a CURL.............

```
curl -u "variantID":"variantSecret" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"category" : "mail","alias": "matzew","deviceToken" : "LALALALA","simplePushEndpoint":"https://push.services.mozilla.com/update/LALALALALA"}' http://localhost:8080/ag-push/rest/registry/device
```

* Now perform a send:

```
curl -u "PushApplicationID":"MasterSecret" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"variants" : ["THE VARIANT ID OF THE CREATED SP VARIANT"], "simple-push": { "mail":"version=123"}}' http://localhost:8080/ag-push/rest/sender/selected
```

The send does the following:
* Trigger notification 'event' on the UnifiedPush server
* UnifiedPush server sends a ```HTTP PUT``` to the Mozilla TEST network
* Mozilla network will update our connected JS "client"....

**NOTE:** Do not merge before [AGPUSH-261](https://issues.jboss.org/browse/AGPUSH-261) has landed as well.