Merge remote-tracking branch 'origin/spike/ATN+HST'
# Conflicts: # .gitignore # TODO.md # tools/todo-progress # tools/todo-progress.gnuplot
This commit is contained in:
commit
9945eddf7a
9
.aliases
Normal file
9
.aliases
Normal file
@ -0,0 +1,9 @@
|
||||
alias gw='./gradlew'
|
||||
alias pg-sql-run='docker run --name hsadmin-ng-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:13.7-bullseye'
|
||||
alias pg-sql-stop='docker stop hsadmin-ng-postgres'
|
||||
alias pg-sql-start='docker container start hsadmin-ng-postgres'
|
||||
alias pg-sql-remove='docker rm hsadmin-ng-postgres'
|
||||
alias pg-sql-reset='pg-sql-stop; pg-sql-remove; pg-sql-run'
|
||||
alias pg-sql-backup='docker exec -i hsadmin-ng-postgres /usr/bin/pg_dump --clean --create -U postgres postgres | gzip -9'
|
||||
alias pg-sql-restore='gunzip --stdout | docker exec -i hsadmin-ng-postgres psql -U postgres -d postgres'
|
||||
|
@ -18,7 +18,3 @@ insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[package.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
@ -1,61 +0,0 @@
|
||||
{
|
||||
"name": "Asset",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "documentDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "valueDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "action",
|
||||
"fieldType": "AssetAction",
|
||||
"fieldValues": "PAYMENT,HANDOVER,ADOPTION,LOSS,CLEARING,PAYBACK",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "amount",
|
||||
"fieldType": "BigDecimal",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "asset",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "membership",
|
||||
"otherEntityField": "admissionDocumentDate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105335",
|
||||
"entityTableName": "asset",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
{
|
||||
"name": "Customer",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "reference",
|
||||
"fieldType": "Integer",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"unique",
|
||||
"min",
|
||||
"max"
|
||||
],
|
||||
"fieldValidateRulesMin": 10000,
|
||||
"fieldValidateRulesMax": 99999
|
||||
},
|
||||
{
|
||||
"fieldName": "prefix",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength",
|
||||
"unique",
|
||||
"pattern"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 3,
|
||||
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
|
||||
},
|
||||
{
|
||||
"fieldName": "name",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "kind",
|
||||
"fieldType": "CustomerKind",
|
||||
"fieldValues": "NATURAL,LEGAL",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "birthDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "birthPlace",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "registrationCourt",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "registrationNumber",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "vatRegion",
|
||||
"fieldType": "VatRegion",
|
||||
"fieldValues": "DOMESTIC,EU,OTHER",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "vatNumber",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 40
|
||||
},
|
||||
{
|
||||
"fieldName": "contractualSalutation",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "contractualAddress",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 400
|
||||
},
|
||||
{
|
||||
"fieldName": "billingSalutation",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 80
|
||||
},
|
||||
{
|
||||
"fieldName": "billingAddress",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 400
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "customer",
|
||||
"relationshipName": "membership"
|
||||
},
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "sepaMandate",
|
||||
"otherEntityRelationshipName": "customer",
|
||||
"relationshipName": "sepamandate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105332",
|
||||
"entityTableName": "customer",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
{
|
||||
"name": "Membership",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "admissionDocumentDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "cancellationDocumentDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "memberFromDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "memberUntilDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "share",
|
||||
"otherEntityRelationshipName": "membership",
|
||||
"relationshipName": "share"
|
||||
},
|
||||
{
|
||||
"relationshipType": "one-to-many",
|
||||
"otherEntityName": "asset",
|
||||
"otherEntityRelationshipName": "membership",
|
||||
"relationshipName": "asset"
|
||||
},
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "customer",
|
||||
"otherEntityRelationshipName": "membership",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "customer",
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105333",
|
||||
"entityTableName": "membership",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
{
|
||||
"name": "SepaMandate",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "reference",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength",
|
||||
"unique",
|
||||
"required"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 40
|
||||
},
|
||||
{
|
||||
"fieldName": "iban",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 34
|
||||
},
|
||||
{
|
||||
"fieldName": "bic",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 11
|
||||
},
|
||||
{
|
||||
"fieldName": "grantingDocumentDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "revokationDocumentDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "validFromDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "validUntilDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "lastUsedDate",
|
||||
"fieldType": "LocalDate"
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "customer",
|
||||
"otherEntityRelationshipName": "sepamandate",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "customer",
|
||||
"otherEntityField": "prefix"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105336",
|
||||
"entityTableName": "sepa_mandate",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
{
|
||||
"name": "Share",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "documentDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "valueDate",
|
||||
"fieldType": "LocalDate",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "action",
|
||||
"fieldType": "ShareAction",
|
||||
"fieldValues": "SUBSCRIPTION,CANCELLATION",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "quantity",
|
||||
"fieldType": "Integer",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "remark",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 160
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "membership",
|
||||
"otherEntityRelationshipName": "share",
|
||||
"relationshipValidateRules": "required",
|
||||
"relationshipName": "membership",
|
||||
"otherEntityField": "admissionDocumentDate"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105334",
|
||||
"entityTableName": "share",
|
||||
"dto": "mapstruct",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "UserRoleAssignment",
|
||||
"fields": [
|
||||
{
|
||||
"fieldName": "entityTypeId",
|
||||
"fieldType": "String",
|
||||
"fieldValidateRules": [
|
||||
"required",
|
||||
"maxlength"
|
||||
],
|
||||
"fieldValidateRulesMaxlength": 32
|
||||
},
|
||||
{
|
||||
"fieldName": "entityObjectId",
|
||||
"fieldType": "Long",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
},
|
||||
{
|
||||
"fieldName": "assignedRole",
|
||||
"fieldType": "UserRole",
|
||||
"fieldValues": "HOSTMASTER,ADMIN,SUPPORTER,CONTRACTUAL_CONTACT,FINANCIAL_CONTACT,TECHNICAL_CONTACT,CUSTOMER_USER",
|
||||
"fieldValidateRules": [
|
||||
"required"
|
||||
]
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relationshipType": "many-to-one",
|
||||
"otherEntityName": "user",
|
||||
"otherEntityRelationshipName": "required",
|
||||
"relationshipName": "user",
|
||||
"otherEntityField": "login"
|
||||
}
|
||||
],
|
||||
"changelogDate": "20190507105342",
|
||||
"entityTableName": "user_role_assignment",
|
||||
"dto": "no",
|
||||
"pagination": "infinite-scroll",
|
||||
"service": "serviceClass",
|
||||
"jpaMetamodelFiltering": true,
|
||||
"fluentMethods": true,
|
||||
"clientRootFolder": "",
|
||||
"applications": "*"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
target
|
||||
package-lock.json
|
12
.prettierrc
12
.prettierrc
@ -1,12 +0,0 @@
|
||||
# Prettier configuration
|
||||
|
||||
printWidth: 140
|
||||
singleQuote: true
|
||||
tabWidth: 4
|
||||
useTabs: false
|
||||
|
||||
# js and ts rules:
|
||||
arrowParens: avoid
|
||||
|
||||
# jsx and tsx rules:
|
||||
jsxBracketSameLine: false
|
8
.run/00-util.sql.run.xml
Normal file
8
.run/00-util.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="00-util.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/00-util.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/10-rbac-base.sql.run.xml
Normal file
8
.run/10-rbac-base.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="10-rbac-base.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/10-rbac-base.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/12-rbac-role-builder.sql.run.xml
Normal file
8
.run/12-rbac-role-builder.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="12-rbac-role-builder.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/12-rbac-role-builder.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/18--rbac-all.sql.run.xml
Normal file
8
.run/18--rbac-all.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="18--rbac-all.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/18--rbac-all.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/20-hs-base.sql.run.xml
Normal file
8
.run/20-hs-base.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="20-hs-base.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/20-hs-base.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/21-hs-customer.sql.run.xml
Normal file
8
.run/21-hs-customer.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="21-hs-customer.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/21-hs-customer.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/22-hs-packages.sql.run.xml
Normal file
8
.run/22-hs-packages.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="22-hs-packages.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/22-hs-packages.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/23-hs-unixuser.sql.run.xml
Normal file
8
.run/23-hs-unixuser.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="23-hs-unixuser.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/23-hs-unixuser.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/24-hs-domain.sql.run.xml
Normal file
8
.run/24-hs-domain.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="24-hs-domain.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/24-hs-domain.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/25-hs-emailaddress.sql.run.xml
Normal file
8
.run/25-hs-emailaddress.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="25-hs-emailaddress.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/25-hs-emailaddress.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
8
.run/29-hs-statistics.sql.run.xml
Normal file
8
.run/29-hs-statistics.sql.run.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="29-hs-statistics.sql" type="DatabaseScript" editBeforeRun="true" nameIsGenerated="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/29-hs-statistics.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
18
.run/run all up to emailaddresses.run.xml
Normal file
18
.run/run all up to emailaddresses.run.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="run all up to statistics" type="DatabaseScript" editBeforeRun="true">
|
||||
<script-file value="$PROJECT_DIR$/sql/00-util.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/10-rbac-base.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/12-rbac-role-builder.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/18-rbac-statistics.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/20-hs-base.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/21-hs-customer.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/22-hs-packages.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/23-hs-unixuser.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/24-hs-domain.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/25-hs-emailaddress.sql" />
|
||||
<script-file value="$PROJECT_DIR$/sql/29-hs-statistics.sql" />
|
||||
<script-mode>FILE</script-mode>
|
||||
<data-source id="58980aaf-09d7-4782-a6fa-859aa1fc3986" namespace="database/"postgres"/schema/"public"" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
38
.yo-rc.json
38
.yo-rc.json
@ -1,38 +0,0 @@
|
||||
{
|
||||
"generator-jhipster": {
|
||||
"promptValues": {
|
||||
"packageName": "org.hostsharing.hsadminng",
|
||||
"nativeLanguage": "de"
|
||||
},
|
||||
"jhipsterVersion": "5.8.2",
|
||||
"applicationType": "monolith",
|
||||
"baseName": "hsadminNg",
|
||||
"packageName": "org.hostsharing.hsadminng",
|
||||
"packageFolder": "org/hostsharing/hsadminng",
|
||||
"serverPort": "8080",
|
||||
"authenticationType": "jwt",
|
||||
"cacheProvider": "ehcache",
|
||||
"enableHibernateCache": false,
|
||||
"websocket": false,
|
||||
"databaseType": "sql",
|
||||
"devDatabaseType": "h2Memory",
|
||||
"prodDatabaseType": "postgresql",
|
||||
"searchEngine": false,
|
||||
"messageBroker": false,
|
||||
"serviceDiscoveryType": false,
|
||||
"buildTool": "gradle",
|
||||
"enableSwaggerCodegen": true,
|
||||
"jwtSecretKey": "ZDFlMDUzODIzMTUzZDEwZjExN2E5ZjAzY2VhZmYzNDE1YjhlYWUxZGRhMGU3ODZiNjRkNjVlNzEwZjExYWY4YzczM2NlYzI5YWE1OTRkNWM0YThlYjZjZjA5Zjc5YWJkOTgzYjdhZjQxZWQyZGUyYjFlYjI5ZDE3NmE4M2UzYjQ=",
|
||||
"clientFramework": "angularX",
|
||||
"useSass": false,
|
||||
"clientPackageManager": "npm",
|
||||
"testFrameworks": ["cucumber"],
|
||||
"jhiPrefix": "jhi",
|
||||
"entitySuffix": "",
|
||||
"dtoSuffix": "DTO",
|
||||
"otherModules": [],
|
||||
"enableTranslation": true,
|
||||
"nativeLanguage": "de",
|
||||
"languages": ["de", "en"]
|
||||
}
|
||||
}
|
196
JHIPSTER.md
196
JHIPSTER.md
@ -1,196 +0,0 @@
|
||||
# hsadminNg
|
||||
|
||||
This application was generated using JHipster 5.8.2, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v5.8.2](https://www.jhipster.tech/documentation-archive/v5.8.2).
|
||||
|
||||
## Development
|
||||
|
||||
Before you can build this project, you must install and configure the following dependencies on your machine:
|
||||
|
||||
1. [Node.js][]: We use Node to run a development web server and build the project.
|
||||
Depending on your system, you can install Node either from source or as a pre-packaged bundle.
|
||||
|
||||
After installing Node, you should be able to run the following command to install development tools.
|
||||
You will only need to run this command when dependencies change in [package.json](package.json).
|
||||
|
||||
npm install
|
||||
|
||||
We use npm scripts and [Webpack][] as our build system.
|
||||
|
||||
Run the following commands in two separate terminals to create a blissful development experience where your browser
|
||||
auto-refreshes when files change on your hard drive.
|
||||
|
||||
./gradlew
|
||||
npm start
|
||||
|
||||
Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by
|
||||
specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies.
|
||||
Add the `help` flag on any command to see how you can use it. For example, `npm help update`.
|
||||
|
||||
The `npm run` command will list all of the scripts available to run for this project.
|
||||
|
||||
### Service workers
|
||||
|
||||
Service workers are commented by default, to enable them please uncomment the following code.
|
||||
|
||||
- The service worker registering script in index.html
|
||||
|
||||
```html
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('./service-worker.js').then(function() {
|
||||
console.log('Service Worker Registered');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Note: workbox creates the respective service worker and dynamically generate the `service-worker.js`
|
||||
|
||||
### Managing dependencies
|
||||
|
||||
For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command:
|
||||
|
||||
npm install --save --save-exact leaflet
|
||||
|
||||
To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command:
|
||||
|
||||
npm install --save-dev --save-exact @types/leaflet
|
||||
|
||||
Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them:
|
||||
Edit [src/main/webapp/app/vendor.ts](src/main/webapp/app/vendor.ts) file:
|
||||
|
||||
```
|
||||
import 'leaflet/dist/leaflet.js';
|
||||
```
|
||||
|
||||
Edit [src/main/webapp/content/css/vendor.css](src/main/webapp/content/css/vendor.css) file:
|
||||
|
||||
```
|
||||
@import '~leaflet/dist/leaflet.css';
|
||||
```
|
||||
|
||||
Note: there are still few other things remaining to do for Leaflet that we won't detail here.
|
||||
|
||||
For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].
|
||||
|
||||
### Using angular-cli
|
||||
|
||||
You can also use [Angular CLI][] to generate some custom client code.
|
||||
|
||||
For example, the following command:
|
||||
|
||||
ng generate component my-component
|
||||
|
||||
will generate few files:
|
||||
|
||||
create src/main/webapp/app/my-component/my-component.component.html
|
||||
create src/main/webapp/app/my-component/my-component.component.ts
|
||||
update src/main/webapp/app/app.module.ts
|
||||
|
||||
### Doing API-First development using openapi-generator
|
||||
|
||||
[OpenAPI-Generator]() is configured for this application. You can generate API code from the `src/main/resources/swagger/api.yml` definition file by running:
|
||||
|
||||
```bash
|
||||
./gradlew openApiGenerate
|
||||
```
|
||||
|
||||
Then implements the generated delegate classes with `@Service` classes.
|
||||
|
||||
To edit the `api.yml` definition file, you can use a tool such as [Swagger-Editor](). Start a local instance of the swagger-editor using docker by running: `docker-compose -f src/main/docker/swagger-editor.yml up -d`. The editor will then be reachable at [http://localhost:7742](http://localhost:7742).
|
||||
|
||||
Refer to [Doing API-First development][] for more details.
|
||||
|
||||
## Building for production
|
||||
|
||||
To optimize the hsadminNg application for production, run:
|
||||
|
||||
./gradlew -Pprod clean bootWar
|
||||
|
||||
This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files.
|
||||
To ensure everything worked, run:
|
||||
|
||||
java -jar build/libs/*.war
|
||||
|
||||
Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
|
||||
|
||||
Refer to [Using JHipster in production][] for more details.
|
||||
|
||||
## Testing
|
||||
|
||||
To launch your application's tests, run:
|
||||
|
||||
./gradlew test
|
||||
|
||||
### Client tests
|
||||
|
||||
Unit tests are run by [Jest][] and written with [Jasmine][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with:
|
||||
|
||||
npm test
|
||||
|
||||
For more information, refer to the [Running tests page][].
|
||||
|
||||
### Code quality
|
||||
|
||||
Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:
|
||||
|
||||
```
|
||||
docker-compose -f src/main/docker/sonar.yml up -d
|
||||
```
|
||||
|
||||
Then, run a Sonar analysis:
|
||||
|
||||
```
|
||||
./gradlew -Pprod clean test sonarqube
|
||||
```
|
||||
|
||||
For more information, refer to the [Code quality page][].
|
||||
|
||||
## Using Docker to simplify development (optional)
|
||||
|
||||
You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services.
|
||||
|
||||
For example, to start a postgresql database in a docker container, run:
|
||||
|
||||
docker-compose -f src/main/docker/postgresql.yml up -d
|
||||
|
||||
To stop it and remove the container, run:
|
||||
|
||||
docker-compose -f src/main/docker/postgresql.yml down
|
||||
|
||||
You can also fully dockerize your application and all the services that it depends on.
|
||||
To achieve this, first build a docker image of your app by running:
|
||||
|
||||
./gradlew bootWar -Pprod jibDockerBuild
|
||||
|
||||
Then run:
|
||||
|
||||
docker-compose -f src/main/docker/app.yml up -d
|
||||
|
||||
For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications.
|
||||
|
||||
## Continuous Integration (optional)
|
||||
|
||||
To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.
|
||||
|
||||
[jhipster homepage and latest documentation]: https://www.jhipster.tech
|
||||
[jhipster 5.8.2 archive]: https://www.jhipster.tech/documentation-archive/v5.8.2
|
||||
[using jhipster in development]: https://www.jhipster.tech/documentation-archive/v5.8.2/development/
|
||||
[using docker and docker-compose]: https://www.jhipster.tech/documentation-archive/v5.8.2/docker-compose
|
||||
[using jhipster in production]: https://www.jhipster.tech/documentation-archive/v5.8.2/production/
|
||||
[running tests page]: https://www.jhipster.tech/documentation-archive/v5.8.2/running-tests/
|
||||
[code quality page]: https://www.jhipster.tech/documentation-archive/v5.8.2/code-quality/
|
||||
[setting up continuous integration]: https://www.jhipster.tech/documentation-archive/v5.8.2/setting-up-ci/
|
||||
[node.js]: https://nodejs.org/
|
||||
[yarn]: https://yarnpkg.org/
|
||||
[webpack]: https://webpack.github.io/
|
||||
[angular cli]: https://cli.angular.io/
|
||||
[browsersync]: http://www.browsersync.io/
|
||||
[jest]: https://facebook.github.io/jest/
|
||||
[jasmine]: http://jasmine.github.io/2.0/introduction.html
|
||||
[protractor]: https://angular.github.io/protractor/
|
||||
[leaflet]: http://leafletjs.com/
|
||||
[definitelytyped]: http://definitelytyped.org/
|
||||
[openapi-generator]: https://openapi-generator.tech
|
||||
[swagger-editor]: http://editor.swagger.io
|
||||
[doing api-first development]: https://www.jhipster.tech/documentation-archive/v5.8.2/doing-api-first-development/
|
57
Jenkinsfile
vendored
57
Jenkinsfile
vendored
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
node {
|
||||
withEnv(["PATH=$HOME/bin:$PATH"]) {
|
||||
stage('checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('check java') {
|
||||
sh "java -version"
|
||||
}
|
||||
|
||||
stage('clean+spotless') {
|
||||
sh "chmod +x gradlew"
|
||||
sh "./gradlew clean spotlessCheck --no-daemon"
|
||||
}
|
||||
|
||||
stage('npm install') {
|
||||
sh "./gradlew npm_install -PnodeInstall --no-daemon"
|
||||
}
|
||||
|
||||
stage('backend tests') {
|
||||
try {
|
||||
sh "./gradlew test -PnodeInstall --no-daemon"
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
junit '**/build/**/TEST-*.xml'
|
||||
}
|
||||
}
|
||||
|
||||
stage('backend check') {
|
||||
try {
|
||||
sh "./gradlew check -PnodeInstall --no-daemon"
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
archiveArtifacts artifacts: '**/build/reports/jacoco/test/html/', fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('frontend tests') {
|
||||
try {
|
||||
sh "./gradlew npm_run_test -PnodeInstall --no-daemon"
|
||||
} catch (err) {
|
||||
throw err
|
||||
} finally {
|
||||
junit '**/build/test-results/TESTS-*.xml'
|
||||
}
|
||||
}
|
||||
|
||||
stage('packaging') {
|
||||
sh "./gradlew bootWar -x test -Pprod -PnodeInstall --no-daemon"
|
||||
archiveArtifacts artifacts: '**/build/libs/*.war', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
26
LICENSE.md
Normal file
26
LICENSE.md
Normal file
@ -0,0 +1,26 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright ©2022 Michael Hönnig
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
454
README.md
454
README.md
@ -1,350 +1,332 @@
|
||||
# hsadminNg Development
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
This documents gives an overview of the development environment and tools.
|
||||
For architecture consider the files in the `doc` and `adr` folder.
|
||||
|
||||
- [Setting up the Development Environment](#setting-up-the-development-environment)
|
||||
- [Frequent Tasks](#frequent-tasks)
|
||||
- [Building the Application with Test Execution](#building-the-application-with-test-execution)
|
||||
- [Starting the Application](#starting-the-application)
|
||||
- [Running JUnit tests with branch coverage](#running-junit-tests-with-branch-coverage)
|
||||
- [HOWTO Commits](#howto-commits)
|
||||
- [Creating HOWTO Commits](#creating-howto-commits)
|
||||
- [Special Build Tasks](#special-build-tasks)
|
||||
- [Spotless Formatting](#spotless-formatting)
|
||||
- [Mutation Testing PiTest](#mutation-testing-pitest)
|
||||
- [Git Workflow for JHipster Generator](#git-workflow-for-jhipster-generator)
|
||||
- [Generating the Table of Contents for Markdown](#generating-the-table-of-contents-for-markdown)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- generated TOC begin: -->
|
||||
- [Setting up the Development Environment](#setting-up-the-development-environment)
|
||||
- [SDKMAN](#sdkman)
|
||||
- [PostgreSQL Server](#postgresql-server)
|
||||
- [Markdown](#markdown)
|
||||
- [Render Markdown embedded PlantUML](#render-markdown-embedded-plantuml)
|
||||
- [Other Tools](#other-tools)
|
||||
- [Running the SQL files](#running-the-sql-files)
|
||||
- [For RBAC](#for-rbac)
|
||||
- [For Historization](#for-historization)
|
||||
<!-- generated TOC end. -->
|
||||
|
||||
## Setting up the Development Environment
|
||||
|
||||
You'll often need to execute `./gradlew`, therefore we suggest to define this alias:
|
||||
All instructions assume that you're using a current _Linux_ or _MacOS_ operating system.
|
||||
Everything is tested on _Ubuntu Linux 22.04_ and _MacOS Monterey (12.4)_.
|
||||
|
||||
alias gw='./gradlew'
|
||||
To be able to build and run the Java Spring Boot application, you need the following tools:
|
||||
|
||||
TODO: Instructions for setting up the dev environment from scratch.
|
||||
- Docker 20.x (on MacOS you also need *Docker Desktop* or similar)
|
||||
- PostgreSQL Server 13.7-bullseye (see instructions below to install and run in Docker)
|
||||
- Java JDK 17.x
|
||||
- Gradle in some not too outdated version (7.4 will be installed via wrapper)
|
||||
|
||||
## Frequent Tasks
|
||||
You also might need an IDE (e.g. *IntelliJ IDEA* or *Eclipse* or *VS Code* with *[STS](https://spring.io/tools)* and a GUI Frontend for *PostgreSQL* like *Postbird*.
|
||||
|
||||
### Building the Application with Test Execution
|
||||
If you have at least Docker, the Java JDK and Gradle installed in appropriate versions and in your `PATH`, then you can start like this:
|
||||
|
||||
gw build
|
||||
cd your-hsadmin-ng-directory
|
||||
|
||||
gradle wrapper # downloads Gradle 7.5 into the project
|
||||
source .aliases # creates some comforable bash aliases, e.g. 'gw'='./gradlew'
|
||||
|
||||
### Starting the Application
|
||||
gw test # compiles and runs unit- and integration-tests
|
||||
|
||||
pg-sql-run # downloads + runs PostgreSQL in a Docker container on localhost:5432
|
||||
gw bootRun # compiles and runs the application on localhost:8080
|
||||
|
||||
To use an **H2 in-memory database** populated with sample-data.
|
||||
# the following command should reply with "pong":
|
||||
curl http://localhost:8080/api/ping
|
||||
|
||||
gw bootRun
|
||||
# the following command should return a JSON array with just all customers:
|
||||
curl \
|
||||
-H 'current-user: mike@hostsharing.net' \
|
||||
http://localhost:8080/api/customers
|
||||
|
||||
To use an **H2 file-based database**, start the application with the h2file profile:
|
||||
# the following command should return a JSON array with just all packages visible for the admin of the customer aab:
|
||||
curl \
|
||||
-H 'current-user: mike@hostsharing.net' -H 'assumed-roles: customer#aab.admin' \
|
||||
http://localhost:8080/api/packages
|
||||
|
||||
gw bootRun -Ph2file
|
||||
gw bootRun -Ph2file -Psample-data # populated with sample data
|
||||
# add a new customer
|
||||
curl \
|
||||
-H 'current-user: mike@hostsharing.net' -H "Content-Type: application/json" \
|
||||
-d '{ "prefix":"baa", "reference":80001, "adminUserName":"admin@baa.example.com" }' \
|
||||
-X POST http://localhost:8080/api/customers
|
||||
|
||||
To use a **local Postgres database**, first prepare your environment:
|
||||
If you wonder who 'mike@hostsharing.net' and 'sven@hostsharing.net' are and where the data comes from:
|
||||
Mike and Sven are just example Hostsharing hostmaster accounts as part of the example data which is automatically inserted in Testcontainers and Development environments.
|
||||
Also try for example 'admin@aaa.example.com' or 'unknown@example.org'.
|
||||
|
||||
export HSADMINNG_DB_URL='jdbc:postgresql://localhost:5432/DBNAME'
|
||||
export HSADMINNG_DB_USER='DBUSER'
|
||||
export HSADMINNG_DB_PASS='DBPASS'
|
||||
If you want a formatted JSON output, you can pipe the result to `jq` or similar.
|
||||
|
||||
Where `DBNAME`, `DBUSER` and `DBPASS` are replaced by your credentials.
|
||||
And to see the full, currently implemented, API, open http://localhost:8080/swagger-ui/index.html.
|
||||
|
||||
Then start the application with the pgsql profile:
|
||||
If you still need to install some of these tools, find some hints in the next chapters.
|
||||
|
||||
gw bootRun -Ppgsql
|
||||
gw bootRun -Ppgsql -Psample-data # populated with sample data
|
||||
|
||||
To use a **remote Postgres database** on a Hostsharing server,
|
||||
### SDKMAN
|
||||
|
||||
autossh -M 0 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" \
|
||||
-f -N -L 55432:127.0.0.1:5432 "xyz00@xyz.hostsharing.net"
|
||||
*SdkMan* is not necessary, but helpful to install and switch between different versions of SDKs (Software-Development-Kits) and development tools in general, e.g. *JDK* and *Gradle*.
|
||||
It is available for _Linux_ and _MacOS_, _WSL_, _Cygwin_, _Solaris_ and _FreeBSD_.
|
||||
|
||||
Then prepare your environment, e.g. like this:
|
||||
You can get it from: https://sdkman.io/.
|
||||
|
||||
export HSADMINNG_DB_URL='jdbc:postgresql://localhost:55432/xyz00_hsadminng'
|
||||
export HSADMINNG_DB_USER='xyz00_hsadminng'
|
||||
export HSADMINNG_DB_PASS='whatever'
|
||||
<big>**⚠**</big>
|
||||
Yeah, the `curl ... | bash` install method looks quite scary;
|
||||
but in a development environment you're downloading executables all the time,
|
||||
e.g. through `npm`, `Maven` or `Gradle` when downloading dependencies.
|
||||
Thus, maybe you should at least use a separate Linux account for development.
|
||||
|
||||
In all cases, you can also **specify the port** to used for the application via environment:
|
||||
Once it's installed, you can install *JDK* and *Gradle*:
|
||||
|
||||
SERVER_PORT=8081 gw bootRun ...
|
||||
sdk install java 17.0.3-tem
|
||||
sdk install gradle
|
||||
|
||||
For starting the JVM of the application in **debug-mode**, add `--debug-jvm` to any of the options above, e.g.
|
||||
sdk use java 17.0.3-tem # use this to switch between installed JDK versions
|
||||
|
||||
gw bootRun -Ppgsql -Psample-data --debug-jvm
|
||||
|
||||
### Running JUnit tests with branch coverage
|
||||
### PostgreSQL Server
|
||||
|
||||
#### for IntelliJ IDEA
|
||||
You could use any PostgreSQL Server (from version 13 on) installed on your machine.
|
||||
You might amend the port and user settings in `src/main/resources/application.yml`, though.
|
||||
|
||||
see: https://confluence.jetbrains.com/display/IDEADEV/IDEA+Coverage+Runner
|
||||
But the easiest way to run PostgreSQL is via Docker.
|
||||
|
||||
Either apply it to specific test configurations or,
|
||||
better, delete the previous test configurations and amend the JUnit template.
|
||||
Initially, pull an image compatible to current PostgreSQL version of Hostsharing:
|
||||
|
||||
## HOWTO Commits
|
||||
docker pull postgres:13.7-bullseye
|
||||
|
||||
There are git tags on some commits which show how to add certain features.
|
||||
<big>**⚠**</big>
|
||||
If we switch the version, please also amend the documentation as well as the aliases file. Thanks!
|
||||
|
||||
Find all of such tags with:
|
||||
Create and run a container with the given PostgreSQL version:
|
||||
|
||||
git tag | grep HOWTO
|
||||
docker run --name hsadmin-ng-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:13.7-bullseye
|
||||
|
||||
### Creating HOWTO Commits
|
||||
# or via alias:
|
||||
pg-sql-run
|
||||
|
||||
If you want to add such a commit, make sure that it contains no clutter
|
||||
(no changes which are not necessary for whatever the commit is about to explain),
|
||||
and is complete with all unit tests, code coverage, pitest and other checks.
|
||||
Otherwise the next developer would run into the same problems again.
|
||||
To check if the PostgreSQL container is running, the following command should list a container with the name "hsadmin-ng-postgres":
|
||||
|
||||
One way to keep the commit clean, is to develop it on a local branch.
|
||||
If any other changes (e.g. bugfixes, API extensions etc.) are necessary,
|
||||
apply these only to the master or cherry-pick just these to the master,
|
||||
then rebase your local branch. Do not forget to run all checks locally:
|
||||
docker container ls
|
||||
|
||||
gw clean check pitest # might need over an hour
|
||||
Stop the PostgreSQL container:
|
||||
|
||||
docker stop hsadmin-ng-postgres
|
||||
# or via alias: pg-sql-stop
|
||||
|
||||
(Check the PiTest section for speeding up mutation testing.)
|
||||
Start the PostgreSQL container again:
|
||||
|
||||
To create and push a new tag use:
|
||||
docker container start hsadmin-ng-postgres
|
||||
# or via alias: pg-sql-start
|
||||
|
||||
git tag HOWTO-... master
|
||||
git push origin HOWTO-...
|
||||
Remove the PostgreSQL container:
|
||||
|
||||
To moved an existing the tag to another commit (here current master again), do this:
|
||||
docker rm hsadmin-ng-postgres
|
||||
|
||||
# or via alias:
|
||||
pg-sql-remove
|
||||
|
||||
git tag --force HOWTO-... master
|
||||
git push --force origin HOWTO-...
|
||||
To reset to a clean database, use:
|
||||
|
||||
## Special Build Tasks
|
||||
pg-sql-stop; pg-sql-remove; pg-sql-run
|
||||
|
||||
Besides common build tasks like `build`, `test` or `bootRun` this projects has some not so common tasks which are explained in this section.
|
||||
# or via alias:
|
||||
pg-sql-reset
|
||||
|
||||
### Spotless Formatting
|
||||
After the PostgreSQL container is removed, you need to create it again as shown in "Create and run ..." above.
|
||||
|
||||
To make sure that no IDE auto-formatter destroys the git history of any file and
|
||||
especially to avoid merge conflicts from JHipster generated files after these had been changed,
|
||||
we are using a standard formatter enforced by _spotless_, which is based on the standard Eclipse formatter.
|
||||
Given the container is running, to create a backup in ~/backup, run:
|
||||
|
||||
The rules can be checked and applied with these commands:
|
||||
docker exec -i hsadmin-ng-postgres /usr/bin/pg_dump --clean --create -U postgres postgres | gzip -9 > ~/backup/hsadmin-ng-postgres.sql.gz
|
||||
|
||||
gw spotlessCheck
|
||||
gw spotlessApply
|
||||
# or via alias:
|
||||
pg-sql-backup >~/backup/hsadmin-ng-postgres.sql.gz
|
||||
|
||||
The spotlessCheck task is included as an early step in our Jenkins build pipeline.
|
||||
Therefore wrong formatting is automatically detected.
|
||||
|
||||
Our configuration can be found under the directory `cfg/spotless`.
|
||||
Currently we only have specific rules for _\*.java_-files and their import-order.
|
||||
Again, given the container is running, to restore the backup from ~/backup, run:
|
||||
|
||||
#### Our Changes to the Standard Eclipse Formatter
|
||||
gunzip --stdout --keep ~/backup/hsadmin-ng-postgres.sql.gz | docker exec -i hsadmin-ng-postgres psql -U postgres -d postgres
|
||||
|
||||
We amended the Standard Eclipse Formatter in these respects:
|
||||
# or via alias:
|
||||
pg-sql-restore <~/backup/hsadmin-ng-postgres.sql.gz
|
||||
|
||||
- Lines of code are never joined, thus the developer has control about linebreaks,
|
||||
which is important for readability in some implementations like toString().
|
||||
- Lines in comments are never joined either, because that often destroys readable stucture.
|
||||
- Parts of files can be excluded from getting formatted, by using `@formatter:off` and `@formatter:on` in a comment.
|
||||
See for example in class `SecurityConfiguration`.
|
||||
|
||||
#### Pre-Commit Hook
|
||||
### Markdown
|
||||
|
||||
If you like, you could add this code to the _pre-commit or \_pre_push_ hook\_ in your `.git/hooks` directory:
|
||||
To generate the TOC (Table of Contents), a little bash script from a
|
||||
[Blog Article](https://medium.com/@acrodriguez/one-liner-to-generate-a-markdown-toc-f5292112fd14) was used.
|
||||
|
||||
if ! ./gradlew spotlessCheck; then
|
||||
exit 1
|
||||
fi
|
||||
To render the Markdown files, especially to watch embedded PlantUML diagrams, you can use one of the following methods:
|
||||
|
||||
#### The Tagged Spotless Commit
|
||||
#### Render Markdown embedded PlantUML
|
||||
|
||||
The commit which introduces the spotless configuration is tagged.
|
||||
Through this tag it can easily be cherry-picked in the JHipster workflow.
|
||||
Can you see the following diagram right in your IDE?
|
||||
I mean a real graphic diagram, not just some markup code.
|
||||
|
||||
If you need to amend the commit tagged 'spotless', e.g. to change the spotless configuration,
|
||||
it can be done with these steps:
|
||||
```plantuml
|
||||
@startuml
|
||||
me -> you: Can you see this diagram?
|
||||
you -> me: Sorry, I don't :-(
|
||||
me -> you: Install some tooling!
|
||||
@enduml
|
||||
```
|
||||
|
||||
git tag REAL-HEAD
|
||||
git reset --hard spotless^
|
||||
git cherry-pick -n spotless
|
||||
...
|
||||
git add .
|
||||
# do NOT run: gw spotlessApply yet!
|
||||
# for the case you have a commit hook which runs spotlessCheck:
|
||||
git commit --no-verify
|
||||
git tag --force spotless
|
||||
git push --no-verify origin spotless
|
||||
git reset --hard REAL-HEAD
|
||||
git tag -d REAL-HEAD
|
||||
If not, you need to install some tooling.
|
||||
|
||||
### Mutation Testing PiTest
|
||||
##### for IntelliJ IDEA (or derived products)
|
||||
|
||||
./gradlew pitest
|
||||
You just need the bundled Markdown plugin enabled and install and activate the PlantUML plugin in its settings:
|
||||
|
||||
Runs (almost) all JUnit tests under mutation testing.
|
||||
Mutation testing is a means to determine the quality of the tests.
|
||||
jetbrains://idea/settings?name=Languages+%26+Frameworks--Markdown
|
||||
|
||||
On Jenkins, the results can be found in the build artifacts under:
|
||||
You might also need to install Graphviz on your operating system.
|
||||
For Debian-based Linux systems this might work:
|
||||
|
||||
- https://ci.hostsharing.net/job/hsadmin-ng-pitest/XX/artifact/build/reports/pitest/index.html
|
||||
```sh
|
||||
sudo apt install graphviz
|
||||
```
|
||||
|
||||
Where XX is the build number. Or for the latest build under:
|
||||
|
||||
- https://ci.hostsharing.net/job/hsadmin-ng-pitest/lastCompletedBuild/artifact/build/reports/pitest/index.html
|
||||
##### Ubuntu Linux command line
|
||||
|
||||
#### Some Background Information on Mutation Testing
|
||||
```sh
|
||||
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra pandoc-plantuml-filter
|
||||
```
|
||||
|
||||
PiTest does it with these steps:
|
||||
```sh
|
||||
pandoc --filter pandoc-plantuml rbac.md -o rbac.pdf
|
||||
```
|
||||
|
||||
- initially PiTest checks which production code is executed by which tests
|
||||
- if the tests don't pass, it stops
|
||||
- otherwise the production code is 'mutated' and PiTest checks whether this makes a test fail ('mutant killed')
|
||||
- Finally it checks thresholds for coverage and mutant killing.
|
||||
##### for other IDEs / operating systems
|
||||
|
||||
More information about can be found here:
|
||||
If you have figured out how it works, please add instructions above this section.
|
||||
|
||||
- PiTest: http://pitest.org/
|
||||
- gradle-plugin: https://gradle-pitest-plugin.solidsoft.info/
|
||||
### Other Tools
|
||||
|
||||
#### How to Configure PiTest
|
||||
**jq**: a JSON formatter.
|
||||
On _Debian_'oid systems you can install it with `sudo apt-get install jq`.
|
||||
On _MacOS_ you can install it with `brew install jq`, given you have _brew_ installed.
|
||||
|
||||
These thresholds can be configured in `build.gradle`,
|
||||
but we should generally not lower these.
|
||||
## Running the SQL files
|
||||
|
||||
There is also a list of excluded files, all generated by JHipster or MapStruct, not containing any changes by us.
|
||||
### For RBAC
|
||||
|
||||
As you might figure, mutation testing is CPU-hungry.
|
||||
To limit load in our Jenkins build server, it only uses 2 CPU threads, thus it needs over an hour.
|
||||
The Schema is automatically created via *Liquibase*, a database migration library.
|
||||
Currently, also some test data is automatically created.
|
||||
|
||||
If you want to spend more CPU threads on your local system, you can change that via command line:
|
||||
To increase the amount of test data, increase the number of generated customers in `2022-07-28-051-hs-customer.sql` and run that
|
||||
|
||||
gw pitest -Doverride.pitest.threads=7
|
||||
If you already have data, e.g. for customers 0..999 (thus with reference numbers 10000..10999) and want to add another 1000 customers, amend the for loop to 1000...1999 and also uncomment and amend the `CONTINUE WHEN` or `WHERE` conditions in the other test data generators, using the first new customer reference number (in the example that's 11000).
|
||||
|
||||
I suggest to leave one CPU thread for other tasks or your might lag extremely.
|
||||
### For Historization
|
||||
|
||||
### Git Workflow for JHipster Generator
|
||||
The historization is not yet integrated into the *Liquibase*-scripts.
|
||||
You can explore the prototype as follows:
|
||||
|
||||
The following workflow steps make sure that
|
||||
- start with an empty database
|
||||
(the example tables are currently not compatible with RBAC),
|
||||
- then run `historization.sql` in the database,
|
||||
- finally run `examples.sql` in the database.
|
||||
|
||||
- JHipster re-imports work properly,
|
||||
- the git history of changes to the JDL-files, the generated code and the master is comprehensible,
|
||||
- and merging newly generated code to the master branch is smooth.
|
||||
## Coding Guidelines
|
||||
|
||||
It uses a git branch `jhipster-generated` to track the history of the JDL model file and the generated source code.
|
||||
Applying commits which contain non-generated changes to that branch breaks the normal git history for generated files.
|
||||
Therefore, this documentation is also not available in that branch.
|
||||
Thus:
|
||||
### Directory and Package Structure
|
||||
|
||||
**MANUAL STEP before starting:** Copy this workflow documentation, because this file will be gone once you switched the branch.
|
||||
Generally, the standard Java directory structure is used, where productive and test code are sparated like this:
|
||||
|
||||
| WARNING: The following steps are just a guideline. You should understand what you are doing! |
|
||||
| -------------------------------------------------------------------------------------------- |
|
||||
```
|
||||
src
|
||||
main/
|
||||
java/
|
||||
net.hostsharing.hasadminng/
|
||||
resources/
|
||||
|
||||
test/
|
||||
java/
|
||||
net.hostsharing.hasadminng/
|
||||
resources/
|
||||
```
|
||||
|
||||
The Java package structure below contains:
|
||||
|
||||
#### 1. Preparing the `jhipster-generated` git Branch
|
||||
- config and global (utility) packages,
|
||||
these should not access any other packages within the project
|
||||
- rbac, containing all packages related to the RBAC subsystem
|
||||
- hs, containing Hostsharing business object related packages
|
||||
|
||||
This step assumes that the latest `*.jdl` files are on the `HEAD` of the `jhipster-generated` git branch.
|
||||
On a re-import of a JDL-file, JHipster does not remove any generated classes which belong to entities deleted from the JDL-file.
|
||||
Therefore, the project has to be reset to a clean state before changes to the JDL file can be re-imported.
|
||||
We have not yet finally tested a simplified workflow for just adding new entities or properties.
|
||||
Underneath of rbac and hs, the structure is business oriented, NOT technical / layer -oriented.
|
||||
|
||||
A git tag `jdl-base` is assumed to sit on the base commit after the application was generated, but before any entities were imported.
|
||||
Some of these rules are checked with *ArchUnit* unit tests.
|
||||
|
||||
git checkout jhipster-generated
|
||||
git pull
|
||||
git tag REAL-HEAD
|
||||
git reset --hard jdl-base
|
||||
git clean -f -d
|
||||
git cherry-pick -n spotless
|
||||
git reset --soft REAL-HEAD
|
||||
git checkout REAL-HEAD src/main/jdl/customer.jdl
|
||||
git checkout REAL-HEAD src/main/jdl/accessrights.jdl
|
||||
git checkout REAL-HEAD src/main/jdl/... # once there are more
|
||||
git tag -d REAL-HEAD
|
||||
### Spotless Code Formatting
|
||||
|
||||
#### 2. Amending and Re-Importing the JDL
|
||||
Code formatting for Java is checked via *spotless*.
|
||||
The formatting style can be checked with this command:
|
||||
|
||||
**MANUAL STEP:** First apply all necessary changes to the JDL files.
|
||||
Then re-import like this:
|
||||
```shell
|
||||
gw spotlessCheck
|
||||
```
|
||||
|
||||
# (Re-) Importing
|
||||
jhipster import-jdl src/main/jdl/customer.jdl
|
||||
jhipster import-jdl src/main/jdl/accessrights.jdl
|
||||
jhipster import-jdl src/main/jdl/... # once there are more
|
||||
This task is also included in `gw build`.
|
||||
|
||||
For smoothly being able to merge, we need the same formatting in the generated code as on the master:
|
||||
To apply formatting rules, use:
|
||||
|
||||
gw spotlessApply
|
||||
```shell
|
||||
gw spotlessApply
|
||||
```
|
||||
|
||||
#### 3. Committing our Changes
|
||||
|
||||
git add .
|
||||
git commit -m"..."
|
||||
## How To
|
||||
|
||||
#### 4. Merging our Changes to the `master` Branch
|
||||
### How to Use a Persistent Database for Integration Tests?
|
||||
|
||||
git checkout master
|
||||
git pull
|
||||
Usually, the `DataJpaTest` integration tests run against a database in a temporary docker container.
|
||||
As soon as the test ends, the database is gone; this might make debugging difficult.
|
||||
|
||||
**MANUAL STEP:** If you've renamed any identifiers, use the refactoring feature of your IDE to rename in master as well.
|
||||
To avoid oodles of merge-conflicts, you need to do that **BEFORE MERGING!**
|
||||
Commit any of such changes, if any.
|
||||
Alternatively
|
||||
|
||||
Now we can finally merge our changes to master.
|
||||
If the persistent database and the temporary database show different results, one of these reasons could be the cause:
|
||||
|
||||
git merge jhipster-generated
|
||||
1. You might have some changesets only running in either context,
|
||||
check the `context: ...` in the changeset control lines.
|
||||
2. You might have changes in the database which interfere with the tests,
|
||||
e.g. from a previous run of tests or manually applied.
|
||||
It's best to run `pg-sql-reset && gw bootRun` before each test run, to have a clean database.
|
||||
|
||||
## How to Amend Liquibase SQL Changesets?
|
||||
|
||||
It's a good idea doing this step in an IDE because it makes conflict resolving much easier.
|
||||
Typical merge conflicts stem from:
|
||||
Liquibase changesets are meant to be immutable and based on each other.
|
||||
That means, once a changeset is written, it never changes, not even a whitespace or comment.
|
||||
Liquibase is a *database migration tool*, not a *database initialization tool*.
|
||||
|
||||
- Random numbers in test data of `*IntTest.java` files.
|
||||
- Timestamps in Liquibase-xml-Files.
|
||||
This, if you need to add change a table, stored procedure or whatever,
|
||||
create a new changeset and apply `ALTER`, `DROP`, `CREATE OR REPLACE` or whatever SQL commands to perform your changes.
|
||||
These changes will be automatically applied once the application starts up again.
|
||||
This way, any staging or production database will always match the application code.
|
||||
|
||||
Now, I suggest to run all tests locally:
|
||||
But, during initial development that can be a big hassle because the database structure changes a lot in that stage.
|
||||
Also, the actual structure of the database won't be easily recognized anymore through lots of migration changesets.
|
||||
|
||||
gw clean test
|
||||
Therefore, during initial development, it's good approach just to amend the existing changesets and delete the database:
|
||||
|
||||
Once everything works again, we can push our new version:
|
||||
```shell
|
||||
pg-sql-reset
|
||||
gw bootRun
|
||||
```
|
||||
|
||||
git push
|
||||
<big>**⚠**</big>
|
||||
Just don't forget switching to the migration mode, once there is a production database!
|
||||
|
||||
#### 5. General Aftermath
|
||||
## Further Documentation
|
||||
|
||||
Think about which additional code could be effected by your JDL-changes!
|
||||
Files which are not at all in the `jhipster-generated` branch, don't show conflicts even though they might need changes.
|
||||
|
||||
Here some examples for amendments to be done:
|
||||
|
||||
- in `historicization_*.xml`: the columns or their constraints
|
||||
- `sampledata/*.xml/csv`
|
||||
|
||||
If you find more of such general cases, please add them here!
|
||||
|
||||
#### 6. Special Aftermath for new Entities
|
||||
|
||||
Because we have added quite some functionality, after introducing new entities, there is a lot more to amend.
|
||||
Here some issues to consider:
|
||||
|
||||
- add sample-data for the new entity
|
||||
- internal (Angular) frontend: add table filters
|
||||
- internal (Angular) frontend: amend input fields for multiline, if applicable
|
||||
- internal (Angular) frontend: check if dates are properly formatted
|
||||
- \*Mapper: add displayLabel for entity itself and parents
|
||||
- \*DTO: add access-right annotations with customized JSON serializer/deserializer
|
||||
- Validator: implement entity-based validator and call it in the generated service
|
||||
- external API: add new type to client library
|
||||
|
||||
WARNING: This list is most likely incomplete. Pleas add any new found issue!
|
||||
|
||||
For many of these issues look for HOWTO-commits in git or HOWTO comments in the source code.
|
||||
|
||||
### Generating the Table of Contents for Markdown
|
||||
|
||||
This README file contains a table of contents generated by _doctoc_.
|
||||
It's quite simple to use:
|
||||
|
||||
npm install -g doctoc
|
||||
doctoc --maxlevel 3 README.md
|
||||
|
||||
Further information can be found [https://github.com/thlorenz/doctoc/blob/master/README.md](on the _doctoc_ github page).
|
||||
- the `doc` directory contains architecture concepts and a glossary
|
||||
- TODO.md tracks requirements and progress for the contract of the initial project,
|
||||
please do not amend anything in this document
|
||||
|
BIN
TODO-progress.png
Normal file
BIN
TODO-progress.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |