Skip to content

Commit

Permalink
Add service type
Browse files Browse the repository at this point in the history
  • Loading branch information
aint committed Mar 16, 2019
1 parent e7c18b1 commit 981ba69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/github/aint/octopus/DependencyJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
public class DependencyJson {

private EventType eventType;

private String serviceName;

private String serviceType;
private String serviceMetadata;

private Map<DependencyType, Set<String>> dependencies;

public enum EventType {
Expand All @@ -30,4 +28,5 @@ public enum DependencyType {
SERVICES, LAMBDAS, DATABASES, THIRD_PARTY
}

// DependencyType => EntityType
}
4 changes: 2 additions & 2 deletions src/main/java/com/github/aint/octopus/OctopusService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public DependencyJson createEvent() {
springAppMetadata.getJavaVersion(),
springAppMetadata.getSpringVersion(),
springAppMetadata.isCachingEnabled() ? "| :cache:" : "");
return new DependencyJson(DependencyJson.EventType.CREATE, appName, appMetadata, deps);
return new DependencyJson(DependencyJson.EventType.CREATE, appName, "svc", appMetadata, deps);
}

public DependencyJson destroyEvent() {
String appName = springAppMetadata.getApplicationName();
return new DependencyJson(DependencyJson.EventType.DELETE, appName, null, null);
return new DependencyJson(DependencyJson.EventType.DELETE, appName, null, null, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ApplicationListenerBeanTest extends Specification {
def dependencyJson = DependencyJson.builder()
.eventType(DependencyJson.EventType.CREATE)
.serviceName("devaron")
.serviceType("svc")
.serviceMetadata("Java 11, Spring 5")
.build()
octopusService.createEvent() >> dependencyJson
Expand All @@ -69,6 +70,7 @@ class ApplicationListenerBeanTest extends Specification {
{
"eventType": "${dependencyJson.eventType.name()}",
"serviceName": "${dependencyJson.serviceName}",
"serviceType": "${dependencyJson.serviceType}",
"serviceMetadata": "${dependencyJson.serviceMetadata}",
"dependencies": null
}
Expand All @@ -88,6 +90,7 @@ class ApplicationListenerBeanTest extends Specification {
def dependencyJson = DependencyJson.builder()
.eventType(DependencyJson.EventType.DELETE)
.serviceName("devaron")
.serviceType("svc")
.serviceMetadata("Java 11, Spring 5")
.build()
octopusService.destroyEvent() >> dependencyJson
Expand All @@ -106,6 +109,7 @@ class ApplicationListenerBeanTest extends Specification {
{
"eventType": "${dependencyJson.eventType.name()}",
"serviceName": "${dependencyJson.serviceName}",
"serviceType": "${dependencyJson.serviceType}",
"serviceMetadata": "${dependencyJson.serviceMetadata}",
"dependencies": null
}
Expand Down

0 comments on commit 981ba69

Please sign in to comment.