Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and visualize release path for particular microservice #57 #64

Merged
merged 8 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion microcatalog.jdl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Core entities

entity Team {
name String required,
teamLead String required,
Expand All @@ -23,10 +25,10 @@ entity Dependency {
description TextBlob
}


relationship ManyToOne {
Microservice{team required} to Team
Microservice{status required} to Status
Dependency{source required} to Microservice
Dependency{target required} to Microservice
}

14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
<jgrapht.version>1.5.0</jgrapht.version>
<jacoco.utReportFolder>${project.build.directory}/jacoco/test</jacoco.utReportFolder>
<jacoco.utReportFile>${jacoco.utReportFolder}/test.exec</jacoco.utReportFile>
<jacoco.itReportFolder>${project.build.directory}/jacoco/integrationTest</jacoco.itReportFolder>
Expand All @@ -102,6 +103,11 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>${jgrapht.version}</version>
</dependency>
<dependency>
<groupId>io.github.jhipster</groupId>
<artifactId>jhipster-framework</artifactId>
Expand Down Expand Up @@ -1172,13 +1178,17 @@
<artifactId>liquibase-maven-plugin</artifactId>
<configuration combine.self="override">
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<diffChangeLogFile>
src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
</diffChangeLogFile>
<driver></driver>
<url>${env.JDBC_DATABASE_URL}</url>
<defaultSchemaName></defaultSchemaName>
<username>${env.JDBC_DATABASE_USERNAME}</username>
<password>${env.JDBC_DATABASE_PASSWORD}</password>
<referenceUrl>hibernate:spring:com.github.microcatalog.domain?dialect=io.github.jhipster.domain.util.FixedPostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<referenceUrl>
hibernate:spring:com.github.microcatalog.domain?dialect=io.github.jhipster.domain.util.FixedPostgreSQL10Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.time.Duration;

import com.github.microcatalog.domain.custom.ReleaseGroup;
import com.github.microcatalog.domain.custom.ReleasePath;
import com.github.microcatalog.domain.custom.ReleaseStep;
import org.ehcache.config.builders.*;
import org.ehcache.jsr107.Eh107Configuration;

Expand Down Expand Up @@ -52,6 +55,11 @@ public JCacheManagerCustomizer cacheManagerCustomizer() {
createCache(cm, com.github.microcatalog.domain.Team.class.getName());
createCache(cm, com.github.microcatalog.domain.Status.class.getName());
createCache(cm, com.github.microcatalog.domain.Dependency.class.getName());
createCache(cm, ReleaseStep.class.getName());
createCache(cm, ReleaseGroup.class.getName());
createCache(cm, ReleaseGroup.class.getName() + ".steps");
createCache(cm, ReleasePath.class.getName());
createCache(cm, ReleasePath.class.getName() + ".groups");
// jhipster-needle-ehcache-add-entry
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Microservice implements Serializable {
@Column(name = "name", nullable = false)
private String name;


@Lob
@Type(type = "org.hibernate.type.TextType")
@Column(name = "description", nullable = false)
Expand Down Expand Up @@ -188,7 +188,11 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return 31;
if (id == null) {
return 31;
}

return id.intValue();
}

// prettier-ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.github.microcatalog.domain.custom;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import java.util.HashSet;
import java.util.Set;

/**
* A ReleaseGroup.
*/
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ReleaseGroup {
private Set<ReleaseStep> steps = new HashSet<>();

public Set<ReleaseStep> getSteps() {
return steps;
}

public ReleaseGroup steps(Set<ReleaseStep> releaseSteps) {
this.steps = releaseSteps;
return this;
}

public ReleaseGroup addSteps(ReleaseStep releaseStep) {
this.steps.add(releaseStep);
return this;
}

public ReleaseGroup removeSteps(ReleaseStep releaseStep) {
this.steps.remove(releaseStep);
return this;
}

public void setSteps(Set<ReleaseStep> releaseSteps) {
this.steps = releaseSteps;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.github.microcatalog.domain.custom;

import com.github.microcatalog.domain.Microservice;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

/**
* A ReleasePath.
*/
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ReleasePath {
private Instant createdOn;
private List<ReleaseGroup> groups = new ArrayList<>();
private Microservice target;

public Instant getCreatedOn() {
return createdOn;
}

public ReleasePath createdOn(Instant createdOn) {
this.createdOn = createdOn;
return this;
}

public void setCreatedOn(Instant createdOn) {
this.createdOn = createdOn;
}

public List<ReleaseGroup> getGroups() {
return groups;
}

public ReleasePath groups(List<ReleaseGroup> releaseGroups) {
this.groups = releaseGroups;
return this;
}

public ReleasePath addGroups(ReleaseGroup releaseGroup) {
this.groups.add(releaseGroup);
return this;
}

public ReleasePath removeGroups(ReleaseGroup releaseGroup) {
this.groups.remove(releaseGroup);
return this;
}

public void setGroups(List<ReleaseGroup> releaseGroups) {
this.groups = releaseGroups;
}

public Microservice getTarget() {
return target;
}

public ReleasePath target(Microservice microservice) {
this.target = microservice;
return this;
}

public void setTarget(Microservice microservice) {
this.target = microservice;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.github.microcatalog.domain.custom;

import com.github.microcatalog.domain.Microservice;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import java.util.List;

/**
* A ReleaseStep.
*/
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ReleaseStep {
private Microservice workItem;
private List<Microservice> parentWorkItems;

public Microservice getWorkItem() {
return workItem;
}

public ReleaseStep workItem(Microservice microservice) {
this.workItem = microservice;
return this;
}

public void setWorkItem(Microservice microservice) {
this.workItem = microservice;
}

public List<Microservice> getParentWorkItems() {
return parentWorkItems;
}

public ReleaseStep parentWorkItems(List<Microservice> microservices) {
this.parentWorkItems = microservices;
return this;
}

public void setParentWorkItems(List<Microservice> parentWorkItems) {
this.parentWorkItems = parentWorkItems;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.github.microcatalog.repository;

import com.github.microcatalog.domain.Dependency;

import org.springframework.data.jpa.repository.*;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
Expand Down
Loading