A Node-RED Twitter-follower-flow

In my last blog post I did an introduction to “how use the starter kit for Node-RED on IBM Cloud” and in this new blog post I want to highlight the Node-RED Twitter-follower-flow I developed as an introduction to different topics I frequently face at hackathons. Here is the link to the “Twitter-follower-flow” GitHub project. Node-RED is very good for prototyping, that is the reason why it is often used in hackathons. If you are new to Node-RED and you start  to develop a Node-RED flow, you normally have following challenges:

  • How to …
    1. … define own REST endpoints to encapsulate an external API?
    2. … automate the authentication to that external API?
    3. … extract data from the external API?
    4. … customize data and CRUD with databases?

The Node-RED flow of that project has the objective to provide an (little advanced) introduction to the first three topics above. The CRUD (Create, Read, Update, Delete) topic is not covered here. Visit that CRUD example for more information.

  • The “Twitter-follower-flow” example …
    • … uses open technologies (Node-RED is a Project of the OpenJS foundation )
    • … creates no additional costs
    • … has following technical level:
      • Beginner to intermediate
      • Needs a basic knowledge of JavaScript and REST
    • … takes 30 – 45 min to setup the example from scratch
      1. Register on IBM Cloud
      2. Create a Node-RED instance on IBM Cloud
      3. Register at Twitter for a developer API Account
      4. Copy the existing Node-RED flow
      5. Configure the flow
      6. Run the flow

The YouTube video below gives you a 13 min more detailed introduction to the Twitter-follower-flow.

Continue reading

A short introduction of the Node-RED Starter kit on IBM Cloud for Hackathons

In that blog post I want to highlight the new way of the instantiation of a Node-RED application on  IBM Cloud with the Node-RED Starter kit. From my perspective Node-RED is a very helpful tool at hackathons. (just take a look in my blog post  How to prepare for a Hackathon with IBM Cloud?)

The Node-RED instantiation has changed and with the Node-RED Starter kit we can take the advantage of the capabilities of IBM Cloud to control the build, deployment and execution of the Node-RED application and we setup automatically all  development tools to work effectively in a small development team in our hackathon.

I want to provide a short walkthrough from my perspective and created a 13 min YouTube video in addition to that blog post.

Continue reading

Write and execute a JUnit test for a Java microservice based on MicroProfile and run both in the OpenLiberty development mode

This blog post has the focus on: how to develop a JUnit test for the Authors microservice from the Cloud Native Starter example and run both the Authors microservice and the JUnit test on OpenLiberty in the development mode.

That blog post hasn’t the objective to be a blueprint or a ‘how to guide’ for writing JUnit tests,  JUnit test organization, test strategy and so on. The objective is to get technically started along one concrete microservice example from the Cloud Native Starter project. Here is the GitHub project with the source code for this blog post.

The Authors microservice has one RESTful api endpoint called getAuthor. The endpoint provides one parameter for the Author name. The endpoint returns Author data in a JSON format.

Keep the end in mind: The gif shows a sample JUnit test execution for the Author microservice using OpenLiberty in the Visual Studio Code editor:

junit-on-openliberty-run-test

Note: As an alternative or in addition, you can also visit the OpenLiberty tutorial “MicroProfile or Jakarta EE application” to start with that topic.

Let’s start with: What do we need and how do we realize the implementation?

We need to ..

    •  invoke the REST endpoint of the Authors microservice with a REST Client.
    •  transform the JSON response of the REST endpoint to an Author data class
    •  handle different values to invoke the REST Endpoint parameter for the Author name to run tests with variations of the Author name.
    • compare the actual response value with an expected value and document the result.

Continue reading