Mockintosh: Management UI

In this part we will talk about the management UI of Mockintosh. ​ Mockintosh comes with a easy to use remote management interface that's enabled if the management field and its port is specified in the configuration file. ​ The management UI consists of six tabs: ​

  • HTTP Endpoints
  • Asynchronous Actors
  • Traffic Log
  • Statistics
  • Configuration
  • Unhandled Requests

Swagger UI (OAS)

​ HTTP Endpoints tab shows you a Swagger UI that's automatically generated out of your config file. ​ The Swagger UI provides you a nice visualization of the endpoints that are described in the config file and enables you to easily send requests to those endpoints via the "Try it out" functionality. ​ You can access the Open API Specification through the management API by visiting localhost:8080/oas

Traffic Log

​ Traffic logging is disabled by default. So let's enable it and do a GET request to /users and another GET request to /users/id endpoints using the Swagger UI. ​ Then do a POST request to /companies endpoint by typing company name UP9, address Palo Alto, CA and a bunch of ones to phone field.

{
    "name": "UP9",
    "address": "Palo Alto, CA",
    "phone": 1111111111
}

As you can see that the all three HTTP requests that we have made just now, are logged with all of their details. ​

Statistics

Now let's open the "Statistics" tab. This tab gives you the information about how many requests are made into the services and individual endpoints, average response time and the status code distribution. ​ You can retrieve the statistics through requesting to localhost:8080/statsGET http://localhost:8080/stats

Configuration

"Configuration" tab let's you edit the content of the config file and all the resource files that are referenced from the config file. So let's select templates/user.json.j2 from the dropdown and add the createdAt field to this template using the date helper. ​ "createdAt": "{{ date.date('%Y-%m-%d %H:%M %f', -60) }}" ​ Now head over to the Swagger UI and make a request to /users/id endpoint. As you can see the newly added createdAt field is present in the response. ​

Unhandled Requests

"Unhandled Requests" tab shows you the config template for the requests that are made to Mockintosh but unrecognized according to the config file and responded with 400, 404 or 405. So let's request /employees and /partners paths from the "Service Two". ​ $ curl -X GET "http://service2.example.com:8082/employees?q=42" -v$ curl -X POST "http://service2.example.com:8082/partners" --data 'param1=hello&param2=world' -v ​ As you can see that we got a config template for the "Service Two" that contains the missing two endpoints. ​

Asynchronous Actors

The purpose of "Asynchronous Actors" tab, as a short explanation, is to check the consumed messages and triggering the asynchronous message producers. The tab is dedicated to asynchronous services. We will explain it in detail in a later video because it deserves to have its own video. ​​

Support

You can view these examples in action in this video, and learn more at Mockintosh and UP9. Join our community Slack at up9.slack.com.