From b73696a71b9ae484da9077de4969dc3f3fcf2f44 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Thu, 12 Sep 2024 10:09:35 -0500
Subject: [PATCH 01/16] Replace string formatters with unknown
---
.../ecs/lab/common/models/enums/RestCallTemplate.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
index df8ac6f2..f2611dca 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
@@ -134,6 +134,10 @@ private String backupParseURL(Expression exp) {
if (matcher.find()) {
// Extract the first instance of "/.*"
String extracted = matcher.group(1); // Group 1 corresponds to the part in parentheses (captured group)
+
+ // Replace string formatters if they are present
+ extracted.replaceAll("%[sdif]", UNKNOWN_VALUE);
+
return extracted;
}
From 80534f7f620587b6779812722f70315d8ed40ead Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 16 Sep 2024 08:38:05 -0500
Subject: [PATCH 02/16] Valid Config folder
---
.../fudan_trainticket_original.json | 1 -
valid_configs/online-shop-microservices.json | 5 +++++
2 files changed, 5 insertions(+), 1 deletion(-)
rename config_trainticket_original.json => valid_configs/fudan_trainticket_original.json (68%)
create mode 100644 valid_configs/online-shop-microservices.json
diff --git a/config_trainticket_original.json b/valid_configs/fudan_trainticket_original.json
similarity index 68%
rename from config_trainticket_original.json
rename to valid_configs/fudan_trainticket_original.json
index baaaf38f..2a7f4ed5 100644
--- a/config_trainticket_original.json
+++ b/valid_configs/fudan_trainticket_original.json
@@ -1,6 +1,5 @@
{
"systemName": "Train-ticket",
"repositoryURL": "https://github.com/FudanSELab/train-ticket.git",
- "baseCommit": "313886e99befb94be6cd45f085c98e0019f59829",
"baseBranch": "master"
}
\ No newline at end of file
diff --git a/valid_configs/online-shop-microservices.json b/valid_configs/online-shop-microservices.json
new file mode 100644
index 00000000..eac0420c
--- /dev/null
+++ b/valid_configs/online-shop-microservices.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "online-shop-microservices",
+ "repositoryURL": "https://github.com/uxov/online-shop-microservices-spring-cloud.git",
+ "baseBranch": "main"
+}
\ No newline at end of file
From ca591c9359af919a413f5f75db0e84eb468f0d39 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 16 Sep 2024 09:22:39 -0500
Subject: [PATCH 03/16] Additional test for extraction, additional cases
covered
---
.../common/models/enums/RestCallTemplate.java | 9 +++--
.../lab/common/utils/SourceToObjectUtils.java | 37 ++++++++++++++++++-
.../java/unit/extraction/ExtractionTest.java | 2 +-
src/test/resources/TestFile.java | 22 +++++++++++
4 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
index f2611dca..223db656 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
@@ -20,6 +20,7 @@
*/
@Getter
public class RestCallTemplate {
+ public static final Set REST_OBJECTS = Set.of("RestTemplate", "OAuth2RestOperations", "OAuth2RestTemplate");
public static final Set REST_METHODS = Set.of("getForObject", "postForObject", "patchForObject", "put", "delete", "exchange");
private static final String UNKNOWN_VALUE = "{?}";
@@ -122,7 +123,7 @@ private String parseURL(Expression exp) {
*/
private String backupParseURL(Expression exp) {
// Regular expression to match the first instance of "/.*"
- String regex = "\"(/.+?)\"";
+ String regex = "\".*(/.+?)\"";
// Compile the pattern
Pattern pattern = Pattern.compile(regex);
@@ -133,12 +134,12 @@ private String backupParseURL(Expression exp) {
// Find the first match
if (matcher.find()) {
// Extract the first instance of "/.*"
- String extracted = matcher.group(1); // Group 1 corresponds to the part in parentheses (captured group)
+ String extracted = matcher.group(0).replace("\"", ""); // Group 1 corresponds to the part in parentheses (captured group)
// Replace string formatters if they are present
- extracted.replaceAll("%[sdif]", UNKNOWN_VALUE);
+ extracted = extracted.replaceAll("%[sdif]", UNKNOWN_VALUE);
- return extracted;
+ return cleanURL(extracted);
}
return "";
diff --git a/src/main/java/edu/university/ecs/lab/common/utils/SourceToObjectUtils.java b/src/main/java/edu/university/ecs/lab/common/utils/SourceToObjectUtils.java
index 4942ee25..b879c9a2 100644
--- a/src/main/java/edu/university/ecs/lab/common/utils/SourceToObjectUtils.java
+++ b/src/main/java/edu/university/ecs/lab/common/utils/SourceToObjectUtils.java
@@ -24,7 +24,9 @@
import edu.university.ecs.lab.common.models.ir.*;
import edu.university.ecs.lab.common.services.LoggerManager;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
@@ -48,7 +50,10 @@ private static void generateStaticValues(File sourceFile, Config config1) {
try {
cu = StaticJavaParser.parse(sourceFile);
} catch (Exception e) {
- Error.reportAndExit(Error.JPARSE_FAILED, Optional.of(e));
+ LoggerManager.warn(() -> "Failed to parse " + sourceFile.getPath());
+ microserviceName = "";
+ return;
+// Error.reportAndExit(Error.JPARSE_FAILED, Optional.of(e));
}
if (!cu.findAll(PackageDeclaration.class).isEmpty()) {
packageName = cu.findAll(PackageDeclaration.class).get(0).getNameAsString();
@@ -222,7 +227,7 @@ public static Set parseMethodCalls(List methodDec
* @return returns methodCall if it is invalid, otherwise a new RestCall
*/
public static MethodCall convertValidRestCalls(MethodCallExpr methodCallExpr, MethodCall methodCall) {
- if ((!methodCall.getObjectType().equals("RestTemplate") && !methodCall.getObjectType().equals("OAuth2RestOperations")) || !RestCallTemplate.REST_METHODS.contains(methodCallExpr.getNameAsString())) {
+ if ((!RestCallTemplate.REST_OBJECTS.contains(methodCall.getObjectType()) || !RestCallTemplate.REST_METHODS.contains(methodCallExpr.getNameAsString()))) {
return methodCall;
}
@@ -530,4 +535,32 @@ private static JClass handleRepositoryRestResource(AnnotationExpr requestMapping
newRestCalls,
cu.findAll(ClassOrInterfaceDeclaration.class).get(0).getImplementedTypes().stream().map(NodeWithSimpleName::getNameAsString).collect(Collectors.toSet()));
}
+
+ private static JClass handleJS(String filePath) {
+ JClass jClass = new JClass(filePath, filePath, "", ClassRole.FEIGN_CLIENT, new HashSet<>(), new HashSet<>(), new HashSet<>(), new HashSet<>(), new HashSet<>());
+ try {
+ Set restCalls = new HashSet<>();
+ // Command to run Node.js script
+ ProcessBuilder processBuilder = new ProcessBuilder("node", "scripts/parser.js");
+ Process process = processBuilder.start();
+
+ // Capture the output
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ String[] split = line.split(";");
+ restCalls.add(new RestCall(split[0], split[1], split[2], split[3], split[4], split[5], split[6], split[7]));
+ System.out.println("Node.js Output: " + line);
+ }
+
+ // Wait for the Node.js process to complete
+ int exitCode = process.waitFor();
+ System.out.println("Node.js process exited with code: " + exitCode);
+ } catch (Exception e) {
+ System.err.println(e);
+ System.exit(1);
+ }
+
+ return jClass;
+ }
}
diff --git a/src/test/java/unit/extraction/ExtractionTest.java b/src/test/java/unit/extraction/ExtractionTest.java
index fe143e2b..a5518f46 100644
--- a/src/test/java/unit/extraction/ExtractionTest.java
+++ b/src/test/java/unit/extraction/ExtractionTest.java
@@ -16,7 +16,7 @@
public class ExtractionTest {
private static final String TEST_FILE = "src/test/resources/TestFile.java";
private static final String TEST_CONFIG_FILE = "src/test/resources/test_config.json";
- private static final int EXPECTED_CALLS = 5;
+ private static final int EXPECTED_CALLS = 6;
private static final String PRE_URL = "/api/v1/seatservice/test";
@Before
diff --git a/src/test/resources/TestFile.java b/src/test/resources/TestFile.java
index 95d741f2..4dd25486 100644
--- a/src/test/resources/TestFile.java
+++ b/src/test/resources/TestFile.java
@@ -152,5 +152,27 @@ public Ticket testMethod5(String date, String tripId, String startStationId, Str
return reTicket.getBody().getData();
}
+ public Ticket testMethod6(String date, String tripId, String startStationId, String endStataionId, int seatType, int tatalNum, List stations, HttpHeaders httpHeaders) {
+ Seat seatRequest = new Seat();
+ seatRequest.setTravelDate(date);
+ seatRequest.setTrainNumber(tripId);
+ seatRequest.setSeatType(seatType);
+ seatRequest.setStartStation(startStationId);
+ seatRequest.setDestStation(endStataionId);
+ seatRequest.setTotalNum(tatalNum);
+ seatRequest.setStations(stations);
+
+ HttpHeaders newHeaders = getAuthorizationHeadersFrom(httpHeaders);
+ HttpEntity requestEntityTicket = new HttpEntity(seatRequest, newHeaders);
+ String seat_service_url = getServiceUrl("ts-seat-service");
+ ResponseEntity> reTicket = restTemplate.exchange(
+ String.format("https://test-service/api/v1/seatservice/%s/test6", "val"),
+ HttpMethod.POST,
+ requestEntityTicket,
+ new ParameterizedTypeReference>() {
+ });
+ return reTicket.getBody().getData();
+ }
+
}
From 807eaceb1468537456613abfa4eb754e51c37f6b Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 16 Sep 2024 09:26:09 -0500
Subject: [PATCH 04/16] Fixed "//" double slash bug when baseUrl = / and
endpointURL starts with redundant /
---
.../ecs/lab/common/models/enums/EndpointTemplate.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java b/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
index 2a66aacd..22baedbd 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
@@ -66,7 +66,7 @@ public EndpointTemplate(AnnotationExpr requestMapping, AnnotationExpr endpointMa
this.httpMethod = finalHttpMethod;
this.name = endpointMapping.getNameAsString();
- this.url = preUrl.replace("\"", "") + simplifyEndpointURL(url.replace("\"", ""));
+ this.url = (preUrl.replace("\"", "") + simplifyEndpointURL(url.replace("\"", ""))).replace("//", "/");
}
From c2b9594b626eb0e0227c3a52f5c4b506b489da86 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 16 Sep 2024 18:10:27 -0500
Subject: [PATCH 05/16] valid configs folder filled
---
valid_configs/Springboot-Microservice.json | 5 +++++
valid_configs/duplicate_of_microservice_basics.json | 5 +++++
valid_configs/fudan_trainticket_original.json | 2 +-
valid_configs/java-microservice.json | 5 +++++
valid_configs/microservices-basics.json | 5 +++++
valid_configs/microservices-workshop.json | 5 +++++
valid_configs/spring-cloud-movie-recommendation.json | 5 +++++
7 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 valid_configs/Springboot-Microservice.json
create mode 100644 valid_configs/duplicate_of_microservice_basics.json
create mode 100644 valid_configs/java-microservice.json
create mode 100644 valid_configs/microservices-basics.json
create mode 100644 valid_configs/microservices-workshop.json
create mode 100644 valid_configs/spring-cloud-movie-recommendation.json
diff --git a/valid_configs/Springboot-Microservice.json b/valid_configs/Springboot-Microservice.json
new file mode 100644
index 00000000..69c8cf5b
--- /dev/null
+++ b/valid_configs/Springboot-Microservice.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "Springboot-Microservice",
+ "repositoryURL": "https://github.com/shabbirdwd53/Springboot-Microservice.git",
+ "baseBranch": "main"
+}
\ No newline at end of file
diff --git a/valid_configs/duplicate_of_microservice_basics.json b/valid_configs/duplicate_of_microservice_basics.json
new file mode 100644
index 00000000..5a65c0d5
--- /dev/null
+++ b/valid_configs/duplicate_of_microservice_basics.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "spring-boot-microservices",
+ "repositoryURL": "https://github.com/rohitghatol/spring-boot-microservices.git",
+ "baseBranch": "main"
+}
\ No newline at end of file
diff --git a/valid_configs/fudan_trainticket_original.json b/valid_configs/fudan_trainticket_original.json
index 2a7f4ed5..9c3ce942 100644
--- a/valid_configs/fudan_trainticket_original.json
+++ b/valid_configs/fudan_trainticket_original.json
@@ -1,5 +1,5 @@
{
- "systemName": "Train-ticket",
+ "systemName": "train-ticket",
"repositoryURL": "https://github.com/FudanSELab/train-ticket.git",
"baseBranch": "master"
}
\ No newline at end of file
diff --git a/valid_configs/java-microservice.json b/valid_configs/java-microservice.json
new file mode 100644
index 00000000..8899b3b3
--- /dev/null
+++ b/valid_configs/java-microservice.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "java-microservice",
+ "repositoryURL": "https://github.com/apssouza22/java-microservice.git",
+ "baseBranch": "master"
+}
\ No newline at end of file
diff --git a/valid_configs/microservices-basics.json b/valid_configs/microservices-basics.json
new file mode 100644
index 00000000..d0de6414
--- /dev/null
+++ b/valid_configs/microservices-basics.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "microservices-basics",
+ "repositoryURL": "https://github.com/anilallewar/microservices-basics-spring-boot.git",
+ "baseBranch": "master"
+}
\ No newline at end of file
diff --git a/valid_configs/microservices-workshop.json b/valid_configs/microservices-workshop.json
new file mode 100644
index 00000000..a8e45da3
--- /dev/null
+++ b/valid_configs/microservices-workshop.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "microservices-workshop",
+ "repositoryURL": "https://github.com/koushikkothagal/spring-boot-microservices-workshop.git",
+ "baseBranch": "main"
+}
\ No newline at end of file
diff --git a/valid_configs/spring-cloud-movie-recommendation.json b/valid_configs/spring-cloud-movie-recommendation.json
new file mode 100644
index 00000000..6630c98d
--- /dev/null
+++ b/valid_configs/spring-cloud-movie-recommendation.json
@@ -0,0 +1,5 @@
+{
+ "systemName": "spring-cloud-movie-recommendation",
+ "repositoryURL": "https://github.com/mdeket/spring-cloud-movie-recommendation.git",
+ "baseBranch": "master"
+}
\ No newline at end of file
From 68783dcd024e06d3d1f1b84dba841378457e25cf Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 16 Sep 2024 18:10:48 -0500
Subject: [PATCH 06/16] Additional endpoint cases resolved
---
.../common/models/enums/EndpointTemplate.java | 31 ++++++++++++++++---
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java b/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
index 22baedbd..fd1ef38e 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/enums/EndpointTemplate.java
@@ -36,11 +36,11 @@ public EndpointTemplate(AnnotationExpr requestMapping, AnnotationExpr endpointMa
NormalAnnotationExpr nae = (NormalAnnotationExpr) requestMapping;
for (MemberValuePair pair : nae.getPairs()) {
if (pair.getNameAsString().equals("value")) {
- preUrl = pair.getValue().toString();
+ preUrl = pair.getValue().toString().replaceAll("\"", "");
}
}
} else if (requestMapping instanceof SingleMemberAnnotationExpr) {
- preUrl = requestMapping.asSingleMemberAnnotationExpr().getMemberValue().toString();
+ preUrl = requestMapping.asSingleMemberAnnotationExpr().getMemberValue().toString().replaceAll("\"", "");
}
}
@@ -52,21 +52,42 @@ public EndpointTemplate(AnnotationExpr requestMapping, AnnotationExpr endpointMa
String methodValue = pair.getValue().toString();
finalHttpMethod = httpFromMapping(methodValue);
} else if(pair.getNameAsString().equals("path") || pair.getNameAsString().equals("value")) {
- url = pair.getValue().toString();
+ url = pair.getValue().toString().replaceAll("\"", "");
}
}
} else if (endpointMapping instanceof SingleMemberAnnotationExpr) {
- url = endpointMapping.asSingleMemberAnnotationExpr().getMemberValue().toString();
+ url = endpointMapping.asSingleMemberAnnotationExpr().getMemberValue().toString().replaceAll("\"", "");
}
if(finalHttpMethod == HttpMethod.ALL) {
finalHttpMethod = httpFromMapping(endpointMapping.getNameAsString());
}
+ String finalURL = "";
+ // Ensure preUrl starts with a slash if it exists
+ if((!preUrl.isEmpty() && !preUrl.startsWith("/"))) {
+ preUrl = "/" + preUrl;
+ // Ensure Url starts with a slash if it exists
+ } else if ((!url.isEmpty() && !url.startsWith("/"))) {
+ url = "/" + url;
+ }
+
+
+ if(preUrl.isEmpty() && url.isEmpty()) {
+ finalURL = "/";
+ } else {
+ finalURL = preUrl + url;
+ }
+
+ // Replace any double slashes
+ finalURL = finalURL.replaceAll("//", "/");
+ // If it ends with a slash remove it
+ finalURL = finalURL.endsWith("/") ? finalURL.substring(0, finalURL.length() - 1) : finalURL;
+
this.httpMethod = finalHttpMethod;
this.name = endpointMapping.getNameAsString();
- this.url = (preUrl.replace("\"", "") + simplifyEndpointURL(url.replace("\"", ""))).replace("//", "/");
+ this.url = finalURL;
}
From e641cbd4976e142d43c25ac6a6293956d08d65ba Mon Sep 17 00:00:00 2001
From: Samantha Perry
Date: Tue, 17 Sep 2024 13:00:29 -0700
Subject: [PATCH 07/16] added new valid projects
---
valid_configs/config_cwa-server.json | 6 ++++++
valid_configs/config_pacbot.json | 6 ++++++
valid_configs/config_sample-spring-microservice-new.json | 6 ++++++
valid_configs/config_spring-microservices.json | 6 ++++++
4 files changed, 24 insertions(+)
create mode 100644 valid_configs/config_cwa-server.json
create mode 100644 valid_configs/config_pacbot.json
create mode 100644 valid_configs/config_sample-spring-microservice-new.json
create mode 100644 valid_configs/config_spring-microservices.json
diff --git a/valid_configs/config_cwa-server.json b/valid_configs/config_cwa-server.json
new file mode 100644
index 00000000..680ef473
--- /dev/null
+++ b/valid_configs/config_cwa-server.json
@@ -0,0 +1,6 @@
+{
+ "systemName": "cwa-server",
+ "repositoryURL": "https://github.com/corona-warn-app/cwa-server.git",
+ "baseCommit": "c61d55f6f83b6d005cb6aca9e9b455afac572d72",
+ "baseBranch": "main"
+ }
\ No newline at end of file
diff --git a/valid_configs/config_pacbot.json b/valid_configs/config_pacbot.json
new file mode 100644
index 00000000..b02df692
--- /dev/null
+++ b/valid_configs/config_pacbot.json
@@ -0,0 +1,6 @@
+{
+ "systemName": "pacbot",
+ "repositoryURL": "https://github.com/tmobile/pacbot.git",
+ "baseCommit": "997c240c123d81cf3f55ff5093127c5fda6119c3",
+ "baseBranch": "master"
+ }
\ No newline at end of file
diff --git a/valid_configs/config_sample-spring-microservice-new.json b/valid_configs/config_sample-spring-microservice-new.json
new file mode 100644
index 00000000..f4efa5d8
--- /dev/null
+++ b/valid_configs/config_sample-spring-microservice-new.json
@@ -0,0 +1,6 @@
+{
+ "systemName": "sample-spring-microservices-new",
+ "repositoryURL": "https://github.com/piomin/sample-spring-microservices-new.git",
+ "baseCommit": "922ac448a5b404d16190a9740984251626b2d70e",
+ "baseBranch": "master"
+ }
\ No newline at end of file
diff --git a/valid_configs/config_spring-microservices.json b/valid_configs/config_spring-microservices.json
new file mode 100644
index 00000000..7c4bde3e
--- /dev/null
+++ b/valid_configs/config_spring-microservices.json
@@ -0,0 +1,6 @@
+{
+ "systemName": "spring-microservices",
+ "repositoryURL": "https://github.com/AthirsonSilva/spring-microservices.git",
+ "baseCommit": "1cd3c41da2f64762aad5c7de91b09176649c6cf5",
+ "baseBranch": "master"
+ }
\ No newline at end of file
From b177df39a3047946eecf23603e37b707b3a5265f Mon Sep 17 00:00:00 2001
From: Samantha Perry
Date: Tue, 17 Sep 2024 14:25:58 -0700
Subject: [PATCH 08/16] Changed AllConfigs and ExcelOutput to run valid configs
---
.../ecs/lab/AllConfigsExcelRunner.java | 6 ++--
.../ecs/lab/detection/ExcelOutputRunner.java | 36 ++-----------------
2 files changed, 5 insertions(+), 37 deletions(-)
diff --git a/src/main/java/edu/university/ecs/lab/AllConfigsExcelRunner.java b/src/main/java/edu/university/ecs/lab/AllConfigsExcelRunner.java
index 4b104791..21ba64f4 100644
--- a/src/main/java/edu/university/ecs/lab/AllConfigsExcelRunner.java
+++ b/src/main/java/edu/university/ecs/lab/AllConfigsExcelRunner.java
@@ -7,15 +7,15 @@
public class AllConfigsExcelRunner {
public static void main(String[] args) throws IOException {
- File configDir = new File("./configs");
+ File configDir = new File("./valid_configs");
if (!configDir.exists() || !configDir.isDirectory()) {
- System.out.println("Config directory './configs' does not exist or is not a directory.");
+ System.out.println("Config directory './valid_configs' does not exist or is not a directory.");
return;
}
File[] configFiles = configDir.listFiles((dir, name) -> name.endsWith(".json"));
if (configFiles == null || configFiles.length == 0) {
- System.out.println("No configuration files found in './configs' directory.");
+ System.out.println("No configuration files found in './valid_configs' directory.");
return;
}
diff --git a/src/main/java/edu/university/ecs/lab/detection/ExcelOutputRunner.java b/src/main/java/edu/university/ecs/lab/detection/ExcelOutputRunner.java
index b102d672..f0910f0c 100644
--- a/src/main/java/edu/university/ecs/lab/detection/ExcelOutputRunner.java
+++ b/src/main/java/edu/university/ecs/lab/detection/ExcelOutputRunner.java
@@ -1,44 +1,12 @@
package edu.university.ecs.lab.detection;
-
-import com.google.gson.JsonArray;
-import edu.university.ecs.lab.common.config.Config;
-import edu.university.ecs.lab.common.config.ConfigUtil;
-import edu.university.ecs.lab.common.models.ir.MicroserviceSystem;
-import edu.university.ecs.lab.common.models.sdg.MethodDependencyGraph;
-import edu.university.ecs.lab.common.models.sdg.ServiceDependencyGraph;
-import edu.university.ecs.lab.common.services.GitService;
-import edu.university.ecs.lab.common.utils.FileUtils;
-import edu.university.ecs.lab.common.utils.JsonReadWriteUtils;
-import edu.university.ecs.lab.delta.models.SystemChange;
-import edu.university.ecs.lab.delta.services.DeltaExtractionService;
-import edu.university.ecs.lab.detection.antipatterns.services.*;
-import edu.university.ecs.lab.detection.architecture.models.*;
-import edu.university.ecs.lab.detection.architecture.services.ARDetectionService;
-import edu.university.ecs.lab.detection.metrics.RunCohesionMetrics;
-import edu.university.ecs.lab.detection.metrics.models.ConnectedComponentsModularity;
-import edu.university.ecs.lab.detection.metrics.models.DegreeCoupling;
-import edu.university.ecs.lab.detection.metrics.models.StructuralCoupling;
-import edu.university.ecs.lab.detection.metrics.services.MetricResultCalculation;
-import edu.university.ecs.lab.intermediate.create.services.IRExtractionService;
-import edu.university.ecs.lab.intermediate.merge.services.MergeService;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.eclipse.jgit.revwalk.RevCommit;
-
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.*;
public class ExcelOutputRunner {
public static void main(String[] args) throws IOException {
- DetectionService detectionService = new DetectionService("./config.json");
+ String configPath = args[0];
+ DetectionService detectionService = new DetectionService(configPath);
detectionService.runDetection();
}
From f9f9d973a7a0a691517f63075816ff936be10bd2 Mon Sep 17 00:00:00 2001
From: Samantha Perry
Date: Wed, 18 Sep 2024 21:46:40 -0700
Subject: [PATCH 09/16] Added feature to save all IRs and Deltas
---
.../services/DeltaExtractionService.java | 4 +-
.../ecs/lab/detection/DetectionService.java | 42 ++++++++++---------
.../ecs/lab/detection/ExcelOutputRunner.java | 2 +-
.../lab/intermediate/merge/IRMergeRunner.java | 2 +-
.../merge/services/MergeService.java | 8 ++--
.../java/integration/IRComparisonTest.java | 2 +-
6 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/src/main/java/edu/university/ecs/lab/delta/services/DeltaExtractionService.java b/src/main/java/edu/university/ecs/lab/delta/services/DeltaExtractionService.java
index 05b2b6f2..17210f94 100644
--- a/src/main/java/edu/university/ecs/lab/delta/services/DeltaExtractionService.java
+++ b/src/main/java/edu/university/ecs/lab/delta/services/DeltaExtractionService.java
@@ -185,8 +185,10 @@ public void processDelta(List diffEntries) {
systemChange.getChanges().add(new Delta(oldPath, newPath, changeType, data));
}
+ String filePath = "./output/Delta_" + commitOld.substring(0, 4) + "_" + commitNew.substring(0, 4) + ".json";
+
// Output the system changes
- JsonReadWriteUtils.writeToJSON("./output/Delta.json", systemChange);
+ JsonReadWriteUtils.writeToJSON(filePath, systemChange);
// Report
LoggerManager.info(() -> "Delta changes extracted between " + commitOld + " -> " + commitNew);
diff --git a/src/main/java/edu/university/ecs/lab/detection/DetectionService.java b/src/main/java/edu/university/ecs/lab/detection/DetectionService.java
index e53e42e3..c1aa0071 100644
--- a/src/main/java/edu/university/ecs/lab/detection/DetectionService.java
+++ b/src/main/java/edu/university/ecs/lab/detection/DetectionService.java
@@ -46,9 +46,9 @@ public class DetectionService {
private static final int METRICS = 24;
private static final int ARCHRULES = 4;
- private static final String OLD_IR_PATH = "./output/OldIR.json";
- private static final String DELTA_PATH = "./output/Delta.json";
- private static final String NEW_IR_PATH = "./output/NewIR.json";
+ // private static final String OLD_IR_PATH = "./output/OldIR_";
+ private static final String DELTA_PATH = "./output/Delta_";
+ // private static final String NEW_IR_PATH = "./output/NewIR_";
private final String configPath;
private final Config config;
@@ -80,7 +80,8 @@ public void runDetection() {
// Generate the initial IR
irExtractionService = new IRExtractionService(configPath, Optional.of(commits.get(0).toString().split(" ")[1]));
- irExtractionService.generateIR("OldIR.json");
+ String firstCommit = commits.get(0).getName().substring(0, 4);
+ irExtractionService.generateIR("IR_" + firstCommit + ".json");
// Setup sheet and headers
sheet = workbook.createSheet(config.getSystemName());
@@ -112,22 +113,25 @@ public void runDetection() {
commitIdCell.setCellValue(commitIdOld.substring(0, 7));
// Read in the old system
- MicroserviceSystem oldSystem = JsonReadWriteUtils.readFromJSON(OLD_IR_PATH, MicroserviceSystem.class);
+ String oldSysPath = "./output/IR_" + commitIdOld.substring(0, 4) +".json";
+ MicroserviceSystem oldSystem = JsonReadWriteUtils.readFromJSON(oldSysPath, MicroserviceSystem.class);
// Extract changes from one commit to the other
if(i < commits.size() - 1) {
String commitIdNew = commits.get(i + 1).toString().split(" ")[1];
+ String newSysPath = "./output/IR_" + commitIdNew.substring(0, 4) +".json";
+ String deltaPath = DELTA_PATH + commitIdOld.substring(0, 4) + "_" + commitIdNew.substring(0, 4) + ".json";
- deltaExtractionService = new DeltaExtractionService(configPath, OLD_IR_PATH, commitIdOld, commitIdNew);
+ deltaExtractionService = new DeltaExtractionService(configPath, oldSysPath, commitIdOld, commitIdNew);
deltaExtractionService.generateDelta();
// Merge Delta changes to old IR to create new IR representing new commit changes
- MergeService mergeService = new MergeService(OLD_IR_PATH, DELTA_PATH, configPath);
- mergeService.generateMergeIR();
+ MergeService mergeService = new MergeService(oldSysPath, deltaPath, configPath);
+ mergeService.generateMergeIR(commitIdNew.substring(0, 4));
// Read in the new system and system change
- newSystem = JsonReadWriteUtils.readFromJSON(NEW_IR_PATH, MicroserviceSystem.class);
- systemChange = JsonReadWriteUtils.readFromJSON(DELTA_PATH, SystemChange.class);
+ newSystem = JsonReadWriteUtils.readFromJSON(newSysPath, MicroserviceSystem.class);
+ systemChange = JsonReadWriteUtils.readFromJSON(deltaPath, SystemChange.class);
}
// Init all the lists/maps
@@ -138,7 +142,7 @@ public void runDetection() {
// We can detect/update if there are >= 1 microservices
if (Objects.nonNull(oldSystem.getMicroservices()) && !oldSystem.getMicroservices().isEmpty()) {
detectAntipatterns(oldSystem, antipatterns);
- detectMetrics(oldSystem, metrics);
+ detectMetrics(oldSystem, metrics, commitIdOld.substring(0, 4));
updateAntiPatterns(currIndex, antipatterns);
updateMetrics(currIndex, metrics);
@@ -155,12 +159,12 @@ public void runDetection() {
}
// After completing this iteration, we can replace oldIR with newIR
- try {
- Files.move(Paths.get(NEW_IR_PATH), Paths.get(OLD_IR_PATH), StandardCopyOption.REPLACE_EXISTING);
- } catch (IOException e) {
- e.printStackTrace();
- System.exit(1);
- }
+ // try {
+ // Files.move(Paths.get(NEW_IR_PATH), Paths.get(OLD_IR_PATH), StandardCopyOption.REPLACE_EXISTING);
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // System.exit(1);
+ // }
}
// At the end we write the workbook to file
@@ -223,7 +227,7 @@ private void detectAntipatterns(MicroserviceSystem microserviceSystem, Map metrics) {
+ private void detectMetrics(MicroserviceSystem microserviceSystem, Map metrics, String commitID) {
ServiceDependencyGraph sdg = new ServiceDependencyGraph(microserviceSystem);
DegreeCoupling dc = new DegreeCoupling(sdg);
@@ -245,7 +249,7 @@ private void detectMetrics(MicroserviceSystem microserviceSystem, Map "No changes found at " + systemChange.getOldCommit() + " -> " + systemChange.getNewCommit());
- JsonReadWriteUtils.writeToJSON("./output/NewIR.json", microserviceSystem);
+ String filePath = "./output/IR_" + newCommitID + ".json";
+ JsonReadWriteUtils.writeToJSON(filePath, microserviceSystem);
return;
}
@@ -69,7 +70,8 @@ public void generateMergeIR() {
microserviceSystem.setCommitID(systemChange.getNewCommit());
LoggerManager.info(() -> "Merged to new IR at " + systemChange.getNewCommit());
- JsonReadWriteUtils.writeToJSON("./output/NewIR.json", microserviceSystem);
+ String filePath = "./output/IR_" + newCommitID + ".json";
+ JsonReadWriteUtils.writeToJSON(filePath, microserviceSystem);
}
diff --git a/src/test/java/integration/IRComparisonTest.java b/src/test/java/integration/IRComparisonTest.java
index 8f4d213d..c5d41cf3 100644
--- a/src/test/java/integration/IRComparisonTest.java
+++ b/src/test/java/integration/IRComparisonTest.java
@@ -53,7 +53,7 @@ void testComparison() {
// Merge Delta changes to old IR to create new IR representing new commit changes
MergeService mergeService = new MergeService(OLD_IR_PATH, DELTA_PATH, TEST_CONFIG_PATH);
- mergeService.generateMergeIR();
+ mergeService.generateMergeIR(commitIdNew);
if(i < list.size() - 2) {
try {
From 0ac72baec1659f8fb7f9faf0e42d4368cd569248 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 11:51:36 -0500
Subject: [PATCH 10/16] Website test
---
.github/workflows/FetchChanges.yml | 28 ---------------
.github/workflows/deploy-cimet.yml | 57 ------------------------------
.github/workflows/pages.yml | 33 +++++++++++++++++
.github/workflows/test.yml | 3 --
docs/index.html | 1 +
5 files changed, 34 insertions(+), 88 deletions(-)
delete mode 100644 .github/workflows/FetchChanges.yml
delete mode 100644 .github/workflows/deploy-cimet.yml
create mode 100644 .github/workflows/pages.yml
create mode 100644 docs/index.html
diff --git a/.github/workflows/FetchChanges.yml b/.github/workflows/FetchChanges.yml
deleted file mode 100644
index 20195292..00000000
--- a/.github/workflows/FetchChanges.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-#name: Fetch Changes
-#
-#on: push
-#
-#jobs:
-# identify-changed-files:
-# runs-on: ubuntu-latest
-#
-# steps:
-# - name: Checkout code
-# uses: actions/checkout@v3
-# with:
-# fetch-depth: 2
-#
-# - name: Get line-by-line diff
-# id: get_diff
-# uses: ILikePlayingGames/line-diff-action@v1.3
-# with:
-# commit-hash: '@~'
-#
-# - name: Save diff.txt as artifact
-# uses: actions/upload-artifact@v2
-# with:
-# name: changed-files-diff
-# path: ./diff.txt
-#
-# - name: Display diff content
-# run: cat ./diff.txt
diff --git a/.github/workflows/deploy-cimet.yml b/.github/workflows/deploy-cimet.yml
deleted file mode 100644
index ce245c77..00000000
--- a/.github/workflows/deploy-cimet.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-#name: CIMET (Change Impact Microservice Evolution Tool)
-#
-#on:
-# pull_request:
-# types:
-# - opened
-# branches:
-# - 'master' # <-- Change Base Pull Request Branch Here
-#
-#jobs:
-# build-and-extract:
-# runs-on: ubuntu-latest
-#
-# steps:
-# - uses: actions/checkout@v3
-# - name: Set up JDK 17
-# uses: actions/setup-java@v3
-# with:
-# java-version: '17'
-# distribution: 'temurin'
-# cache: maven
-#
-# - name: Extract Source Branch Name
-# shell: bash
-# run: echo "SOURCE_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV"
-# id: extract_source_branch
-#
-# - name: Extract Base Branch Name
-# shell: bash
-# run: echo "BASE_BRANCH=${GITHUB_BASE_REF}" >> "$GITHUB_ENV"
-# id: extract_base_branch
-#
-# - name: Install Maven
-# run: sudo apt-get install -y maven
-#
-# - name: Clone cimet Repository
-# run: git clone https://github.com/cloudhubs/cimet tool
-# working-directory: ./ # Clone into the root directory
-#
-# - name: Build Cimet with Maven
-# run: mvn clean install -DskipTests
-# working-directory: ./tool
-#
-# - name: Get Cimet Config
-# env:
-# CIMET_CONFIG: ${{ vars.CIMET_CONFIG }}
-# run: echo "$CIMET_CONFIG" >> "./tool/cimet-config.json"
-#
-# - name: Run Cimet
-# run: mvn exec:java -Dexec.mainClass="edu.university.ecs.lab.CimetRunner" -Dexec.args="cimet-config.json $BASE_BRANCH ${{ github.event.pull_request.base.sha }} $SOURCE_BRANCH ${{ github.event.pull_request.head.sha }}"
-# working-directory: ./tool
-#
-# - name: Save out folder
-# uses: actions/upload-artifact@v2
-# with:
-# name: changed-files-diff
-# path: ./tool/out
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
new file mode 100644
index 00000000..ccfe008f
--- /dev/null
+++ b/.github/workflows/pages.yml
@@ -0,0 +1,33 @@
+name: Deploy Javadoc with Custom Index
+
+on:
+ push:
+ branches:
+ - dev
+
+jobs:
+ javadoc:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+
+ - name: Generate Javadoc
+ run: mvn javadoc:javadoc
+
+ # Copy the custom index.html to the Javadoc output directory
+ - name: Replace Javadoc index.html with custom file
+ run: cp docs/index.html target/site/apidocs/index.html
+
+ # Deploy Javadoc to GitHub Pages
+ - name: Deploy to GitHub Pages
+ uses: peaceiris/actions-gh-pages@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: target/site/apidocs
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index c0fd7f55..d37c6efe 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,9 +1,6 @@
name: Maven Tests
on:
- push:
- branches:
- - main
pull_request:
branches:
- main
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 00000000..ecf0af74
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1 @@
+Hello World! Cimet2
\ No newline at end of file
From 59b0a529714d0fac3e80671baefe67cd8134fdf0 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 11:54:09 -0500
Subject: [PATCH 11/16] Website test
---
.github/workflows/pages.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index ccfe008f..da54b49f 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -17,6 +17,7 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '17'
+ distribution: 'temurin' # You can choose 'zulu' or other distributions if needed
- name: Generate Javadoc
run: mvn javadoc:javadoc
@@ -30,4 +31,4 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: target/site/apidocs
+ publish_dir: target/site/apidocs
\ No newline at end of file
From 35678af33a6c11584c84a0a283e9a60f21a30d1c Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 12:17:18 -0500
Subject: [PATCH 12/16] Restructuring
---
configs/config_Springboot-Microservice.json | 6 ------
configs/config_Tap-And-Eat-MicroServices.json | 6 ------
configs/config_apache-spring-boot-microservice-example.json | 6 ------
configs/config_blog-microservices.json | 6 ------
configs/config_java-microservice.json | 6 ------
configs/config_microservice-kafka.json | 6 ------
configs/config_microservice.json | 6 ------
configs/config_microservices-basics-spring-boot.json | 6 ------
configs/config_microservices-sample.json | 6 ------
configs/config_piggymetrics.json | 6 ------
configs/config_sample-spring-oauth2-microservices.json | 6 ------
configs/config_spring-boot-microservices-workshop.json | 6 ------
configs/config_spring-boot-microservices.json | 6 ------
configs/config_spring-cloud-movie-recommendation.json | 6 ------
configs/config_spring-cloud-netflix-example.json | 6 ------
configs/config_spring-netflix-oss-microservices.json | 6 ------
configs/config_spring-petclinic-microservices.json | 6 ------
configs/config_trainticket_gabriel.json | 6 ------
deltaspec.json => docs/deltaspec.json | 0
ir-spec.json => docs/ir-spec.json | 0
20 files changed, 108 deletions(-)
delete mode 100644 configs/config_Springboot-Microservice.json
delete mode 100644 configs/config_Tap-And-Eat-MicroServices.json
delete mode 100644 configs/config_apache-spring-boot-microservice-example.json
delete mode 100644 configs/config_blog-microservices.json
delete mode 100644 configs/config_java-microservice.json
delete mode 100644 configs/config_microservice-kafka.json
delete mode 100644 configs/config_microservice.json
delete mode 100644 configs/config_microservices-basics-spring-boot.json
delete mode 100644 configs/config_microservices-sample.json
delete mode 100644 configs/config_piggymetrics.json
delete mode 100644 configs/config_sample-spring-oauth2-microservices.json
delete mode 100644 configs/config_spring-boot-microservices-workshop.json
delete mode 100644 configs/config_spring-boot-microservices.json
delete mode 100644 configs/config_spring-cloud-movie-recommendation.json
delete mode 100644 configs/config_spring-cloud-netflix-example.json
delete mode 100644 configs/config_spring-netflix-oss-microservices.json
delete mode 100644 configs/config_spring-petclinic-microservices.json
delete mode 100644 configs/config_trainticket_gabriel.json
rename deltaspec.json => docs/deltaspec.json (100%)
rename ir-spec.json => docs/ir-spec.json (100%)
diff --git a/configs/config_Springboot-Microservice.json b/configs/config_Springboot-Microservice.json
deleted file mode 100644
index 89df2c3d..00000000
--- a/configs/config_Springboot-Microservice.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "Springboot-Microservice",
- "repositoryURL": "https://github.com/shabbirdwd53/Springboot-Microservice.git",
- "baseCommit": "e0faba5a247ebb0cbd2ee14a10f115d689aa9ed6",
- "baseBranch": "main"
-}
\ No newline at end of file
diff --git a/configs/config_Tap-And-Eat-MicroServices.json b/configs/config_Tap-And-Eat-MicroServices.json
deleted file mode 100644
index bcb93b51..00000000
--- a/configs/config_Tap-And-Eat-MicroServices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "Tap-And-Eat-MicroServices",
- "repositoryURL": "https://github.com/jferrater/Tap-And-Eat-MicroServices.git",
- "baseCommit": "3ad20b8fa421dc837ef423270a9bf9ece1615a03",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_apache-spring-boot-microservice-example.json b/configs/config_apache-spring-boot-microservice-example.json
deleted file mode 100644
index 07a85346..00000000
--- a/configs/config_apache-spring-boot-microservice-example.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "apache-spring-boot-microservice-example",
- "repositoryURL": "https://github.com/georgwittberger/apache-spring-boot-microservice-example.git",
- "baseCommit": "5b97bd98fce6bff64fd89cffbfc7f7e9450f8791",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_blog-microservices.json b/configs/config_blog-microservices.json
deleted file mode 100644
index 89fc9815..00000000
--- a/configs/config_blog-microservices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "blog-microservices",
- "repositoryURL": "https://github.com/callistaenterprise/blog-microservices.git",
- "baseCommit": "1681bdb6b1b0c64147d059f2c2e04726bce8e2f4",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_java-microservice.json b/configs/config_java-microservice.json
deleted file mode 100644
index befad736..00000000
--- a/configs/config_java-microservice.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "java-microservice",
- "repositoryURL": "https://github.com/apssouza22/java-microservice.git",
- "baseCommit": "9172a9004dd92434fbec4712cb45650a611185c3",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_microservice-kafka.json b/configs/config_microservice-kafka.json
deleted file mode 100644
index 97809f1d..00000000
--- a/configs/config_microservice-kafka.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "microservice-kafka",
- "repositoryURL": "https://github.com/ewolff/microservice-kafka.git",
- "baseCommit": "103de22da497c631708f0541a0cad0e662d04aa5",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_microservice.json b/configs/config_microservice.json
deleted file mode 100644
index 318abe65..00000000
--- a/configs/config_microservice.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "microservice",
- "repositoryURL": "https://github.com/ewolff/microservice.git",
- "baseCommit": "d1ccf504df5617288479902ad9eb2111df73ed65",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_microservices-basics-spring-boot.json b/configs/config_microservices-basics-spring-boot.json
deleted file mode 100644
index 7038e06c..00000000
--- a/configs/config_microservices-basics-spring-boot.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "microservices-basics-spring-boot",
- "repositoryURL": "https://github.com/anilallewar/microservices-basics-spring-boot.git",
- "baseCommit": "ac0a249156471ad98fa5ba5508fda9deabba6975",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_microservices-sample.json b/configs/config_microservices-sample.json
deleted file mode 100644
index 01f5e934..00000000
--- a/configs/config_microservices-sample.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "microservices-sample",
- "repositoryURL": "https://github.com/mudigal-technologies/microservices-sample.git",
- "baseCommit": "1e9ec03e01b7f63ac376fa38a6a54f2c072c0814",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_piggymetrics.json b/configs/config_piggymetrics.json
deleted file mode 100644
index 4f0473f5..00000000
--- a/configs/config_piggymetrics.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "piggymetrics",
- "repositoryURL": "https://github.com/sqshq/PiggyMetrics.git",
- "baseCommit": "6bb2cf9ddbca980b664d3edbb6ff775d75369278",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_sample-spring-oauth2-microservices.json b/configs/config_sample-spring-oauth2-microservices.json
deleted file mode 100644
index f6317732..00000000
--- a/configs/config_sample-spring-oauth2-microservices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "sample-spring-oauth2-microservices",
- "repositoryURL": "https://github.com/piomin/sample-spring-oauth2-microservices.git",
- "baseCommit": "05f390ee4351247a9c5803098059238424b58bae",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-boot-microservices-workshop.json b/configs/config_spring-boot-microservices-workshop.json
deleted file mode 100644
index 9630a2df..00000000
--- a/configs/config_spring-boot-microservices-workshop.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-boot-microservices-workshop",
- "repositoryURL": "https://github.com/koushikkothagal/spring-boot-microservices-workshop.git",
- "baseCommit": "8b01c6d153f7b6aee49fa91a5b1c62c1a0c09408",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-boot-microservices.json b/configs/config_spring-boot-microservices.json
deleted file mode 100644
index f225ad28..00000000
--- a/configs/config_spring-boot-microservices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-boot-microservices",
- "repositoryURL": "https://github.com/rohitghatol/spring-boot-microservices.git",
- "baseCommit": "a3c9df9350a07578df281949e6018d01ac37238e",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-cloud-movie-recommendation.json b/configs/config_spring-cloud-movie-recommendation.json
deleted file mode 100644
index 58361a84..00000000
--- a/configs/config_spring-cloud-movie-recommendation.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-cloud-movie-recommendation",
- "repositoryURL": "https://github.com/mdeket/spring-cloud-movie-recommendation.git",
- "baseCommit": "5aa5ee9e2e64c33e294409e39cb9708591230e08",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-cloud-netflix-example.json b/configs/config_spring-cloud-netflix-example.json
deleted file mode 100644
index 9c144fcc..00000000
--- a/configs/config_spring-cloud-netflix-example.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-cloud-netflix-example",
- "repositoryURL": "https://github.com/yidongnan/spring-cloud-netflix-example.git",
- "baseCommit": "3b86bf0e20a7c7da8f4e3e7e2cb15bf4cd407743",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-netflix-oss-microservices.json b/configs/config_spring-netflix-oss-microservices.json
deleted file mode 100644
index 9291afc0..00000000
--- a/configs/config_spring-netflix-oss-microservices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-netflix-oss-microservices",
- "repositoryURL": "https://github.com/fernandoabcampos/spring-netflix-oss-microservices.git",
- "baseCommit": "8668c4dffd9464b5d724f4d1a9547e029ee03d12",
- "baseBranch": "master"
-}
\ No newline at end of file
diff --git a/configs/config_spring-petclinic-microservices.json b/configs/config_spring-petclinic-microservices.json
deleted file mode 100644
index 3b076d77..00000000
--- a/configs/config_spring-petclinic-microservices.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "spring-petclinic-microservices",
- "repositoryURL": "https://github.com/spring-petclinic/spring-petclinic-microservices.git",
- "baseCommit": "85f8f36556121a28f765d55fb4d6510edd2165d3",
- "baseBranch": "main"
-}
\ No newline at end of file
diff --git a/configs/config_trainticket_gabriel.json b/configs/config_trainticket_gabriel.json
deleted file mode 100644
index 565b2a48..00000000
--- a/configs/config_trainticket_gabriel.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "systemName": "Train-ticket",
- "repositoryURL": "https://github.com/g-goulis/train-ticket-microservices-test.git",
- "baseCommit": "e4bc4782ea983ef015ea352eed0d142d8ad78fb3",
- "baseBranch": "main"
-}
\ No newline at end of file
diff --git a/deltaspec.json b/docs/deltaspec.json
similarity index 100%
rename from deltaspec.json
rename to docs/deltaspec.json
diff --git a/ir-spec.json b/docs/ir-spec.json
similarity index 100%
rename from ir-spec.json
rename to docs/ir-spec.json
From 1fe03f298a20d93be64d0a37fa3275c8b6439c60 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 12:32:52 -0500
Subject: [PATCH 13/16] Documentation passing
---
.../ecs/lab/common/models/enums/RestCallTemplate.java | 2 +-
.../edu/university/ecs/lab/common/models/ir/Microservice.java | 2 +-
.../edu/university/ecs/lab/common/services/GitService.java | 1 -
.../ecs/lab/common/utils/NonJsonReadWriteUtils.java | 1 -
.../lab/detection/antipatterns/models/CyclicDependency.java | 2 +-
.../detection/antipatterns/services/NoApiGatewayService.java | 3 +--
.../detection/antipatterns/services/NoHealthcheckService.java | 1 -
.../ecs/lab/detection/architecture/models/package-info.java | 1 -
.../ecs/lab/detection/metrics/models/DegreeCoupling.java | 4 ++--
.../ecs/lab/detection/metrics/models/StructuralCoupling.java | 4 ++--
.../java/edu/university/ecs/lab/detection/package-info.java | 2 +-
11 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
index 223db656..48eb2c0c 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/enums/RestCallTemplate.java
@@ -39,7 +39,7 @@ public RestCallTemplate(MethodCallExpr mce, CompilationUnit cu) {
/**
* Find the RestTemplate by the method name.
*
- * @param methodName the method name
+ * @param mce the method call
* @return the RestTemplate found (null if not found)
*/
public HttpMethod getHttpFromName(MethodCallExpr mce) {
diff --git a/src/main/java/edu/university/ecs/lab/common/models/ir/Microservice.java b/src/main/java/edu/university/ecs/lab/common/models/ir/Microservice.java
index b2aa07f2..a3f6fd32 100644
--- a/src/main/java/edu/university/ecs/lab/common/models/ir/Microservice.java
+++ b/src/main/java/edu/university/ecs/lab/common/models/ir/Microservice.java
@@ -261,7 +261,7 @@ public Set getClasses() {
/**
* This method returns all files of a microservice, it is
- * the aggregate of {@link #getClasses()} and {@link #getFiles()}
+ * the aggregate of getClasses() and getFiles()
*
* @return the set of all classes and files
*/
diff --git a/src/main/java/edu/university/ecs/lab/common/services/GitService.java b/src/main/java/edu/university/ecs/lab/common/services/GitService.java
index b7ec5bb2..1f5ced35 100644
--- a/src/main/java/edu/university/ecs/lab/common/services/GitService.java
+++ b/src/main/java/edu/university/ecs/lab/common/services/GitService.java
@@ -163,7 +163,6 @@ public Repository initRepository() {
* @param commitOld the old commit ID
* @param commitNew the new commit ID
* @return the list of differences as DiffEntrys
- * @throws Exception
*/
public List getDifferences(String commitOld, String commitNew) {
List returnList = null;
diff --git a/src/main/java/edu/university/ecs/lab/common/utils/NonJsonReadWriteUtils.java b/src/main/java/edu/university/ecs/lab/common/utils/NonJsonReadWriteUtils.java
index 1a8b2cdd..ffdb556f 100644
--- a/src/main/java/edu/university/ecs/lab/common/utils/NonJsonReadWriteUtils.java
+++ b/src/main/java/edu/university/ecs/lab/common/utils/NonJsonReadWriteUtils.java
@@ -32,7 +32,6 @@ private NonJsonReadWriteUtils() {
* This method reads YAML from a file returning structure as JsonObject
* @param path the path to the YAML file.
* @return JsonObject YAML file structure as json object
- * @throws IOException If there is an error reading the YAML file.
*/
public static ConfigFile readFromYaml(String path, Config config) {
JsonObject data = null;
diff --git a/src/main/java/edu/university/ecs/lab/detection/antipatterns/models/CyclicDependency.java b/src/main/java/edu/university/ecs/lab/detection/antipatterns/models/CyclicDependency.java
index 44795cde..8324739b 100644
--- a/src/main/java/edu/university/ecs/lab/detection/antipatterns/models/CyclicDependency.java
+++ b/src/main/java/edu/university/ecs/lab/detection/antipatterns/models/CyclicDependency.java
@@ -32,7 +32,7 @@ public class CyclicDependency extends AntiPattern{
/**
* Constructs a CyclicDependency object initialized with the given cycle.
*
- * @param cycle the list of nodes representing the cycle
+ * @param cycles the list of nodes representing the cycle
*/
public CyclicDependency(List> cycles) {
this.cycles = cycles;
diff --git a/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoApiGatewayService.java b/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoApiGatewayService.java
index 0e37a329..08360619 100644
--- a/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoApiGatewayService.java
+++ b/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoApiGatewayService.java
@@ -15,7 +15,6 @@ public class NoApiGatewayService {
/**
* Checks if the YAML file contains configuration indicating an API Gateway.
- * @param yamlFilePath The path to the YAML file to check.
* @return NoApiGateway object that contains true if an API Gateway configuration is detected,
* NoApiGateway object that contains false otherwise.
*/
@@ -41,7 +40,7 @@ public NoApiGateway checkforApiGateway(MicroserviceSystem microserviceSystem) {
/**
* Checks if the given JsonObject contains the "cloud" -> "gateway" configuration.
- * @param jsonObject The JsonObject to check.
+ * @param data The JsonObject to check.
* @return true if the configuration is found, false otherwise.
*/
private boolean containsApiGatewayConfiguration(JsonObject data) {
diff --git a/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoHealthcheckService.java b/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoHealthcheckService.java
index e1753885..ce110551 100644
--- a/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoHealthcheckService.java
+++ b/src/main/java/edu/university/ecs/lab/detection/antipatterns/services/NoHealthcheckService.java
@@ -19,7 +19,6 @@ public class NoHealthcheckService {
/**
* Checks if both circuit breaker and rate limiter health checks are enabled in the YAML configuration.
- * @param yamlFilePath The path to the YAML file to check.
* @return NoHealthcheck object that contains true if both circuit breaker
* and rate limiter health checks are enabled, NoHealthcheck object that contains false otherwise.
*/
diff --git a/src/main/java/edu/university/ecs/lab/detection/architecture/models/package-info.java b/src/main/java/edu/university/ecs/lab/detection/architecture/models/package-info.java
index 6e213eac..9b537945 100644
--- a/src/main/java/edu/university/ecs/lab/detection/architecture/models/package-info.java
+++ b/src/main/java/edu/university/ecs/lab/detection/architecture/models/package-info.java
@@ -6,7 +6,6 @@
* - {@link edu.university.ecs.lab.detection.architecture.models.enums}: Contains enumerations used within the architectural models, such as confidence levels.
* - {@link edu.university.ecs.lab.detection.architecture.models.AbstractAR}: Provides a template for all architectural rules, including methods to get the name, description, weight, commit IDs, and type of the rule, and to convert the rule to a JSON object.
* - {@link edu.university.ecs.lab.detection.architecture.models.AR1}: Represents the rule for detecting floating calls due to endpoint removal within the microservice system, including methods for scanning and detecting such instances.
- * - {@link edu.university.ecs.lab.detection.architecture.models.AR2}: Represents the rule for detecting floating calls due to endpoint removal (external) within the microservice system, including methods for scanning and detecting such instances.
* - {@link edu.university.ecs.lab.detection.architecture.models.AR3}: Represents the rule for detecting floating calls due to invalid call creation within the microservice system, including methods for scanning and detecting such instances.
* - {@link edu.university.ecs.lab.detection.architecture.models.AR4}: Represents the rule for detecting floating endpoints due to last call removal within the microservice system, including methods for scanning and detecting such instances.
* - {@link edu.university.ecs.lab.detection.architecture.models.AR6}: Represents the rule for detecting affected endpoints due to business logic updates within the microservice system, including methods for scanning and detecting such instances.
diff --git a/src/main/java/edu/university/ecs/lab/detection/metrics/models/DegreeCoupling.java b/src/main/java/edu/university/ecs/lab/detection/metrics/models/DegreeCoupling.java
index b972346f..395412f6 100644
--- a/src/main/java/edu/university/ecs/lab/detection/metrics/models/DegreeCoupling.java
+++ b/src/main/java/edu/university/ecs/lab/detection/metrics/models/DegreeCoupling.java
@@ -11,8 +11,8 @@
import lombok.Getter;
/**
- * Class implementing the calculation of degree-related Coupling metrics according to [1]
- * [1] Bogner, J., Wagner, S., & Zimmermann, A. (2017, October).
+ * Class implementing the calculation of degree-related Coupling metrics according to (1)
+ * (1) Bogner, J., Wagner, S., & Zimmermann, A. (2017, October).
* Automatically measuring the maintainability of service-and microservice-based systems: a literature review.
* In Proceedings of the 27th international workshop on software measurement and 12th international conference
* on software process and product measurement (pp. 107-115).
diff --git a/src/main/java/edu/university/ecs/lab/detection/metrics/models/StructuralCoupling.java b/src/main/java/edu/university/ecs/lab/detection/metrics/models/StructuralCoupling.java
index 99edbbf7..c880d2a5 100644
--- a/src/main/java/edu/university/ecs/lab/detection/metrics/models/StructuralCoupling.java
+++ b/src/main/java/edu/university/ecs/lab/detection/metrics/models/StructuralCoupling.java
@@ -7,8 +7,8 @@
import java.util.*;
/**
- * Class implementing the Structural Coupling Metric proposed in [1]
- * [1] Panichella, S., Rahman, M. I., & Taibi, D. (2021). Structural coupling for microservices. arXiv preprint arXiv:2103.04674
+ * Class implementing the Structural Coupling Metric proposed (1)
+ * (1) Panichella, S., Rahman, M. I., & Taibi, D. (2021). Structural coupling for microservices. arXiv preprint arXiv:2103.04674
*/
@Getter
public class StructuralCoupling {
diff --git a/src/main/java/edu/university/ecs/lab/detection/package-info.java b/src/main/java/edu/university/ecs/lab/detection/package-info.java
index f344f56c..08dc2ea9 100644
--- a/src/main/java/edu/university/ecs/lab/detection/package-info.java
+++ b/src/main/java/edu/university/ecs/lab/detection/package-info.java
@@ -7,7 +7,7 @@
* - {@link edu.university.ecs.lab.detection.architecture}: Provides tools for analyzing and evaluating architecture rules of microservice architecture.
* - {@link edu.university.ecs.lab.detection.metrics}: Includes classes for gathering and analyzing various metrics from microservice systems.
* - {@link edu.university.ecs.lab.detection.ExcelOutputRunner}: Contains the main class for generating Excel reports of detected trends and metrics.
- * - {@link edu.university.ecs.lab.detection.ARDetectionRunner}: Contains the main class for detecting and analyzing architectural rules.
+ * - {@link edu.university.ecs.lab.detection.DetectionService}: Contains the main class for detecting and analyzing architectural rules.
*
*/
package edu.university.ecs.lab.detection;
From d5936edc9573205999852a63e6dc7a3bf4c5cba9 Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 12:36:41 -0500
Subject: [PATCH 14/16] Modify publish location
---
.github/workflows/pages.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index da54b49f..916b8d81 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -22,13 +22,13 @@ jobs:
- name: Generate Javadoc
run: mvn javadoc:javadoc
- # Copy the custom index.html to the Javadoc output directory
- - name: Replace Javadoc index.html with custom file
- run: cp docs/index.html target/site/apidocs/index.html
+# # Copy the custom index.html to the Javadoc output directory
+# - name: Replace Javadoc index.html with custom file
+# run: cp docs/index.html docs/apidocs/index.html
# Deploy Javadoc to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: target/site/apidocs
\ No newline at end of file
+ publish_dir: docs
\ No newline at end of file
From 5a443710e71f50a1b2f49cc258b9303853e7215d Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Sun, 22 Sep 2024 12:59:32 -0500
Subject: [PATCH 15/16] Modify publish location
---
.github/workflows/generate_javadoc.yml | 31 ++++++++++++++++++++++++++
.github/workflows/pages.yml | 27 ++++++++++++----------
docs/index.html | 11 ++++++++-
3 files changed, 56 insertions(+), 13 deletions(-)
create mode 100644 .github/workflows/generate_javadoc.yml
diff --git a/.github/workflows/generate_javadoc.yml b/.github/workflows/generate_javadoc.yml
new file mode 100644
index 00000000..932738bc
--- /dev/null
+++ b/.github/workflows/generate_javadoc.yml
@@ -0,0 +1,31 @@
+name: Generate and Validate Javadocs
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout Code
+ uses: actions/checkout@v3
+
+ - name: Set Up Java
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'temurin'
+ java-version: '17' # Adjust the Java version as needed
+
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Generate Javadocs
+ run: mvn javadoc:javadoc
+
+ - name: Validate Javadocs
+ run: |
+ # Add your validation scripts here
+ echo "Validating Javadocs..."
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index 916b8d81..91b5131a 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -1,34 +1,37 @@
-name: Deploy Javadoc with Custom Index
+name: Deploy Documentation to GitHub Pages
on:
push:
branches:
- - dev
+ - main
jobs:
- javadoc:
+ deploy:
runs-on: ubuntu-latest
steps:
- - name: Checkout code
+ - name: Checkout Code
uses: actions/checkout@v3
- - name: Set up JDK
+ - name: Set Up Java
uses: actions/setup-java@v3
with:
+ distribution: 'temurin'
java-version: '17'
- distribution: 'temurin' # You can choose 'zulu' or other distributions if needed
- - name: Generate Javadoc
+ - name: Build with Maven
+ run: mvn clean install
+
+ - name: Generate Javadocs
run: mvn javadoc:javadoc
-# # Copy the custom index.html to the Javadoc output directory
-# - name: Replace Javadoc index.html with custom file
-# run: cp docs/index.html docs/apidocs/index.html
+ - name: Copy Javadocs to Docs
+ run: |
+ rm -rf docs/javadoc
+ cp -r target/site/apidocs docs/javadoc
- # Deploy Javadoc to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: docs
\ No newline at end of file
+ publish_dir: ./docs
diff --git a/docs/index.html b/docs/index.html
index ecf0af74..dc91fdfa 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1 +1,10 @@
-Hello World! Cimet2
\ No newline at end of file
+
+
+
+ My Project Documentation
+
+
+Welcome to My Project
+Navigate to the API Documentation.
+
+
From dbfadef7be0c6cecd81db7a2733ce96e4ebdb76a Mon Sep 17 00:00:00 2001
From: Gabriel Goulis
Date: Mon, 23 Sep 2024 18:30:42 -0500
Subject: [PATCH 16/16] New actions approach - deploy key
---
.github/workflows/generate_javadoc.yml | 31 -------
.github/workflows/main.yml | 116 +++++++++++++++++--------
.github/workflows/pages.yml | 37 --------
.github/workflows/publish.yml | 32 -------
.github/workflows/test.yml | 32 -------
5 files changed, 79 insertions(+), 169 deletions(-)
delete mode 100644 .github/workflows/generate_javadoc.yml
delete mode 100644 .github/workflows/pages.yml
delete mode 100644 .github/workflows/publish.yml
delete mode 100644 .github/workflows/test.yml
diff --git a/.github/workflows/generate_javadoc.yml b/.github/workflows/generate_javadoc.yml
deleted file mode 100644
index 932738bc..00000000
--- a/.github/workflows/generate_javadoc.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Generate and Validate Javadocs
-
-on:
- pull_request:
- branches:
- - main
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout Code
- uses: actions/checkout@v3
-
- - name: Set Up Java
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '17' # Adjust the Java version as needed
-
- - name: Build with Maven
- run: mvn clean install
-
- - name: Generate Javadocs
- run: mvn javadoc:javadoc
-
- - name: Validate Javadocs
- run: |
- # Add your validation scripts here
- echo "Validating Javadocs..."
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 95f2eb05..82d4ad58 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,37 +1,79 @@
-## This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
-## For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
-#
-## For each push and pull request, it builds the project, formats the code and runs units tests.
-#name: CI
-#
-#on:
-# push:
-# branches: [ "main" ]
-# pull_request:
-# branches: [ "main" ]
-#
-#jobs:
-# build:
-# runs-on: ubuntu-latest
-# steps:
-# - uses: actions/checkout@v3
-# - name: Set up JDK 17
-# uses: actions/setup-java@v3
-# with:
-# java-version: '17'
-# distribution: 'temurin'
-# cache: maven
-# - name: Build with Maven
-# run: mvn -B package --file pom.xml
-#
-# formatting:
-# runs-on: ubuntu-latest
-# steps:
-# - uses: actions/checkout@v3 # v2 minimum required
-# - uses: axel-op/googlejavaformat-action@v3
-# with:
-# args: "--skip-sorting-imports --replace"
-# # Recommended if you use MacOS:
-# github-token: ${{ secrets.GITHUB_TOKEN }}
-#
-#
+name: CI for Java Project
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+
+ - name: Install dependencies and run tests
+ run: mvn install -B
+
+ - name: Run tests
+ run: mvn test --no-transfer-progress
+
+ javadoc:
+ runs-on: ubuntu-latest
+ needs: test
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+
+ - name: Generate Javadoc
+ run: mvn javadoc:javadoc --no-transfer-progress
+
+ - name: Verify Javadoc
+ run: |
+ if [ ! -d target/site/apidocs ]; then
+ echo "Javadoc failed to compile!"
+ exit 1
+ fi
+
+ deploy:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Set up SSH for deploy key
+ run: |
+ mkdir -p ~/.ssh
+ echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
+ chmod 600 ~/.ssh/deploy_key
+ ssh-keyscan github.com >> ~/.ssh/known_hosts
+ env:
+ SSH_AUTH_SOCK: /tmp/ssh_agent.sock
+
+ - name: Generate Javadoc
+ run: mvn javadoc:javadoc --no-transfer-progress
+
+ - name: Push Javadoc to GitHub Pages
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ rm -rf docs/apidocs
+ mv target/site/apidocs docs/apidocs
+ git add docs/apidocs
+ git commit -m "Update Javadoc"
+ git push origin main
+ env:
+ GIT_SSH_COMMAND: "ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes"
\ No newline at end of file
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
deleted file mode 100644
index 91b5131a..00000000
--- a/.github/workflows/pages.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: Deploy Documentation to GitHub Pages
-
-on:
- push:
- branches:
- - main
-
-jobs:
- deploy:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout Code
- uses: actions/checkout@v3
-
- - name: Set Up Java
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '17'
-
- - name: Build with Maven
- run: mvn clean install
-
- - name: Generate Javadocs
- run: mvn javadoc:javadoc
-
- - name: Copy Javadocs to Docs
- run: |
- rm -rf docs/javadoc
- cp -r target/site/apidocs docs/javadoc
-
- - name: Deploy to GitHub Pages
- uses: peaceiris/actions-gh-pages@v3
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: ./docs
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
deleted file mode 100644
index 3be71e2d..00000000
--- a/.github/workflows/publish.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-#name: Deploy to GitHub Pages
-#on: [ push ]
-#
-#jobs:
-# deploy-to-github-pages:
-# # use ubuntu-latest image to run steps on
-# runs-on: ubuntu-latest
-# steps:
-# - uses: actions/checkout@v2
-# with:
-# ref: web-dev
-# - name: Setup .NET Core SDK
-# uses: actions/setup-dotnet@v1
-# with:
-# dotnet-version: 6.0.307
-# - name: Publish .NET Core Project
-# run: dotnet publish ./ProphetEvolution/ProphetEvolution.csproj -c Release -o release --nologo
-# # changes the base-tag in index.html from '/' to 'BlazorGitHubPagesDemo' to match GitHub Pages repository subdirectory
-# - name: Change base-tag in index.html from / to pages
-# run: sed -i 's///g' release/wwwroot/index.html
-# # copy index.html to 404.html to serve the same file when a file is not found
-# - name: copy index.html to 404.html
-# run: cp release/wwwroot/index.html release/wwwroot/404.html
-# # add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore)
-# - name: Add .nojekyll file
-# run: touch release/wwwroot/.nojekyll
-# - name: Commit wwwroot to GitHub Pages
-# uses: JamesIves/github-pages-deploy-action@3.7.1
-# with:
-# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-# BRANCH: gh-pages
-# FOLDER: release/wwwroot
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index d37c6efe..00000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Maven Tests
-
-on:
- pull_request:
- branches:
- - main
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v3
-
- - name: Set up JDK 17
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '17'
-
- - name: Cache Maven packages
- uses: actions/cache@v3
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
-
- - name: Install dependencies and run tests
- run: mvn clean install