├── .idea
├── artifacts
│ └── microservices_comm_pattern_check_jar.xml
├── compiler.xml
├── encodings.xml
├── misc.xml
└── vcs.xml
├── README.md
├── microservicescommpatterncheck.iml
├── pom.xml
├── resultGraphs
├── Spring-petclinic.png
├── consul-master.png
├── ecommerce-microservices.png
├── ftgo-application-master.png
├── microservice_sample.png
├── qbike.png
└── springCloudExample.png
└── src
├── main
├── java
│ └── com
│ │ └── imranur
│ │ └── microservices
│ │ └── comm
│ │ └── pattern
│ │ └── check
│ │ ├── App.java
│ │ ├── Models
│ │ ├── DockerServices.java
│ │ ├── ServiceInOutDegClass.java
│ │ ├── ServiceInterDependency.java
│ │ └── Services.java
│ │ └── Utils
│ │ ├── DBUtilService.java
│ │ └── DockerComposeUtils.java
└── resources
│ └── META-INF
│ └── MANIFEST.MF
└── test
└── java
└── com
└── imranur
└── microservices
└── comm
└── pattern
└── check
└── AppTest.java
/.idea/artifacts/microservices_comm_pattern_check_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/out/artifacts/microservices_comm_pattern_check_jar
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Microservice Dependency Graph (MicroDepGraph)
2 |
3 | MicroDepGraph analyzes the service dependecies of microservices projects based on docker configuration. It produces output as neo4j graph database and also image of dependency graph as SVG format. It analyzes a project which is in local drive. It will create two folders one is "neo4jData" and another one is "output" which holds the generated image of dependency graph.
4 |
5 | # Requirements
6 |
7 | Java jdk8 or higher.
8 |
9 | # How to use it
10 |
11 | * clone a git repository containing a java project developed with a micorservice architectural style.
12 | * execute MicroDepGraph as: java -jar microservices-dependency-check.jar
13 |
14 | An example command to run the tool from command line is,
15 | java -jar microservices-dependency-check.jar /home/myuser/ftgo-application-master ftgo-application-master
16 |
17 |
18 |
19 | # Outputs
20 |
21 | After analyzing the project, MicroDepGraph generates dependency graph in three types of export files which are,
22 |
23 | 1. Neo4j database containing output graph
24 | 2. GraphML file a common format for exchanging graph structure data
25 | 3. An SVG file
26 |
27 | 
28 | Figure 1. Example MicroDepGraph Output (project spinnaker http://bit.ly/2YQA2S7)
29 |
30 | # List of projects the tool has been currently tested on
31 |
32 | A dataset with different projects analyzed is available on the MicroserviceDataset repository [view](https://github.com/clowee/MicroserviceDataset)
33 |
34 | ## How to cite
35 |
36 | Please, cite as "The Microservice Dataset, Version 1.0 [1]"
37 |
38 | [1] Mohammad Imranur Rahman, Sebastiano Panichella, Davide Taibi. A curated Dataset of Microservices-Based Systems. Joint Proceedings of the Summer School on Software Maintenance and Evolution. Tampere, 2019
39 | ```
40 | @INPROCEEDINGS{Rahman2019,
41 | author = {Rahman, MI.and Taibi, Davide},
42 | title = {A curated Dataset of Microservices-Based Systems},
43 | booktitle={Joint Proceedings of the Summer School on Software Maintenance and Evolution},
44 | year={2019},
45 | month={September},
46 | publisher = {CEUR-WS}
47 | location = {Tampere, Finland}
48 | }
49 | ```
50 |
51 |
--------------------------------------------------------------------------------
/microservicescommpatterncheck.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | 4.0.0
6 |
7 | com.imranur
8 | microservices.comm.pattern.check
9 | 1.0-SNAPSHOT
10 |
11 | microservices-comm-pattern-check
12 |
13 | http://www.example.com
14 |
15 |
16 | UTF-8
17 | 1.7
18 | 1.7
19 |
20 |
21 |
22 |
23 | junit
24 | junit
25 | 4.11
26 | test
27 |
28 |
29 | org.yaml
30 | snakeyaml
31 | 1.23
32 |
33 |
34 | org.neo4j
35 | neo4j
36 | 3.5.7
37 |
38 |
39 | org.neo4j.driver
40 | neo4j-java-driver
41 | 2.0.0-alpha02
42 |
43 |
44 | guru.nidi
45 | graphviz-java
46 | 0.8.10
47 |
48 |
49 | org.apache.tinkerpop
50 | gremlin-core
51 | 3.4.2
52 |
53 |
54 | com.tinkerpop.gremlin
55 | gremlin-java
56 | 2.6.0
57 |
58 |
59 |
60 | com.fasterxml.jackson.dataformat
61 | jackson-dataformat-csv
62 | 2.9.9
63 |
64 |
65 |
66 | org.apache.commons
67 | commons-text
68 | 1.8
69 |
70 |
71 |
72 |
73 |
74 |
75 | ${project.basedir}/src/main/java
76 |
77 |
78 |
79 |
80 | maven-clean-plugin
81 | 3.1.0
82 |
83 |
84 |
85 | maven-resources-plugin
86 | 3.0.2
87 |
88 |
89 | maven-compiler-plugin
90 | 3.8.0
91 |
92 |
93 | maven-surefire-plugin
94 | 2.22.1
95 |
96 |
97 | maven-jar-plugin
98 | 3.0.2
99 |
100 |
101 |
102 | true
103 | libs/
104 |
105 | org.baeldung.executable.ExecutableMavenJar
106 |
107 |
108 |
109 |
110 |
111 |
112 | org.apache.maven.plugins
113 | maven-assembly-plugin
114 | 3.1.1
115 |
116 |
117 |
118 | jar-with-dependencies
119 |
120 |
121 |
122 |
123 | com.imranur.microservices.comm.pattern.check.App
124 |
125 |
126 |
127 |
128 |
129 |
130 | make-assembly
131 |
132 | package
133 |
134 | single
135 |
136 |
137 |
138 |
139 |
140 | maven-install-plugin
141 | 2.5.2
142 |
143 |
144 | maven-deploy-plugin
145 | 2.8.2
146 |
147 |
148 | org.apache.maven.plugins
149 | maven-dependency-plugin
150 |
151 |
152 | copy-dependencies
153 | prepare-package
154 |
155 | copy-dependencies
156 |
157 |
158 |
159 | ${project.build.directory}/libs
160 |
161 |
162 |
163 |
164 |
165 |
166 | maven-site-plugin
167 | 3.7.1
168 |
169 |
170 | maven-project-info-reports-plugin
171 | 3.0.0
172 |
173 |
174 |
175 |
176 |
177 | org.apache.maven.plugins
178 | maven-compiler-plugin
179 |
180 | 8
181 | 8
182 |
183 |
184 |
185 |
186 |
187 |
--------------------------------------------------------------------------------
/resultGraphs/Spring-petclinic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/Spring-petclinic.png
--------------------------------------------------------------------------------
/resultGraphs/consul-master.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/consul-master.png
--------------------------------------------------------------------------------
/resultGraphs/ecommerce-microservices.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/ecommerce-microservices.png
--------------------------------------------------------------------------------
/resultGraphs/ftgo-application-master.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/ftgo-application-master.png
--------------------------------------------------------------------------------
/resultGraphs/microservice_sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/microservice_sample.png
--------------------------------------------------------------------------------
/resultGraphs/qbike.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/qbike.png
--------------------------------------------------------------------------------
/resultGraphs/springCloudExample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clowee/MicroDepGraph/c0c96272802a62dbeed9970e14565b05735e36a5/resultGraphs/springCloudExample.png
--------------------------------------------------------------------------------
/src/main/java/com/imranur/microservices/comm/pattern/check/App.java:
--------------------------------------------------------------------------------
1 | package com.imranur.microservices.comm.pattern.check;
2 |
3 | import com.fasterxml.jackson.core.JsonGenerator;
4 | import com.fasterxml.jackson.databind.ObjectWriter;
5 | import com.fasterxml.jackson.dataformat.csv.CsvMapper;
6 | import com.fasterxml.jackson.dataformat.csv.CsvSchema;
7 | import com.imranur.microservices.comm.pattern.check.Models.DockerServices;
8 | import com.imranur.microservices.comm.pattern.check.Models.ServiceInterDependency;
9 | import com.imranur.microservices.comm.pattern.check.Models.ServiceInOutDegClass;
10 | import com.imranur.microservices.comm.pattern.check.Models.Services;
11 | import com.imranur.microservices.comm.pattern.check.Utils.DBUtilService;
12 | import com.imranur.microservices.comm.pattern.check.Utils.DockerComposeUtils;
13 | import org.neo4j.graphdb.GraphDatabaseService;
14 | import org.neo4j.graphdb.Transaction;
15 | import org.yaml.snakeyaml.Yaml;
16 | import org.yaml.snakeyaml.constructor.Constructor;
17 | import org.yaml.snakeyaml.representer.Representer;
18 |
19 | import java.io.*;
20 | import java.math.RoundingMode;
21 | import java.nio.file.Files;
22 | import java.nio.file.Path;
23 | import java.nio.file.Paths;
24 | import java.text.DecimalFormat;
25 | import java.text.NumberFormat;
26 | import java.util.*;
27 | import java.util.concurrent.atomic.AtomicInteger;
28 | import java.util.concurrent.atomic.AtomicReference;
29 | import java.util.stream.Collectors;
30 | import java.util.stream.Stream;
31 |
32 | /**
33 | * Microservices dependency/communication pattern checking
34 | */
35 | public class App {
36 | public static void main(String[] args) throws IOException {
37 |
38 | String directory = args[0];
39 | String dbName = args[1];
40 | if (args[0].equals("")) {
41 | System.out.println("no file path given");
42 | System.exit(0);
43 | }
44 | //Scanner scan = new Scanner(System.in);
45 | String fileName1 = "docker-compose.yml";
46 | String fileName2 = "docker-compose.yaml";
47 | //System.out.println("Enter project directory to search ");
48 | //String directory = scan.next();
49 | //String directory = "/home/imran/Thesis_Projects/spring-cloud-microservice-example-master";
50 | // /home/imran/Thesis_Projects/qbike-master
51 | List dockerFile1 = null;
52 | List dockerFile2 = null;
53 |
54 | Properties props = System.getProperties();
55 | props.setProperty("javax.accessibility.assistive_technologies", "");
56 |
57 | dockerFile1 = DockerComposeUtils.find(fileName1, directory);
58 | dockerFile2 = DockerComposeUtils.find(fileName2, directory);
59 |
60 | Representer representer = new Representer();
61 | representer.getPropertyUtils().setSkipMissingProperties(true);
62 | Yaml yaml = new Yaml(new Constructor(DockerServices.class), representer);
63 | DockerServices dockerServices = null;
64 |
65 | if (!dockerFile1.isEmpty()) {
66 | InputStream inputStream = new FileInputStream(new File(dockerFile1.get(0).toString()));
67 | dockerServices = yaml.load(inputStream);
68 | } else if (!dockerFile2.isEmpty()) {
69 | InputStream inputStream = new FileInputStream(new File(dockerFile2.get(0).toString()));
70 | dockerServices = yaml.load(inputStream);
71 | } else {
72 | System.out.println("no docker files found");
73 | System.exit(0);
74 | }
75 |
76 | ArrayList serviceLists = new ArrayList<>();
77 | ArrayList