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

adds a test-runner that sends notifications to all apps #10

Merged
merged 6 commits into from
Jan 27, 2017

Conversation

josemigallas
Copy link
Contributor

This PR resolves this ticket: https://issues.jboss.org/browse/AGPUSH-2003

Adds a test-runner, written in nodeJS, to the current test suite. This test runner gets all applications from one user and send 1 notification to all of them with the single alias "TEST_TOKEN" that is the one mock-data-loader creates for all fake devices.

This test runner uses both community libraries: https://github.com/bucharest-gold/unifiedpush-admin-client (for retrieving the apps) and https://github.com/aerogear/aerogear-unifiedpush-nodejs-client/ (for sending the notifications).

remove dependency

put business logic in src folder

sends a notification to each app, separated by 1000 ms

Refactor sender module

catches error in the app level

gets the list of applications

gets bearer token from UPS with existing client

updates .gitignore
@matzew
Copy link
Contributor

matzew commented Jan 27, 2017

Let's add a README file in the folder,
how to build/run this

* @returns {Promise} An empty promise if the notification was sent.
*/
static sendNotificationToApp(message, app, options) {
console.log(`Sending message to "${app.name}" {${app.id}}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the id to pushApplicationID


const settings = {
url: BASE_URL,
applicationId: app.id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be pushApplicationID too, instead of id

"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jose Miguel Gallas Olmedo",
"license": "MIT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apache license!

also, not sure about the author tag... author is always a topic... that's hot discussed in the community. SCM tools do show all the authors of the file.

Perhaps we do AeroGear team

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I wasn't sure so I left the default options.

@josemigallas
Copy link
Contributor Author

OK I also noticed that the DELAY constant was not being used, so fixed

@matzew matzew merged commit 523f24c into aerogear-attic:master Jan 27, 2017
@josemigallas josemigallas deleted the jgallaso-agpush-2003 branch January 28, 2017 12:38
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