Module Testing
Local Debugging
You can start the base locally or remotely, then deploy the module locally or remotely using the client Arklet’s exposed HTTP interface, and set breakpoints in the module code for local or remote debugging.
The Arklet HTTP interface mainly provides the following capabilities:
- Deploying and uninstalling modules.
- Querying all deployed module information.
- Querying various system and business metrics.
Deploying Modules
curl -X POST -H "Content-Type: application/json" http://127.0.0.1:1238/installBiz
Request Body Example:
{
"bizName": "test",
"bizVersion": "1.0.0",
// local path should start with file://, alse support remote url which can be downloaded
"bizUrl": "file:///Users/jaimezhang/workspace/github/sofa-ark-dynamic-guides/dynamic-provider/target/dynamic-provider-1.0.0-ark-biz.jar"
}
Successful Deployment Response Example:
{
"code":"SUCCESS",
"data":{
"bizInfos":[
{
"bizName":"dynamic-provider",
"bizState":"ACTIVATED",
"bizVersion":"1.0.0",
"declaredMode":true,
"identity":"dynamic-provider:1.0.0",
"mainClass":"io.sofastack.dynamic.provider.ProviderApplication",
"priority":100,
"webContextPath":"provider"
}
],
"code":"SUCCESS",
"message":"Install Biz: dynamic-provider:1.0.0 success, cost: 1092 ms, started at: 16:07:47,769"
}
}
Failed Deployment Response Example:
{
"code":"FAILED",
"data":{
"code":"REPEAT_BIZ",
"message":"Biz: dynamic-provider:1.0.0 has been installed or registered."
}
}
Uninstalling Modules
curl -X POST -H "Content-Type: application/json" http://127.0.0.1:1238/uninstallBiz
Request Body Example:
{
"bizName":"dynamic-provider",
"bizVersion":"1.0.0"
}
Successful Uninstallation Response Example:
{
"code":"SUCCESS"
}
Failed Uninstallation Response Example:
{
"code":"FAILED",
"data":{
"code":"NOT_FOUND_BIZ",
"message":"Uninstall biz: test:1.0.0 not found."
}
}
Querying Modules
curl -X POST -H "Content-Type: application/json" http://127.0.0.1:1238/queryAllBiz
Request Body Example:
{}
Response Example:
{
"code":"SUCCESS",
"data":[
{
"bizName":"dynamic-provider",
"bizState":"ACTIVATED",
"bizVersion":"1.0.0",
"mainClass":"io.sofastack.dynamic.provider.ProviderApplication",
"webContextPath":"provider"
},
{
"bizName":"stock-mng",
"bizState":"ACTIVATED",
"bizVersion":"1.0.0",
"mainClass":"embed main",
"webContextPath":"/"
}
]
}
Getting Help
You can view the help for all external HTTP interfaces exposed by Arklet:
curl -X POST -H "Content-Type: application/json" http://127.0.0.1:1238/help
Request Body Example:
{}
Response Example:
{
"code":"SUCCESS",
"data":[
{
"desc":"query all ark biz(including master biz)",
"id":"queryAllBiz"
},
{
"desc":"list all supported commands",
"id":"help"
},
{
"desc":"uninstall one ark biz",
"id":"uninstallBiz"
},
{
"desc":"switch one ark biz",
"id":"switchBiz"
},
{
"desc":"install one ark biz",
"id":"installBiz"
}
]
}
How to Build Locally without Changing the Module Version Number
Add the following Maven profile, and build the module locally using the command mvn clean package -Plocal.
<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-maven-plugin</artifactId>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<bizVersion>${project.version}</bizVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Unit Testing
Modules support writing and executing unit tests using standard JUnit4 and TestNG.
Feedback
Was this page helpful?
Welcome propose feedback to community!
Welcome propose feedback to community, or improve this document directly.。