Skip to content

Commit

Permalink
Library init
Browse files Browse the repository at this point in the history
  • Loading branch information
g-goulis committed Dec 4, 2024
1 parent e685f06 commit c05b809
Show file tree
Hide file tree
Showing 64 changed files with 5,300 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish package to GitHub Packages

on: push
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
- name: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Intellij
.idea

# Maven
target/
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
126 changes: 125 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,125 @@
# cimet-extract-lib
# CIMET Extraction Library

This Maven library props up the functionality of CIMET2.
It is intended to be used as a temporal parser of microservice systems.
It is capable of extracting intermediate representations (IR) of the system
and delta representations of the changes to the system.

## Prerequisites

* Maven 3.6+
* Java 11+ (11 Recommended)

## To Compile:
``mvn clean install -DskipTests``

## Extracting an Intermediate Representation:
- Run or compile the main method of ``IRExtractionRunner.java`` in the IDE of your choice or via the command line.
- Command line args list containing ``/path/to/config/<Config-File>.json``

Sample input config file:

```json
{
"systemName": "Train-ticket",
"repositoryURL": "https://github.com/g-goulis/train-ticket-microservices-test.git",
"endCommit": "06f3e1efe2e2539d05d91b0699cc8d9fe7be29d7",
"baseBranch": "main"
}
```

Sample output produced:
```json
{
"name": "Train-ticket",
"commitID": "1.0",
"microservices": [
{
"name": "ts-rebook-service",
"path": ".\\clone\\train-ticket-microservices-test\\ts-rebook-service",
"controllers": [
{
"packageName": "com.cloudhubs.trainticket.rebook.controller",
"name": "WaitListOrderController.java",
"path": ".\\clone\\train-ticket-microservices-test\\ts-rebook-service\\src\\main\\java\\com\\cloudhubs\\trainticket\\rebook\\controller\\WaitListOrderController.java",
"classRole": "CONTROLLER",
"annotations": [
{
"name": "RequestMapping",
"contents": "\"/api/v1/waitorderservice\""
},
...
],
"fields": [
{
"name": "waitListOrderService",
"type": "WaitListOrderService"
},
...
],
"methods": [
{
"name": "getAllOrders",
"annotations": [
{
"name": "GetMapping",
"contents": "[path \u003d \"/orders\"]"
}
],
"parameters": [
{
"name": "HttpHeaders",
"type": "headers"
}
],
"returnType": "HttpEntity",
"url": "/api/v1/waitorderservice/orders",
"httpMethod": "GET",
"microserviceName": "ts-rebook-service"
},
...
],
"methodCalls": [
{
"name": "info",
"objectName": "LOGGER",
"calledFrom": "getWaitListOrders",
"parameterContents": "\"[getWaitListOrders][Get All Wait List Orders]\""
},
...
]
},
...
],
"Services": [...],
"Repositories": [...],
"Entities": [...],
],
"orphans": [...]
}
```

## Extracting a Delta Change Impact:
- Run or compile the main method of ``DeltaExtractionRunner.java`` in the IDE of your choice or via the command line.
- Command line args list containing ``/path/to/config/<Config-File>.json <oldCommit> <newCommit>``

Sample output produced:
```json
{
"oldCommit": "06f3e1efe2e2539d05d91b0699cc8d9fe7be29d7",
"newCommit": "82949fa07dcf82f66641f5807d629d15bab663a6",
"changes": [
{
"oldPath": ".\\clone\\train-ticket-microservices-test\\ts-price-service\\src\\main\\java\\com\\cloudhubs\\trainticket\\price\\controller\\PriceController.java",
"newPath": ".\\clone\\train-ticket-microservices-test\\ts-price-service\\src\\main\\java\\com\\cloudhubs\\trainticket\\price\\controller\\PriceController.java",
"changeType": "MODIFY",
"classChange": {}
},
...
]
}
```

## Merging an IR & System Change:
- Run or compile the main method of ``IRMergeRunner.java`` in the IDE of your choice or via the command line.
- Provide command line args containing ``path/to/IR/<IR-File>.json path/to/Delta/<IR-File>.json /path/to/config/<Config-File>.json``
154 changes: 154 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.university.ecs.lab</groupId>
<artifactId>cimet-extract-lib</artifactId>
<version>1.0-SNAPSHOT-2</version>
<properties>
<maven.compiler.target>16</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.parameters>true</maven.compiler.parameters>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
</properties>

<!-- Github distribution management for posting maven library -->
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/cloudhubs/cimet-extract-lib</url>
</repository>
</distributionManagement>

<packaging>jar</packaging>

<dependencies>
<!-- new dependencies -->
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-symbol-solver-core</artifactId>
<version>3.16.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.8.0.202311291450-r</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass> <!-- Your main class here -->
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.3</version>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit c05b809

Please sign in to comment.