Skip to content

Commit

Permalink
Improve workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Feb 19, 2022
1 parent b619e3b commit fabbb0b
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,36 @@ import static com.tngtech.archunit.base.DescribedPredicate.alwaysTrue;
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.belongToAnyOf;
import static com.tngtech.archunit.library.Architectures.layeredArchitecture;

<%_
const hasClientLayer = !reactive && (applicationTypeMicroservice || applicationTypeGateway);
const hasDomainLayer = !databaseTypeNo;
_%>
@AnalyzeClasses(packagesOf = <%= mainClass %>.class, importOptions = DoNotIncludeTests.class)
class TechnicalStructureTest {

// prettier-ignore
@ArchTest
static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture()
.layer("Config").definedBy("..config..")
<%_ if (applicationTypeMicroservice) { _%>
<%_ if (hasClientLayer) { _%>
.layer("Client").definedBy("..client..")
<%_ } _%>
.layer("Web").definedBy("..web..")
.optionalLayer("Service").definedBy("..service..")
.layer("Security").definedBy("..security..")
<%_ if (!databaseTypeNo) { _%>
<%_ if (hasDomainLayer) { _%>
.layer("Persistence").definedBy("..repository..")
.layer("Domain").definedBy("..domain..")
<%_ } _%>
.whereLayer("Config").mayNotBeAccessedByAnyLayer()
<%_ if (applicationTypeMicroservice) { _%>
<%_ if (hasClientLayer) { _%>
.whereLayer("Client").mayNotBeAccessedByAnyLayer()
<%_ } _%>
.whereLayer("Web").mayOnlyBeAccessedByLayers("Config")
.whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config")
.whereLayer("Security").mayOnlyBeAccessedByLayers("Config", <% if (applicationTypeMicroservice) { %>"Client", <% } %>"Service", "Web")
<%_ if (!databaseTypeNo) { _%>
.whereLayer("Security").mayOnlyBeAccessedByLayers("Config", <% if (hasClientLayer) { %>"Client", <% } %>"Service", "Web")
<%_ if (hasDomainLayer) { _%>
.whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config")
.whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config")
<%_ } _%>
Expand Down
5 changes: 3 additions & 2 deletions test-integration/jdl-samples/mf-ngx-eureka-jwt/blog-store.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ application {
applicationType gateway
clientFramework angular
authenticationType jwt
prodDatabaseType postgresql
prodDatabaseType mysql
testFrameworks [cypress]
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
Expand All @@ -22,6 +22,7 @@ application {
application {
config {
baseName blog
reactive true
packageName com.okta.developer.blog
applicationType microservice
clientFramework angular
Expand All @@ -42,7 +43,7 @@ application {
applicationType microservice
clientFramework angular
authenticationType jwt
prodDatabaseType postgresql
prodDatabaseType mariadb
serverPort 8082
testFrameworks [cypress]
creationTimestamp 1617901618888
Expand Down
57 changes: 46 additions & 11 deletions test-integration/jdl-samples/ms-ngx-eureka-oauth2/blog-store.jdl
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@

/*
* This is a microservice blog sample with Gateway and two microservice applications
* This uses JHipster registry for service discovery and OIDC authentication
* This is a microservice stack sample to test compilation
* - buildTool: maven
* - serviceDiscovery: eureka
* - authenticationType: oauth2
* - databaseType: sql (ms), mongodb (gateway)
* - prodDatabaseType: postgresql, mysql, mariadb
* - enableHibernateCache: true
* - cacheProvider: ehcache, hazelcast, caffeine
*/

application {
config {
baseName gateway
packageName com.okta.developer.gateway
applicationType gateway
authenticationType oauth2
prodDatabaseType postgresql
baseName gateway
packageName com.okta.developer.gateway
databaseType mongodb
testFrameworks [cypress]
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities Blog, Post, Tag, Product
entities UserData, Blog, Post, Tag, Product
}

application {
Expand All @@ -25,7 +30,7 @@ application {
applicationType microservice
authenticationType oauth2
prodDatabaseType postgresql
searchEngine elasticsearch
cacheProvider ehcache
serverPort 8081
creationTimestamp 1617901618887
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
Expand All @@ -39,15 +44,35 @@ application {
packageName com.okta.developer.store
applicationType microservice
authenticationType oauth2
prodDatabaseType postgresql
enableHibernateCache false
prodDatabaseType mysql
cacheProvider hazelcast
serverPort 8082
creationTimestamp 1617901618888
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities Product
}

application {
config {
baseName notification,
packageName com.okta.developer.notification
applicationType microservice
authenticationType oauth2
prodDatabaseType mariadb
cacheProvider caffeine
serverPort 8083
creationTimestamp 1617901618889
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities Notification
}

@ChangelogDate(20210408164809)
entity UserData {
address String
}

@ChangelogDate(20210408164810)
entity Blog {
name String required minlength(3)
Expand All @@ -71,6 +96,15 @@ entity Product {
image ImageBlob
}

@ChangelogDate(20210408164814)
entity Notification {
title String required
}

relationship OneToOne {
@Id UserData{user(login)} to User
}

relationship ManyToOne {
Post{blog(name)} to Blog
}
Expand All @@ -84,10 +118,11 @@ paginate Product with pagination

microservice Product with store
microservice Blog, Post, Tag with blog
microservice Notification with notification

deployment {
deploymentType docker-compose,
appsFolders [store, blog, gateway]
appsFolders [gateway, store, blog, notification]
dockerRepositoryName "hipsterslabs"
monitoring no
serviceDiscoveryType eureka
Expand Down
65 changes: 53 additions & 12 deletions test-integration/jdl-samples/ms-react-jwt-consul/blog-store.jdl
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@

/*
* This is a microservice blog sample with Gateway and two microservice applications
* This uses JHipster registry for service discovery and OIDC authentication
* This is a microservice stack sample to test compilation
* - buildTool: gradle
* - serviceDiscovery: consul
* - authenticationType: jwt
* - databaseType: sql (ms), mongodb (gateway)
* - prodDatabaseType: postgresql, mysql, mariadb
* - enableHibernateCache: false
* - cacheProvider: infinispan, memcached, redis
*/

application {
config {
baseName gateway
packageName com.okta.developer.gateway
applicationType gateway
clientFramework react
authenticationType jwt
prodDatabaseType postgresql
baseName gateway
buildTool gradle
clientFramework react
enableHibernateCache false
packageName com.okta.developer.gateway
databaseType mongodb
serviceDiscoveryType consul
testFrameworks [cypress]
creationTimestamp 1617901618886
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities Blog, Post, Tag, Product
entities UserData, Blog, Post, Tag, Product
}

application {
Expand All @@ -27,8 +34,9 @@ application {
applicationType microservice
authenticationType jwt
prodDatabaseType postgresql
cacheProvider infinispan
serviceDiscoveryType consul
searchEngine elasticsearch
enableHibernateCache false
serverPort 8081
creationTimestamp 1617901618887
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
Expand All @@ -42,7 +50,8 @@ application {
packageName com.okta.developer.store
applicationType microservice
authenticationType jwt
prodDatabaseType postgresql
prodDatabaseType mysql
cacheProvider memcached
serviceDiscoveryType consul
enableHibernateCache false
serverPort 8082
Expand All @@ -52,6 +61,28 @@ application {
entities Product
}

application {
config {
baseName notification,
packageName com.okta.developer.notification
applicationType microservice
authenticationType jwt
prodDatabaseType mariadb
cacheProvider redis
serviceDiscoveryType consul
enableHibernateCache false
serverPort 8083
creationTimestamp 1617901618889
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
}
entities Notification
}

@ChangelogDate(20210408164809)
entity UserData {
address String
}

@ChangelogDate(20210408164810)
entity Blog {
name String required minlength(3)
Expand All @@ -75,6 +106,15 @@ entity Product {
image ImageBlob
}

@ChangelogDate(20210408164814)
entity Notification {
title String required
}

relationship OneToOne {
@Id UserData{user(login)} to User
}

relationship ManyToOne {
Post{blog(name)} to Blog
}
Expand All @@ -88,11 +128,12 @@ paginate Product with pagination

microservice Product with store
microservice Blog, Post, Tag with blog
microservice Notification with notification
service all with serviceImpl

deployment {
deploymentType docker-compose,
appsFolders [store, blog, gateway]
appsFolders [gateway, store, blog, notification]
dockerRepositoryName "hipsterslabs"
monitoring no
serviceDiscoveryType consul
Expand Down

0 comments on commit fabbb0b

Please sign in to comment.