This is a fork of rad-source repository used to create the Temporal SDG dataset.
This project detects the REST endpoints and clients (API calls) using static source code analysis for JAVA Spring Boot projects. For multiple microservices, it also finds the rest communication between the microservices.
-
RadSourceService: Takes a list of paths of a single JAVA source file or, a directory as input. If input is a directory then it scans all java source files recursively and for each of them runs
RestCallService
andRestEndpointService
. -
RestCallService: Takes a single JAVA source file as input and detects all the rest calls along with their parent method, HTTP type, and return type.
-
RestEndpointService: Takes a single JAVA source file as input and detects all the rest endpoints along with their parent method, HTTP type, and return type.
-
RestFlowService: Takes a list of
RestCall
andRestEndpoint
as input and matches them to detect rest communication between microservices.
$ mvn clean install -DskipTests
$ java -jar application/target/rad-source-application-0.0.5.jar
You can either use a single java source file path or a directory path in pathToSource
.
$ curl --request POST \
--url http://localhost:8080/ \
--header 'content-type: application/json' \
--data '{
"pathToMsRoots": [PATH_HERE]
}'
{
"request": {
"pathToMsRoots": [
"C:\\seer-lab\\cil-tms\\tms-cms",
"C:\\seer-lab\\cil-tms\\tms-ems"
]
},
"restEntityContexts": [
{
"pathToMsRoot": "C:\\seer-lab\\cil-tms\\tms-cms",
"restCalls": [
{
"msRoot": "C:\\seer-lab\\cil-tms\\tms-cms",
"source": "C:\\seer-lab\\cil-tms\\tms-cms\\src\\main\\java\\edu\\baylor\\ecs\\cms\\service\\EmsService.java",
"httpMethod": "POST",
"parentMethod": "edu.baylor.ecs.cms.service.EmsService.createExam",
"returnType": "edu.baylor.ecs.cms.dto.ExamDto",
"collection": false
},
...
],
"restEndpoints": [
{
"msRoot": "C:\\seer-lab\\cil-tms\\tms-cms",
"source": "C:\\seer-lab\\cil-tms\\tms-cms\\src\\main\\java\\edu\\baylor\\ecs\\cms\\controller\\CategoryInfoController.java",
"httpMethod": "GET",
"parentMethod": "edu.baylor.ecs.cms.controller.CategoryInfoController.getCategoryInfo",
"arguments": "[]",
"returnType": "java.lang.Object",
"collection": true
},
...
]
},
...
],
"restFlows": [
{
"client": {
"msRoot": "C:\\seer-lab\\cil-tms\\tms-cms",
"source": "C:\\seer-lab\\cil-tms\\tms-cms\\src\\main\\java\\edu\\baylor\\ecs\\cms\\service\\EmsService.java",
"httpMethod": "GET",
"parentMethod": "edu.baylor.ecs.cms.service.EmsService.getQuestionsForExam",
"returnType": "edu.baylor.ecs.cms.model.Question",
"collection": true
},
"endpoint": {
"msRoot": "C:\\seer-lab\\cil-tms\\tms-ems",
"source": "C:\\seer-lab\\cil-tms\\tms-ems\\src\\main\\java\\edu\\baylor\\ecs\\ems\\controller\\ExamController.java",
"httpMethod": "GET",
"parentMethod": "edu.baylor.ecs.ems.controller.ExamController.listAllQuestionsForExam",
"arguments": "[@PathVariable Integer id]",
"returnType": "edu.baylor.ecs.ems.model.Question",
"collection": true
}
},
...
]
}