Skip to content

Installing AngusMockService

As a core component of the AngusTester testing system, AngusMockService provides a virtual testing environment:

  1. Enables simulation of various interface responses, status codes, and data, allowing rapid generation and mocking of dependent APIs to facilitate development and testing.
  2. Avoids dirty data issues caused by direct debugging with production systems by using mock services and interface data.

For more details about mock services, see: Mock Services.

1. Installation

After logging into the AngusTester application, navigate to the Mock menu and locate Create Mock Service to complete the setup, as shown below:

mock-service-add.png

Once the mock service is created, find it in the service list and start it. The system will automatically install the service on the mock node during the first startup.

mock-service-start.png

2. Verification

  1. If the mock service status shows as "Running," the service has successfully started.
  2. Alternatively, manually verify by copying the Service URL from the list and accessing it. If the health status returns UP, the service is running successfully.
    bash
    curl -i 'http://serv01-sample.angusmock.cloud:30010'  
    HTTP/1.1 200 OK  
    XC-Mock-ServiceId: 203883811233071109  
    XC-Mock-RequestId: 99063eb8-6c77-4fdf-b6d7-97af3a88eda2  
    Access-Control-Allow-Origin: *  
    Access-Control-Allow-Credentials: true  
    Access-Control-Allow-Methods: GET,POST,PUT,PATCH,DELETE,OPTIONS,HEAD  
    Content-Type: application/json  
    content-length: 1325  
      
    {  
      "app" : "AngusMockService",  
      "version" : "1.0.0",  
      "health" : {  
        "status" : {  
          "status" : "UP"  
        }  
      },  
      "uptime" : "434691",  
      "home" : "/opt/AngusAgent/",  
      "principal" : {  
        "angusmock.principal.deviceId" : "203883980884279296",  
        "angusmock.principal.mockServiceId" : "203883811233071109",  
        "angusmock.principal.tenantId" : "1"  
      },  
      "server" : {  
        "port" : 30020,  
        "ip" : "0.0.0.0"  
      },  
      "diskSpace" : {  
        "total" : "63278391296",  
        "used" : "4764565504"  
      },  
      "info" : {  
        "id" : "203883811233071109",  
        "name" : "Sample Service",  
        "nodeId" : "203883980884279296",  
        "serviceDomainUrl" : "http://sample.angusmock.cloud:30020",  
        "auth" : true,  
        "apisCors" : {  
          "allowCorsOrigin" : "*",  
          "allowCorsCredentials" : true,  
          "allowCorsRequestMethods" : "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD",  
          "enabled" : true  
        },  
        "setting" : {  
          "useSsl" : false,  
          "workThreadNum" : 256,  
          "enableNettyLog" : false,  
          "logFileLevel" : {  
            "value" : "NONE",  
            "message" : "None"  
          },  
          "sendRequestLog" : false,  
          "maxContentLength" : 1048576000,  
          "workPushbackThreadNum" : 8,  
          "maxPushbackConnectTimeout" : 5000,  
          "maxPushbackRequestTimeout" : -1  
        }  
      }  
    }

3. Configuring the Service

  1. Web Interface Configuration: Go to the mock menu in the AngusTester application, click the service name, and navigate to the Settings page to modify configurations as prompted.
  2. Manual Configuration File Edit: Locate the mockservice.properties file in the conf directory under the AngusAgent installation path and modify it. Refer to the Configuration Reference section below for parameter details.

4. Configuration Reference

properties
## Mock service bound IP address (default: 0.0.0.0)  
angusmock.serverIp=0.0.0.0  
## Mock service bound port (default: 30010)  
angusmock.serverPort=30010  
## Enable SSL for Netty HTTP server (default: false)  
angusmock.useSsl=false  
## Number of request processing threads (max: 10000, default: 256)  
angusmock.workThreadNum=256  
## Thread name prefix for mock service processing (default: AngusMock-Thread)  
angusmock.threadNamePrefix=AngusMock-Thread  
## Enable Netty logs (recommended for debugging only, default: false)  
angusmock.enableNettyLog=false  
## Log file request info level (options: NONE, BASIC, HEADERS, FULL)  
### - NONE: No logging  
### - BASIC: Logs request method, URL, response status, and execution time (default)  
### - HEADERS: Logs basic info + request/response headers  
### - FULL: Logs headers, body, and metadata of requests/responses  
angusmock.logFileLevel=NONE  
## Send mock request logs to server (default: true)  
angusmock.sendRequestLog=true  
## Max allowed request size (default: 1000MB)  
angusmock.maxContentLength=1048576000  
## Number of pushback request threads (default: 8)  
angusmock.pushbackThreadNum=8  
## Max pushback connection timeout (ms, default: 5000)  
angusmock.maxPushbackConnectTimeout=5000  
## Max pushback request timeout (ms, default: -1 for no timeout)  
angusmock.maxPushbackReadTimeout=-1  
## Enable CORS for mock service (default: false). Note: Server config overrides file config.  
angusmock.allowCors=false  
## Access-Control-Allow-Origin: Allowed CORS origins (default: *)  
angusmock.allowCorsOrigin=*  
## Access-Control-Allow-Credentials: Allow credentials for privileged operations (default: true)  
angusmock.allowCorsCredentials=true  
## Access-Control-Allow-Headers: Allowed HTTP headers (default: empty)  
angusmock.allowCorsRequestHeaders=*  
## Access-Control-Allow-Methods: Allowed HTTP methods (default: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD)  
angusmock.allowCorsRequestMethods=GET,POST,PUT,PATCH,DELETE,OPTIONS,HEAD  
## Access-Control-Expose-Headers: Non-default accessible response headers (default: empty)  
angusmock.allowCorsExposeHeaders=*  
#-----------------------------------------------------------------------------------  
# Angus Mock Service Management Config  
#-----------------------------------------------------------------------------------  
## Base path for mock service management endpoints (fixed: /actuator)  
# angusmock.management.endpointsBasePath=/actuator  
## Allow CORS for management endpoints (default: true)  
angusmock.management.endpointsAllowCors=true  
#-----------------------------------------------------------------------------------  
# Main Application (AngusTester) Access Config  
#-----------------------------------------------------------------------------------  
## AngusTester server URL for querying mock API info  
angusmock.angusTester.apisServerUrl=  
## Access token for main app API (required for private env manual startup, default: empty)  
angusmock.angusTester.accessToken=  
#-----------------------------------------------------------------------------------  
# Authentication Config  
#-----------------------------------------------------------------------------------  
## Tenant ID for mock service (required for private env manual startup, default: empty)  
angusmock.principal.tenantId=  
## Mock service ID (required for private env manual startup, default: empty)  
angusmock.principal.mockServiceId=  
## Device (node) ID for mock service (required for private env manual startup, default: empty)  
angusmock.principal.deviceId=  
#-----------------------------------------------------------------------------------  
# Pusher Config  
#-----------------------------------------------------------------------------------  
# JVM metrics push interval (default: 15 seconds)  
angusmock.jvmMetrics.pushIntervalInSecond=15

Note

AngusMockService authentication config must match AngusAgent settings.
Parameter Retrieval: Navigate to Configuration -> Nodes -> Installation Config and click the node to view parameters.

Released under the GPL-3.0 License.