From 081802fd57aabaecd54f056b4f1e664f41c387b9 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Tue, 29 Jun 2021 16:43:18 +0530 Subject: [PATCH 1/9] upgraded to 12.002 --- java/jtqj/core/bin/pom.xml | 6 +++--- java/jtqj/core/pom.xml | 6 +++--- .../general/common/base/test/DbTestHelper.java | 18 +----------------- java/jtqj/pom.xml | 10 +++++----- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/java/jtqj/core/bin/pom.xml b/java/jtqj/core/bin/pom.xml index 78e389ec..827608c7 100644 --- a/java/jtqj/core/bin/pom.xml +++ b/java/jtqj/core/bin/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 com.devonfw.java.jtqj @@ -20,7 +20,7 @@ com.devonfw.java.modules - devon4j-beanmapping + devon4j-beanmapping-dozer @@ -163,7 +163,7 @@ com.devonfw.java.modules - devon4j-test + devon4j-test-junit4 test diff --git a/java/jtqj/core/pom.xml b/java/jtqj/core/pom.xml index 78e389ec..827608c7 100644 --- a/java/jtqj/core/pom.xml +++ b/java/jtqj/core/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 com.devonfw.java.jtqj @@ -20,7 +20,7 @@ com.devonfw.java.modules - devon4j-beanmapping + devon4j-beanmapping-dozer @@ -163,7 +163,7 @@ com.devonfw.java.modules - devon4j-test + devon4j-test-junit4 test diff --git a/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/common/base/test/DbTestHelper.java b/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/common/base/test/DbTestHelper.java index 2c0badb0..a9369895 100644 --- a/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/common/base/test/DbTestHelper.java +++ b/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/common/base/test/DbTestHelper.java @@ -3,7 +3,6 @@ import javax.inject.Named; import org.flywaydb.core.Flyway; -import org.flywaydb.core.api.MigrationVersion; /** * This class provides methods for handling the database during testing where resets (and other operations) may be @@ -14,14 +13,13 @@ public class DbTestHelper { private Flyway flyway; - private MigrationVersion migrationVersion; - /** * The constructor. * * @param flyway an instance of type {@link Flyway}. */ public DbTestHelper(Flyway flyway) { + super(); this.flyway = flyway; } @@ -41,20 +39,6 @@ public void dropDatabase() { public void resetDatabase() { dropDatabase(); - if (this.migrationVersion != null) { - this.flyway.setTarget(this.migrationVersion); - } this.flyway.migrate(); } - - /** - * This method sets the internal value of the {@code migrationVersion}. - * - * @param migrationVersion new {@code String} value of {@code migrationVersion}. Must not be null - */ - public void setMigrationVersion(String migrationVersion) { - - this.migrationVersion = MigrationVersion.fromVersion(migrationVersion); - } - } diff --git a/java/jtqj/pom.xml b/java/jtqj/pom.xml index 9ab83e70..af5f0464 100644 --- a/java/jtqj/pom.xml +++ b/java/jtqj/pom.xml @@ -8,13 +8,13 @@ Application based on the Open Application Standard Platform for Java (devon4j). - 2.1.6.RELEASE - 3.1.1 + 2.4.0 + 2020.12.002 1.8 UTF-8 UTF-8 com.devonfw.module.test.common.api.category.CategorySystemTest - 2.9.9.20190727 + 2.11.2 @@ -316,7 +316,7 @@ systemtest - + @@ -482,4 +482,4 @@ - + \ No newline at end of file From af09e2af79079c5b55260b0decb2c5bb4685ff74 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Tue, 29 Jun 2021 17:06:24 +0530 Subject: [PATCH 2/9] upgraded to 04.002 --- java/jtqj/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/jtqj/pom.xml b/java/jtqj/pom.xml index af5f0464..e21a4fbb 100644 --- a/java/jtqj/pom.xml +++ b/java/jtqj/pom.xml @@ -8,13 +8,13 @@ Application based on the Open Application Standard Platform for Java (devon4j). - 2.4.0 - 2020.12.002 + 2.4.4 + 2021.04.002 1.8 UTF-8 UTF-8 com.devonfw.module.test.common.api.category.CategorySystemTest - 2.11.2 + 2.12.2 From fe485376cbca81df240c3b2f43530afd496653da Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Wed, 30 Jun 2021 12:49:02 +0530 Subject: [PATCH 3/9] removed bin, Fixed the sql syntax error. --- java/jtqj/core/bin/pom.xml | 233 ------------------ .../META-INF/cxf/org.apache.cxf.Logger | 1 - .../bin/src/main/resources/META-INF/orm.xml | 4 - .../src/main/resources/application.properties | 32 --- .../config/app/common/dozer-mapping.xml | 32 --- .../config/app/dataaccess/NamedQueries.xml | 5 - .../app/security/access-control-schema.xml | 10 - .../resources/config/application.properties | 23 -- .../db/migration/1.0/V0004__Add_blob_data.sql | 1 - .../db/migration/1.0/V0008__Master_Data.sql | 24 -- .../db/type/h2/V0001__Create_Sequence.sql | 2 - .../db/type/h2/V0002__Create_RevInfo.sql | 6 - .../db/type/h2/V0003__Create_BinaryObject.sql | 9 - .../db/type/h2/V0005__Create_Visitor.sql | 14 -- .../db/type/h2/V0006__Create_Queue.sql | 12 - .../db/type/h2/V0007__Create_Access_Code.sql | 13 - .../db/type/hana/V0001__Create_Sequence.sql | 18 -- .../db/type/hana/V0002__Create_RevInfo.sql | 7 - .../type/hana/V0003__Create_BinaryObject.sql | 9 - .../db/type/mssql/V0001__Create_Sequence.sql | 1 - .../db/type/mssql/V0002__Create_RevInfo.sql | 6 - .../type/mssql/V0003__Create_BinaryObject.sql | 9 - .../db/type/mysql/V0001__Create_Sequence.sql | 1 - .../db/type/mysql/V0002__Create_RevInfo.sql | 6 - .../type/mysql/V0003__Create_BinaryObject.sql | 8 - .../db/type/oracle/V0001__Create_Sequence.sql | 2 - .../db/type/oracle/V0002__Create_RevInfo.sql | 7 - .../oracle/V0003__Create_BinaryObject.sql | 9 - .../postgresql/V0001__Create_Sequence.sql | 2 - .../type/postgresql/V0002__Create_RevInfo.sql | 6 - .../postgresql/V0003__Create_BinaryObject.sql | 9 - .../bin/src/main/resources/static/index.html | 18 -- .../resources/config/application.properties | 13 - .../resources/config/application.properties | 2 +- .../db/type/h2/V0005__Create_Visitor.sql | 2 +- .../db/type/h2/V0006__Create_Queue.sql | 2 +- .../db/type/h2/V0007__Create_Access_Code.sql | 2 +- 37 files changed, 4 insertions(+), 556 deletions(-) delete mode 100644 java/jtqj/core/bin/pom.xml delete mode 100644 java/jtqj/core/bin/src/main/resources/META-INF/cxf/org.apache.cxf.Logger delete mode 100644 java/jtqj/core/bin/src/main/resources/META-INF/orm.xml delete mode 100644 java/jtqj/core/bin/src/main/resources/application.properties delete mode 100644 java/jtqj/core/bin/src/main/resources/config/app/common/dozer-mapping.xml delete mode 100644 java/jtqj/core/bin/src/main/resources/config/app/dataaccess/NamedQueries.xml delete mode 100644 java/jtqj/core/bin/src/main/resources/config/app/security/access-control-schema.xml delete mode 100644 java/jtqj/core/bin/src/main/resources/config/application.properties delete mode 100644 java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0004__Add_blob_data.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0008__Master_Data.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0005__Create_Visitor.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0006__Create_Queue.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/hana/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/hana/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/hana/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mssql/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mssql/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mssql/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mysql/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mysql/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/mysql/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/oracle/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/oracle/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/oracle/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0001__Create_Sequence.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0002__Create_RevInfo.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0003__Create_BinaryObject.sql delete mode 100644 java/jtqj/core/bin/src/main/resources/static/index.html delete mode 100644 java/jtqj/core/bin/src/test/resources/config/application.properties diff --git a/java/jtqj/core/bin/pom.xml b/java/jtqj/core/bin/pom.xml deleted file mode 100644 index 827608c7..00000000 --- a/java/jtqj/core/bin/pom.xml +++ /dev/null @@ -1,233 +0,0 @@ - - 4.0.0 - - com.devonfw.java.jtqj - jtqj - v4 - - jtqj-core - jar - ${project.artifactId} - Core of the server for the jtqj application - a simple example using the Open Application Standard Platform for Java (devon4j). - - - - ${project.groupId} - jtqj-api - ${project.version} - - - - - com.devonfw.java.modules - devon4j-beanmapping-dozer - - - - - com.devonfw.java.modules - devon4j-security - - - - com.devonfw.java.modules - devon4j-web - - - - - com.devonfw.java.starters - devon4j-starter-cxf-client-rest - - - - com.devonfw.java.starters - devon4j-starter-cxf-client-ws - - - - - com.devonfw.java.starters - devon4j-starter-cxf-server-rest - - - - com.devonfw.java.starters - devon4j-starter-cxf-server-ws - - - - - com.devonfw.java.starters - devon4j-starter-spring-data-jpa - - - - - org.springframework.boot - spring-boot-starter-jdbc - - - - - javax.persistence - javax.persistence-api - - - - - org.hibernate - hibernate-entitymanager - - - - - com.querydsl - querydsl-jpa - - - com.querydsl - querydsl-apt - provided - - - - - org.hibernate.validator - hibernate-validator - - - - - javax.servlet - javax.servlet-api - provided - - - - - javax.el - javax.el-api - - - - - org.springframework - spring-webmvc - - - - - com.h2database - h2 - - - - - org.flywaydb - flyway-core - - - - - org.apache.cxf - cxf-rt-rs-service-description - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework - spring-aop - - - - - cglib - cglib - - - - - net.logstash.logback - logstash-logback-encoder - - - - - com.devonfw.java.modules - devon4j-test-junit4 - test - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.springframework.boot - spring-boot-starter-validation - - - - - - org.skyscreamer - jsonassert - test - - - - - - embedded - - true - - - - org.springframework.boot - spring-boot-starter-tomcat - - - - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-jar-plugin - - - config/application.properties - - - - - - - \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/java/jtqj/core/bin/src/main/resources/META-INF/cxf/org.apache.cxf.Logger deleted file mode 100644 index 27dd788b..00000000 --- a/java/jtqj/core/bin/src/main/resources/META-INF/cxf/org.apache.cxf.Logger +++ /dev/null @@ -1 +0,0 @@ -org.apache.cxf.common.logging.Slf4jLogger \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/META-INF/orm.xml b/java/jtqj/core/bin/src/main/resources/META-INF/orm.xml deleted file mode 100644 index 55d30ec8..00000000 --- a/java/jtqj/core/bin/src/main/resources/META-INF/orm.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/application.properties b/java/jtqj/core/bin/src/main/resources/application.properties deleted file mode 100644 index 8f4f34a3..00000000 --- a/java/jtqj/core/bin/src/main/resources/application.properties +++ /dev/null @@ -1,32 +0,0 @@ -# This is the configuration file shipped with the application that contains reasonable defaults. -# Environment specific configurations are configured in config/application.properties. -# If you are running in a servlet container you may add this to lib/config/application.properties in case you do not -# want to touch the WAR file. - -# server.port=8080 - -spring.application.name=jtqj -server.servlet.context-path=/ - -security.expose.error.details=false -security.cors.enabled=false -spring.jpa.hibernate.ddl-auto=validate - -# Datasource for accessing the database -# https://github.com/spring-projects/spring-boot/blob/d3c34ee3d1bfd3db4a98678c524e145ef9bca51c/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java -spring.jpa.database=h2 -# spring.jpa.database-platform=org.hibernate.dialect.H2Dialect -# spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa - -# Hibernate NamingStrategy has been deprecated and then removed in favor of two step naming strategy ImplicitNamingStrategy and PhysicalNamingStrategy -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl -spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - -# to prevent that Spring Boot launches batch jobs on startup -# might otherwise lead to errors if job parameters are needed (or lead to unwanted modifications and longer startup times) -# see http://stackoverflow.com/questions/22318907/how-to-stop-spring-batch-scheduled-jobs-from-running-at-first-time-when-executin -spring.batch.job.enabled=false - -# Flyway for Database Setup and Migrations -spring.flyway.locations=classpath:db/migration,classpath:db/type/h2 diff --git a/java/jtqj/core/bin/src/main/resources/config/app/common/dozer-mapping.xml b/java/jtqj/core/bin/src/main/resources/config/app/common/dozer-mapping.xml deleted file mode 100644 index 15912ec1..00000000 --- a/java/jtqj/core/bin/src/main/resources/config/app/common/dozer-mapping.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - true - - - - java.lang.Long - java.lang.Integer - java.lang.Number - - - - - - - - - com.devonfw.application.jtqj.general.dataaccess.api.ApplicationPersistenceEntity - com.devonfw.module.basic.common.api.to.AbstractEto - - this - persistentEntity - - - diff --git a/java/jtqj/core/bin/src/main/resources/config/app/dataaccess/NamedQueries.xml b/java/jtqj/core/bin/src/main/resources/config/app/dataaccess/NamedQueries.xml deleted file mode 100644 index ee83c8c6..00000000 --- a/java/jtqj/core/bin/src/main/resources/config/app/dataaccess/NamedQueries.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/java/jtqj/core/bin/src/main/resources/config/app/security/access-control-schema.xml b/java/jtqj/core/bin/src/main/resources/config/app/security/access-control-schema.xml deleted file mode 100644 index 418f6ebe..00000000 --- a/java/jtqj/core/bin/src/main/resources/config/app/security/access-control-schema.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/java/jtqj/core/bin/src/main/resources/config/application.properties b/java/jtqj/core/bin/src/main/resources/config/application.properties deleted file mode 100644 index 8fcee568..00000000 --- a/java/jtqj/core/bin/src/main/resources/config/application.properties +++ /dev/null @@ -1,23 +0,0 @@ -# This is the spring boot configuration file for development. It will not be included into the application. -# In order to set specific configurations in a regular installed environment create an according file -# config/application.properties in the server. If you are deploying the application to a servlet container as untouched -# WAR file you can locate this config folder in ${symbol_dollar}{CATALINA_BASE}/lib. If you want to deploy multiple applications to -# the same container (not recommended by default) you need to ensure the WARs are extracted in webapps folder and locate -# the config folder inside the WEB-INF/classes folder of the webapplication. - -server.port=8081 -server.servlet.context-path=/ - -# Datasource for accessing the database -# See https://github.com/devonfw-wiki/devon4j/wiki/guide-configuration#security-configuration -#jasypt.encryptor.password=none -#spring.datasource.password=ENC(7CnHiadYc0Wh2FnWADNjJg==) -spring.datasource.password= -spring.datasource.url=jdbc:h2:./.jtqj; - -# Enable JSON pretty printing -spring.jackson.serialization.INDENT_OUTPUT=true - -# Flyway for Database Setup and Migrations -spring.flyway.enabled=true -spring.flyway.clean-on-validation-error=true diff --git a/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0004__Add_blob_data.sql b/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0004__Add_blob_data.sql deleted file mode 100644 index 574db16c..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0004__Add_blob_data.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO BinaryObject(id, ModificationCounter, filesize, content, mimeType) VALUES (10, 0, 1150 ,'00000100010010100000010020006804000016000000280000001000000020000000010020000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000ECBD48EFECBD48FFECBD48FFECBD48FFECBD48FFECBD48F90000000000000000000000000000000000000000000000000000000000000000ECBD48FAECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FF0000000000000000000000000000000000000000ECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FF000000000000000000000000ECBD48FAECBD48FFFFFFFFFFECBD48FFFFFFFFFFFFFFFFFFEEC35EFFFFFEFDFFFFFFFFFFFFFFFFFFFFFFFFFFEFC86BFFECBD48FFECBD48FF0000000000000000ECBD48FFECBD48FFF4D696FFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FF00000000ECBD48EFECBD48FFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1CB7FFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFFFFFFFFFECBD48FFECBD48FFECBD48F9ECBD48FFECBD48FFECBD48FFFFFFFFFFFFFFFFFFFDF8EFFFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFFFFFFFFFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFECBD48FFECBD48FFECBD4AFFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFFFFFFFFFFEF9F3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFECBD48FFECBD48FFECBD48F9ECBD48FFECBD48FFFFFFFFFFEEC45FFFECBD48FFF1CD7EFFFFFFFFFFFFFFFFFFFFFFFFFFEDC156FFFFFFFFFFFFFFFFFFECBD48FFECBD48FFECBD48EF00000000ECBD48FFECBD48FFFFFFFFFFFEF9F2FFECBD48FFFCF5E8FFFFFFFFFFFFFFFFFFFFFFFFFFECBD48FFFFFFFFFFFFFFFFFFECBD48FFECBD48FF0000000000000000ECBD48FFECBD48FFEFC769FFFFFFFFFFFFFFFFFFFFFFFFFFEEC35EFFEEC25CFFFFFFFFFFFFFFFFFFFFFFFFFFEFC86BFFECBD48FFECBD48FA000000000000000000000000ECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FF0000000000000000000000000000000000000000ECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FFECBD48FA0000000000000000000000000000000000000000000000000000000000000000ECBD48F9ECBD48FFECBD48FFECBD48FFECBD48FFECBD48EF0000000000000000000000000000000000000000F81F0000E0070000C003000080010000800100000000000000000000000000000000000000000000000000008001000080010000C0030000E0070000F81F0000', 'image/vnd.microsoft.icon'); diff --git a/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0008__Master_Data.sql b/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0008__Master_Data.sql deleted file mode 100644 index a6f9eea8..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/migration/1.0/V0008__Master_Data.sql +++ /dev/null @@ -1,24 +0,0 @@ -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (0, 1, 'mike@mail.com', 'test', '1', '123456789', '0', '1', '1'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (1, 1, 'peter@mail.com', 'test', '1', '123456789', '1', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (2, 1, 'pablo@mail.com', 'test', '1', '123456789', '0', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (3, 1, 'test1@mail.com', 'test', '1', '123456789', '0', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (4, 1, 'test2@mail.com', 'test', '1', '123456789', '1', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (5, 1, 'test3@mail.com', 'test', '1', '123456789', '0', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (6, 1, 'test4@mail.com', 'test', '1', '123456789', '0', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (7, 1, 'test5@mail.com', 'test', '1', '123456789', '1', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (8, 1, 'test6@mail.com', 'test', '1', '123456789', '0', '1', '0'); -INSERT INTO Visitor (id, modificationCounter, username, name, password, phoneNumber, acceptedComercial, acceptedTerms, userType) VALUES (9, 1, 'test7@mail.com', 'test', '1', '123456789', '0', '1', '0'); - -INSERT INTO DailyQueue (id, modificationCounter, name, logo, currentNumber, attentionTime, minAttentionTime, active, customers) VALUES (1, 1, 'Day2', 'C:/logos/Day1Logo.png', 'Q001', NULL, '1970-01-01 00:01:00', TRUE, 9); - -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (1, 1, 'Q001', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, 1, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (2, 1, 'Q002', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 2, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (3, 1, 'Q003', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 3, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (4, 1, 'Q004', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 4, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (5, 1, 'Q005', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 5, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (6, 1, 'Q006', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 6, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (7, 1, 'Q007', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 7, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (8, 1, 'Q008', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 8, 1); -INSERT INTO AccessCode (id, modificationCounter, ticketNumber, creationTime, startTime, endTime, idVisitor, idQueue) VALUES (9, 1, 'Q009', CURRENT_TIMESTAMP, '2008-01-01 00:00:01', NULL, 9, 1); - - diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0001__Create_Sequence.sql deleted file mode 100644 index e54f1e7c..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0001__Create_Sequence.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Leave a large ID space reserved for master-data and test-data -CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1000000; \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0002__Create_RevInfo.sql deleted file mode 100644 index 8a41c6f9..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,6 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE TABLE RevInfo( - id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1), - "timestamp" BIGINT NOT NULL, - userLogin VARCHAR(255) -); \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0003__Create_BinaryObject.sql deleted file mode 100644 index d91838ce..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,9 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE TABLE BinaryObject ( - id BIGINT NOT NULL AUTO_INCREMENT, - modificationCounter INTEGER NOT NULL, - content BLOB(2147483647), - filesize BIGINT NOT NULL, - mimeType VARCHAR(255), - PRIMARY KEY (ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0005__Create_Visitor.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0005__Create_Visitor.sql deleted file mode 100644 index 5aad959b..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0005__Create_Visitor.sql +++ /dev/null @@ -1,14 +0,0 @@ -create table Visitor( - id BIGINT NOT NULL AUTO_INCREMENT, - modificationCounter INTEGER NOT NULL, - username VARCHAR(255), - name VARCHAR(255) NOT NULL, - lastname VARCHAR(255) NOT NULL, - password VARCHAR(255), - phoneNumber VARCHAR(255), - email VARCHAR(255), - acceptedComercial BOOL DEFAULT '0', - acceptedTerms BOOL NOT NULL DEFAULT '0', - userType BOOL DEFAULT '0', - CONSTRAINT PK_Visitor PRIMARY KEY(id), -); \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0006__Create_Queue.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0006__Create_Queue.sql deleted file mode 100644 index 69e13555..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0006__Create_Queue.sql +++ /dev/null @@ -1,12 +0,0 @@ -create table DailyQueue( - id BIGINT NOT NULL AUTO_INCREMENT, - modificationCounter INTEGER NOT NULL, - name VARCHAR(255), - logo VARCHAR(255), - currentNumber VARCHAR(255), - attentionTime TIMESTAMP, - minAttentionTime TIMESTAMP NOT NULL DEFAULT '60000', - active BOOL NOT NULL DEFAULT '1', - customers INTEGER NOT NULL DEFAULT '0', - CONSTRAINT PK_DailyQueue PRIMARY KEY(id), -); \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql b/java/jtqj/core/bin/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql deleted file mode 100644 index bf74f610..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE AccessCode( - id BIGINT NOT NULL AUTO_INCREMENT, - modificationCounter INTEGER NOT NULL, - ticketNumber VARCHAR(5), - creationTime TIMESTAMP, - startTime TIMESTAMP, - endTime TIMESTAMP, - idVisitor BIGINT NOT NULL, - idQueue BIGINT NOT NULL, - CONSTRAINT PK_AccessCode PRIMARY KEY(id), - CONSTRAINT FK_AccessCode_idVisitor FOREIGN KEY(idVisitor) REFERENCES Visitor(id), - CONSTRAINT FK_AccessCode_idQueue FOREIGN KEY(idQueue) REFERENCES DailyQueue(id), -); \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/hana/V0001__Create_Sequence.sql deleted file mode 100644 index 49953d2c..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0001__Create_Sequence.sql +++ /dev/null @@ -1,18 +0,0 @@ --- Leave a large ID space reserved for master-data and test-data -CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1000000; - --- hana does not support Dateadd function out of the box so we add it here to be able to use it for master-data SQLs -CREATE FUNCTION DATEADD(IN DATETYPE NVARCHAR(256), IN NUMBER INTEGER, IN TS TIMESTAMP) -RETURNS TSADD TIMESTAMP -AS -BEGIN - IF :DATETYPE = 'DAY' - THEN - TSADD = ADD_DAYS(:TS, :NUMBER); - ELSEIF :DATETYPE = 'HOUR' - THEN - TSADD = ADD_SECONDS(:TS, :NUMBER * 3600); - ELSE - SIGNAL SQL_ERROR_CODE 10000 SET MESSAGE_TEXT = 'Unsupported date type: ' || :DATETYPE; - END IF; -END; \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/hana/V0002__Create_RevInfo.sql deleted file mode 100644 index 38b650b3..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,7 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE COLUMN TABLE RevInfo( - id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1), - "timestamp" BIGINT NOT NULL, - userLogin VARCHAR(255), - PRIMARY KEY (ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/hana/V0003__Create_BinaryObject.sql deleted file mode 100644 index 6463189d..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/hana/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,9 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE COLUMN TABLE BinaryObject ( - id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, - modificationCounter INTEGER NOT NULL, - content BLOB, - filesize BIGINT NOT NULL, - mimeType VARCHAR(255), - CONSTRAINT PK_BinaryObject_id PRIMARY KEY(ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0001__Create_Sequence.sql deleted file mode 100644 index 80704fad..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0001__Create_Sequence.sql +++ /dev/null @@ -1 +0,0 @@ --- no sequences are used in MS-SQL Server instead use IDENTITY(«seed»,1) for every ID diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0002__Create_RevInfo.sql deleted file mode 100644 index ceae13d0..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,6 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE TABLE REVINFO( - id BIGINT NOT NULL IDENTITY(1,1), - timestamp BIGINT NOT NULL, - userLogin VARCHAR(255) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0003__Create_BinaryObject.sql deleted file mode 100644 index 4a454bee..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mssql/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,9 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE TABLE BINARYOBJECT ( - id BIGINT NOT NULL IDENTITY(10,1), - modificationCounter INTEGER NOT NULL, - content varbinary(max), - filesize BIGINT NOT NULL, - mimeType VARCHAR(255), - PRIMARY KEY (ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0001__Create_Sequence.sql deleted file mode 100644 index c5da8cf7..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0001__Create_Sequence.sql +++ /dev/null @@ -1 +0,0 @@ --- no sequences are used in MySQL/MariaDB instead use AUTO_INCREMENT for every ID diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0002__Create_RevInfo.sql deleted file mode 100644 index a9590a2b..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,6 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE TABLE REVINFO( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - timestamp BIGINT NOT NULL, - userLogin VARCHAR(255) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0003__Create_BinaryObject.sql deleted file mode 100644 index ff7ca5f7..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/mysql/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,8 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE TABLE BINARYOBJECT ( - id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, - modificationCounter INT NOT NULL, - content LONGBLOB, - filesize BIGINT NOT NULL, - mimeType VARCHAR(255) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0001__Create_Sequence.sql deleted file mode 100644 index 22104389..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0001__Create_Sequence.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Leave a large ID space reserved for master-data and test-data -CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1000000; diff --git a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0002__Create_RevInfo.sql deleted file mode 100644 index a459bf24..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,7 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE TABLE RevInfo ( - id NUMBER(19), - "timestamp" NUMBER(19,0), - userLogin VARCHAR2(255 CHAR), - CONSTRAINT PK_RevInfo_id PRIMARY KEY (id) -); \ No newline at end of file diff --git a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0003__Create_BinaryObject.sql deleted file mode 100644 index e5635f1b..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/oracle/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,9 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE TABLE BinaryObject ( - id NUMBER(19), - modificationCounter NUMBER(10, 0) NOT NULL, - content BLOB, - filesize NUMBER(10, 0) NOT NULL, - mimeType VARCHAR(255), - CONSTRAINT PK_BinaryObject_id PRIMARY KEY (ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0001__Create_Sequence.sql b/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0001__Create_Sequence.sql deleted file mode 100644 index 22104389..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0001__Create_Sequence.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Leave a large ID space reserved for master-data and test-data -CREATE SEQUENCE HIBERNATE_SEQUENCE START WITH 1000000; diff --git a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0002__Create_RevInfo.sql b/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0002__Create_RevInfo.sql deleted file mode 100644 index b6c8663c..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0002__Create_RevInfo.sql +++ /dev/null @@ -1,6 +0,0 @@ --- *** RevInfo (Commit log for envers audit trail) *** -CREATE TABLE REVINFO( - id BIGINT NOT NULL, - timestamp BIGINT NOT NULL, - userLogin VARCHAR(255) -); diff --git a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0003__Create_BinaryObject.sql b/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0003__Create_BinaryObject.sql deleted file mode 100644 index 54bb1614..00000000 --- a/java/jtqj/core/bin/src/main/resources/db/type/postgresql/V0003__Create_BinaryObject.sql +++ /dev/null @@ -1,9 +0,0 @@ --- *** BinaryObject (BLOBs) *** -CREATE TABLE BINARYOBJECT ( - id BIGSERIAL NOT NULL, - modificationCounter INTEGER NOT NULL, - content BYTEA, - filesize BIGINT NOT NULL, - mimeType VARCHAR(255), - PRIMARY KEY (ID) -); diff --git a/java/jtqj/core/bin/src/main/resources/static/index.html b/java/jtqj/core/bin/src/main/resources/static/index.html deleted file mode 100644 index 88b7063e..00000000 --- a/java/jtqj/core/bin/src/main/resources/static/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - -Welcome - - -

Welcome

- This is a test! -
- Services Overview (CXF) -
-
- -
- -
- - \ No newline at end of file diff --git a/java/jtqj/core/bin/src/test/resources/config/application.properties b/java/jtqj/core/bin/src/test/resources/config/application.properties deleted file mode 100644 index 47b72ef4..00000000 --- a/java/jtqj/core/bin/src/test/resources/config/application.properties +++ /dev/null @@ -1,13 +0,0 @@ -# This is the spring boot configuration file for JUnit tests. It will only affect JUnits and is not included into the application. -spring.profiles.active=junit - -# Database and JPA -spring.jpa.database=h2 -spring.datasource.url=jdbc:h2:mem:app; -spring.datasource.password= -spring.datasource.username=sa -spring.jpa.hibernate.ddl-auto=none - -# Flyway for Database Setup and Migrations -spring.flyway.enabled=true -spring.flyway.locations=classpath:db/migration,classpath:db/type/h2 diff --git a/java/jtqj/core/src/main/resources/config/application.properties b/java/jtqj/core/src/main/resources/config/application.properties index 20a24d93..fe4ea90c 100644 --- a/java/jtqj/core/src/main/resources/config/application.properties +++ b/java/jtqj/core/src/main/resources/config/application.properties @@ -13,7 +13,7 @@ server.servlet.context-path=/jumpthequeue #jasypt.encryptor.password=none #spring.datasource.password=ENC(7CnHiadYc0Wh2FnWADNjJg==) spring.datasource.password= -spring.datasource.url=jdbc:h2:./.jtqj; +spring.datasource.url=jdbc:h2:./.jtqj1; # Enable JSON pretty printing spring.jackson.serialization.INDENT_OUTPUT=true diff --git a/java/jtqj/core/src/main/resources/db/type/h2/V0005__Create_Visitor.sql b/java/jtqj/core/src/main/resources/db/type/h2/V0005__Create_Visitor.sql index 71b47d10..eaf25a5d 100644 --- a/java/jtqj/core/src/main/resources/db/type/h2/V0005__Create_Visitor.sql +++ b/java/jtqj/core/src/main/resources/db/type/h2/V0005__Create_Visitor.sql @@ -8,5 +8,5 @@ create table Visitor( acceptedCommercial BOOL DEFAULT '0', acceptedTerms BOOL NOT NULL DEFAULT '0', userType BOOL DEFAULT '0', - CONSTRAINT PK_Visitor PRIMARY KEY(id), + CONSTRAINT PK_Visitor PRIMARY KEY(id) ); \ No newline at end of file diff --git a/java/jtqj/core/src/main/resources/db/type/h2/V0006__Create_Queue.sql b/java/jtqj/core/src/main/resources/db/type/h2/V0006__Create_Queue.sql index 69e13555..0c8725a7 100644 --- a/java/jtqj/core/src/main/resources/db/type/h2/V0006__Create_Queue.sql +++ b/java/jtqj/core/src/main/resources/db/type/h2/V0006__Create_Queue.sql @@ -8,5 +8,5 @@ create table DailyQueue( minAttentionTime TIMESTAMP NOT NULL DEFAULT '60000', active BOOL NOT NULL DEFAULT '1', customers INTEGER NOT NULL DEFAULT '0', - CONSTRAINT PK_DailyQueue PRIMARY KEY(id), + CONSTRAINT PK_DailyQueue PRIMARY KEY(id) ); \ No newline at end of file diff --git a/java/jtqj/core/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql b/java/jtqj/core/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql index bf74f610..df3f5f71 100644 --- a/java/jtqj/core/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql +++ b/java/jtqj/core/src/main/resources/db/type/h2/V0007__Create_Access_Code.sql @@ -9,5 +9,5 @@ CREATE TABLE AccessCode( idQueue BIGINT NOT NULL, CONSTRAINT PK_AccessCode PRIMARY KEY(id), CONSTRAINT FK_AccessCode_idVisitor FOREIGN KEY(idVisitor) REFERENCES Visitor(id), - CONSTRAINT FK_AccessCode_idQueue FOREIGN KEY(idQueue) REFERENCES DailyQueue(id), + CONSTRAINT FK_AccessCode_idQueue FOREIGN KEY(idQueue) REFERENCES DailyQueue(id) ); \ No newline at end of file From 1e2f0358ad689c8d910f4da99f6147446fdf2813 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Wed, 21 Jul 2021 16:41:34 +0530 Subject: [PATCH 4/9] spellcheck workflow --- .github/workflows/build.yml | 9 +++++++++ .github/workflows/spellcheck.yml | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 .github/workflows/spellcheck.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 247ee89e..12046271 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,16 @@ jobs: uses: actions/setup-java@v1 with: java-version: '11' + - name: spell check + # Spellcheck + - uses: actions/checkout@v2 + - uses: igsekor/pyspelling-any@v0.0.2 + name: Spellcheck - name: Build project with Maven run: | cd java/jtqj mvn install + - name: Build project with Maven + - uses: actions/checkout@v2 + - uses: igsekor/pyspelling-any@v0.0.2 + name: Spellcheck \ No newline at end of file diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml new file mode 100644 index 00000000..7c2e5be1 --- /dev/null +++ b/.github/workflows/spellcheck.yml @@ -0,0 +1,7 @@ +matrix: +- name: Python Source + aspell: + lang: en + d: en_US + sources: + - documentation/* \ No newline at end of file From 888fa40f912926a566989e7a76cdcaa44924b537 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Wed, 21 Jul 2021 16:47:24 +0530 Subject: [PATCH 5/9] spell check. --- .github/workflows/build.yml | 6 +----- .github/workflows/spellcheck.yml | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12046271..c0de2fef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,12 +17,8 @@ jobs: # Spellcheck - uses: actions/checkout@v2 - uses: igsekor/pyspelling-any@v0.0.2 - name: Spellcheck - name: Build project with Maven run: | cd java/jtqj mvn install - - name: Build project with Maven - - uses: actions/checkout@v2 - - uses: igsekor/pyspelling-any@v0.0.2 - name: Spellcheck \ No newline at end of file + diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 7c2e5be1..53d86aff 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -4,4 +4,5 @@ matrix: lang: en d: en_US sources: - - documentation/* \ No newline at end of file + - documentation/* + \ No newline at end of file From 727d2c017b05c8d18614f045488dcca95abd05a9 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Wed, 21 Jul 2021 16:53:14 +0530 Subject: [PATCH 6/9] spell check --- .github/workflows/spellcheck.yml => .spellcheck.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/spellcheck.yml => .spellcheck.yml (100%) diff --git a/.github/workflows/spellcheck.yml b/.spellcheck.yml similarity index 100% rename from .github/workflows/spellcheck.yml rename to .spellcheck.yml From 2c0eca5f4bd1667ef83f3fb2fd4332c199d0ba8e Mon Sep 17 00:00:00 2001 From: sujith-mn <61968717+sujith-mn@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:48:26 +0530 Subject: [PATCH 7/9] Update build.yml --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0de2fef..699b83e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,6 @@ jobs: uses: actions/setup-java@v1 with: java-version: '11' - - name: spell check # Spellcheck - uses: actions/checkout@v2 - uses: igsekor/pyspelling-any@v0.0.2 From 987d7e50d5f9d448e5e28087d638b7c67ec45d31 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Mon, 2 Aug 2021 14:48:36 +0530 Subject: [PATCH 8/9] devonfw upgraded to 2021.04.002 --- .../service/api/rest/SecurityRestService.java | 38 ----- java/jtqj/core/.jtqj1.mv.db | Bin 0 -> 57344 bytes java/jtqj/core/pom.xml | 13 +- .../application/jtqj/SpringBootApp.java | 3 - .../ApplicationObjectMapperFactory.java | 9 +- .../common/impl/config/CsrfTokenImpl.java | 60 -------- .../impl/security/CsrfRequestMatcher.java | 6 +- .../general/service/impl/LoginController.java | 57 ------- .../impl/config/BaseWebSecurityConfig.java | 58 ++----- .../service/impl/config/WebConfig.java | 18 +-- .../impl/config/WebSecurityBeansConfig.java | 22 +-- .../impl/rest/SecurityRestServiceImpl.java | 77 ---------- .../src/main/resources/application.properties | 7 + .../resources/config/application.properties | 7 + .../rest/SecurityRestServiceImplTest.java | 99 ------------ java/jtqj/server/bin/pom.xml | 143 ------------------ .../server/bin/src/main/resources/logback.xml | 32 ---- 17 files changed, 66 insertions(+), 583 deletions(-) delete mode 100644 java/jtqj/api/src/main/java/com/devonfw/application/jtqj/general/service/api/rest/SecurityRestService.java create mode 100644 java/jtqj/core/.jtqj1.mv.db delete mode 100644 java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/CsrfTokenImpl.java delete mode 100644 java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/LoginController.java delete mode 100644 java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImpl.java delete mode 100644 java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImplTest.java delete mode 100644 java/jtqj/server/bin/pom.xml delete mode 100644 java/jtqj/server/bin/src/main/resources/logback.xml diff --git a/java/jtqj/api/src/main/java/com/devonfw/application/jtqj/general/service/api/rest/SecurityRestService.java b/java/jtqj/api/src/main/java/com/devonfw/application/jtqj/general/service/api/rest/SecurityRestService.java deleted file mode 100644 index e59a2e96..00000000 --- a/java/jtqj/api/src/main/java/com/devonfw/application/jtqj/general/service/api/rest/SecurityRestService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.devonfw.application.jtqj.general.service.api.rest; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; - -import org.springframework.security.web.csrf.CsrfToken; - -import com.devonfw.module.rest.common.api.RestService; - -import com.devonfw.application.jtqj.general.common.api.to.UserProfileTo; - -/** - * The security REST service provides access to the csrf token, the authenticated user's meta-data. Furthermore, it - * provides functionality to check permissions and roles of the authenticated user. - */ -@Path("/security/v1") -public interface SecurityRestService extends RestService { - - /** - * @param request {@link HttpServletRequest} to retrieve the current session from. - * @param response {@link HttpServletResponse} to send additional information. - * @return the Spring Security {@link CsrfToken} from the server session. - */ - @GET - @Path("/csrftoken/") - CsrfToken getCsrfToken(@Context HttpServletRequest request, @Context HttpServletResponse response); - - /** - * @return the {@link UserProfileTo} of the currently logged-in user. - */ - @GET - @Path("/currentuser/") - UserProfileTo getCurrentUser(); - -} diff --git a/java/jtqj/core/.jtqj1.mv.db b/java/jtqj/core/.jtqj1.mv.db new file mode 100644 index 0000000000000000000000000000000000000000..edc011cb5494c12179e21feba12dcc9d1c2030dc GIT binary patch literal 57344 zcmeG_ZHy$vbv=7C-0mKCu$+&NGl%;Ij@>hxrN6spL&(iX@9n_u&fd)I!uf;teDuKj zc4v;AU3}+AF_x12u#ikdjO@hz;Y5}YKO#W3rAW3!5}aV7NEj{{WF(VVvMuL)U}8I9 z*^pP&Royi`GrO~2+!5ETw!ft&4orC<*O~aE0z1)<#A0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XdQs-uto5~7{+=WT85b2YF0N}2 z;g6PTXtacV7SJy=T1u8o^b6j8E@<>@^WG>23f1?qw@aIDt984X^7eVVF!W-*U3~4) zC28d1V|PjFwtR*NCMp}yylrs#fK|Y)#}Moa16ROZGzA>QTL1Q*zu=qnyl0#AkjXb} z>;o}Qx4219ZsvHwDdrr${?FI{J6Xp}<&Nh%n$4u=@_A4z&&*Aykn*{MVGUpZ?@j&> Wr|Nj6-(Ve>h literal 0 HcmV?d00001 diff --git a/java/jtqj/core/pom.xml b/java/jtqj/core/pom.xml index 827608c7..36f7b11c 100644 --- a/java/jtqj/core/pom.xml +++ b/java/jtqj/core/pom.xml @@ -29,6 +29,17 @@ devon4j-security + + com.devonfw.java.starters + devon4j-starter-security-cors + + + + com.devonfw.java.starters + devon4j-starter-security-csrf + + + com.devonfw.java.modules devon4j-web @@ -153,7 +164,7 @@ cglib cglib - + net.logstash.logback diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/SpringBootApp.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/SpringBootApp.java index 184a2d8c..4d2a1349 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/SpringBootApp.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/SpringBootApp.java @@ -2,18 +2,15 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import com.devonfw.module.jpa.dataaccess.api.AdvancedRevisionEntity; import com.devonfw.module.jpa.dataaccess.impl.data.GenericRepositoryFactoryBean; /** * Main entry point of this {@link SpringBootApplication}. Simply run this class to start this app. */ @SpringBootApplication -@EntityScan(basePackages = { "com.devonfw.application.jtqj" }, basePackageClasses = { AdvancedRevisionEntity.class }) @EnableJpaRepositories(repositoryFactoryBeanClass = GenericRepositoryFactoryBean.class) @EnableGlobalMethodSecurity(jsr250Enabled = true) public class SpringBootApp { diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/ApplicationObjectMapperFactory.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/ApplicationObjectMapperFactory.java index 83f2c1db..ec29db47 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/ApplicationObjectMapperFactory.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/ApplicationObjectMapperFactory.java @@ -3,13 +3,11 @@ import javax.inject.Named; import org.springframework.data.domain.Pageable; -import org.springframework.security.web.csrf.CsrfToken; - -import com.fasterxml.jackson.databind.module.SimpleModule; import com.devonfw.module.json.common.base.ObjectMapperFactory; -import com.devonfw.module.json.common.base.type.PageableJsonSerializer; import com.devonfw.module.json.common.base.type.PageableJsonDeserializer; +import com.devonfw.module.json.common.base.type.PageableJsonSerializer; +import com.fasterxml.jackson.databind.module.SimpleModule; /** * The MappingFactory class to resolve polymorphic conflicts within the jtqj application. @@ -25,8 +23,7 @@ public ApplicationObjectMapperFactory() { super(); // see https://github.com/devonfw-wiki/devon4j/wiki/guide-json#json-and-inheritance SimpleModule module = getExtensionModule(); - module.addAbstractTypeMapping(CsrfToken.class, CsrfTokenImpl.class); - // register spring-data Pageable + // register spring-data Pageable module.addSerializer(Pageable.class, new PageableJsonSerializer()); module.addDeserializer(Pageable.class, new PageableJsonDeserializer()); } diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/CsrfTokenImpl.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/CsrfTokenImpl.java deleted file mode 100644 index 920a3b02..00000000 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/config/CsrfTokenImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.devonfw.application.jtqj.general.common.impl.config; - -import org.springframework.security.web.csrf.CsrfToken; - -/** - * Implementation of {@link CsrfToken} as Java bean for JSON deserialization. - */ -public class CsrfTokenImpl implements CsrfToken { - - private static final long serialVersionUID = 1L; - - private String headerName; - - private String parameterName; - - private String token; - - @Override - public String getHeaderName() { - - return this.headerName; - } - - @Override - public String getParameterName() { - - return this.parameterName; - } - - @Override - public String getToken() { - - return this.token; - } - - /** - * @param headerName new value of {@link #getHeaderName()}. - */ - public void setHeaderName(String headerName) { - - this.headerName = headerName; - } - - /** - * @param parameterName new value of {@link #getParameterName()}. - */ - public void setParameterName(String parameterName) { - - this.parameterName = parameterName; - } - - /** - * @param token new value of {@link #getToken()}. - */ - public void setToken(String token) { - - this.token = token; - } - -} diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java index 44c4a15c..b42b1c2a 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java @@ -2,6 +2,7 @@ import java.util.regex.Pattern; +import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import org.springframework.security.web.util.matcher.RequestMatcher; @@ -12,12 +13,13 @@ * * @see Cross-site request forgery */ +@Named("CsrfRequestMatcher") public class CsrfRequestMatcher implements RequestMatcher { private static final Pattern HTTP_METHOD_PATTERN = Pattern.compile("^GET$"); - private static final String[] PATH_PREFIXES_WITHOUT_CSRF_PROTECTION = - { "/login", "/logout", "/services/rest/login", "/websocket" }; + private static final String[] PATH_PREFIXES_WITHOUT_CSRF_PROTECTION = { "/login", "/logout", "/services/rest/login", + "/websocket" }; @Override public boolean matches(HttpServletRequest request) { diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/LoginController.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/LoginController.java deleted file mode 100644 index b74ce4df..00000000 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/LoginController.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.devonfw.application.jtqj.general.service.impl; - -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.servlet.ModelAndView; - -/** - * Controller for Login-Page. - */ -@Controller -public class LoginController { - - /** - * Default URL to redirect to after successfully login. - */ - public final static String defaultTargetUrl = "/"; - - /** - * Builds the model for the login page---mainly focusing on the error message handling. - * - * @param authentication_failed flag for authentication failed - * @param invalid_session flag for invalid session - * @param access_denied flag for access denied - * @param logout flag for successful logout - * @return the view model - */ - @RequestMapping(value = "/login**", method = {RequestMethod.GET,RequestMethod.POST}) - public ModelAndView login( - @RequestParam(value = "authentication_failed", required = false) boolean authentication_failed, - @RequestParam(value = "invalid_session", required = false) boolean invalid_session, - @RequestParam(value = "access_denied", required = false) boolean access_denied, - @RequestParam(value = "logout", required = false) boolean logout) { - - final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (!authentication.getPrincipal().equals("anonymousUser")) { - return new ModelAndView("redirect:" + defaultTargetUrl); - } - - ModelAndView model = new ModelAndView(); - if (authentication_failed) { - model.addObject("error", "Authentication failed!"); - } else if (invalid_session) { - model.addObject("error", "You are currently not logged in!"); - } else if (access_denied) { - model.addObject("error", "You have insufficient permissions to access this page!"); - } else if (logout) { - model.addObject("msg", "Logout successful!"); - } - - return model; - } - -} diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/BaseWebSecurityConfig.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/BaseWebSecurityConfig.java index c210b1f6..7f18b64b 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/BaseWebSecurityConfig.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/BaseWebSecurityConfig.java @@ -3,7 +3,6 @@ import javax.inject.Inject; import javax.servlet.Filter; -import org.springframework.beans.factory.annotation.Value; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @@ -14,13 +13,9 @@ import org.springframework.security.web.authentication.logout.LogoutFilter; import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; -import org.springframework.security.web.csrf.CsrfFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; -import com.devonfw.application.jtqj.general.common.impl.security.CsrfRequestMatcher; +import com.devonfw.module.security.common.api.config.WebSecurityConfigurer; import com.devonfw.module.security.common.impl.rest.AuthenticationSuccessHandlerSendingOkHttpStatusCode; import com.devonfw.module.security.common.impl.rest.JsonUsernamePasswordAuthenticationFilter; import com.devonfw.module.security.common.impl.rest.LogoutSuccessHandlerReturningOkHttpStatusCode; @@ -33,32 +28,14 @@ */ public abstract class BaseWebSecurityConfig extends WebSecurityConfigurerAdapter { - @Value("${security.cors.enabled}") - boolean corsEnabled = false; - @Inject private UserDetailsService userDetailsService; @Inject private PasswordEncoder passwordEncoder; - private CorsFilter getCorsFilter() { - - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - config.addAllowedOrigin("*"); - config.addAllowedHeader("*"); - config.addAllowedMethod("OPTIONS"); - config.addAllowedMethod("HEAD"); - config.addAllowedMethod("GET"); - config.addAllowedMethod("PUT"); - config.addAllowedMethod("POST"); - config.addAllowedMethod("DELETE"); - config.addAllowedMethod("PATCH"); - source.registerCorsConfiguration("/**", config); - return new CorsFilter(source); - } + @Inject + private WebSecurityConfigurer webSecurityConfigurer; /** * Configure spring security to enable a simple webform-login + a simple rest login. @@ -69,31 +46,25 @@ public void configure(HttpSecurity http) throws Exception { String[] unsecuredResources = new String[] { "/login", "/security/**", "/services/rest/login", "/services/rest/logout" }; - /**http + // disable CSRF protection by default, use csrf starter to override. + http = http.csrf().disable(); + // load starters as pluggins. + http = this.webSecurityConfigurer.configure(http); + + http // .userDetailsService(this.userDetailsService) // define all urls that are not to be secured .authorizeRequests().antMatchers(unsecuredResources).permitAll().anyRequest().authenticated().and() - - // activate crsf check for a selection of urls (but not for login & logout) - .csrf().requireCsrfProtectionMatcher(new CsrfRequestMatcher()).and() - // configure parameters for simple form login (and logout) .formLogin().successHandler(new SimpleUrlAuthenticationSuccessHandler()).defaultSuccessUrl("/") .failureUrl("/login.html?error").loginProcessingUrl("/j_spring_security_login").usernameParameter("username") .passwordParameter("password").and() // logout via POST is possible .logout().logoutSuccessUrl("/login.html").and() - // register login and logout filter that handles rest logins .addFilterAfter(getSimpleRestAuthenticationFilter(), BasicAuthenticationFilter.class) - .addFilterAfter(getSimpleRestLogoutFilter(), LogoutFilter.class);*/ - - http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); - - if (this.corsEnabled) { - http.addFilterBefore(getCorsFilter(), CsrfFilter.class); - } + .addFilterAfter(getSimpleRestLogoutFilter(), LogoutFilter.class); } /** @@ -124,8 +95,8 @@ protected JsonUsernamePasswordAuthenticationFilter getSimpleRestAuthenticationFi JsonUsernamePasswordAuthenticationFilter jsonFilter = new JsonUsernamePasswordAuthenticationFilter( new AntPathRequestMatcher("/services/rest/login")); - jsonFilter.setPasswordParameter("j_password"); - jsonFilter.setUsernameParameter("j_username"); + jsonFilter.setPasswordParameter("password"); + jsonFilter.setUsernameParameter("username"); jsonFilter.setAuthenticationManager(authenticationManager()); // set failurehandler that uses no redirect in case of login failure; just HTTP-status: 401 jsonFilter.setAuthenticationManager(authenticationManagerBean()); @@ -139,10 +110,7 @@ protected JsonUsernamePasswordAuthenticationFilter getSimpleRestAuthenticationFi @Inject public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("waiter").password(this.passwordEncoder.encode("waiter")).roles("Waiter") - .and().withUser("cook").password(this.passwordEncoder.encode("cook")).roles("Cook").and().withUser("barkeeper") - .password(this.passwordEncoder.encode("barkeeper")).roles("Barkeeper").and().withUser("chief") - .password(this.passwordEncoder.encode("chief")).roles("Chief"); + auth.inMemoryAuthentication().withUser("admin").password(this.passwordEncoder.encode("admin")).roles("Admin"); } } diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebConfig.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebConfig.java index 711f0ba0..f4a25b46 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebConfig.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebConfig.java @@ -1,7 +1,5 @@ package com.devonfw.application.jtqj.general.service.impl.config; -import javax.servlet.Filter; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.web.servlet.FilterRegistrationBean; @@ -28,10 +26,10 @@ public class WebConfig { * with their duration and status code. */ @Bean - public FilterRegistrationBean performanceLogFilter() { + public FilterRegistrationBean performanceLogFilter() { - FilterRegistrationBean registration = new FilterRegistrationBean(); - Filter performanceLogFilter = new PerformanceLogFilter(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); + PerformanceLogFilter performanceLogFilter = new PerformanceLogFilter(); this.beanFactory.autowireBean(performanceLogFilter); registration.setFilter(performanceLogFilter); registration.addUrlPatterns("/*"); @@ -52,10 +50,10 @@ public DiagnosticContextFacade diagnosticContextFacade() { * correlation id as MDC so it will be included in all associated logs. */ @Bean - public FilterRegistrationBean diagnosticContextFilter() { + public FilterRegistrationBean diagnosticContextFilter() { - FilterRegistrationBean registration = new FilterRegistrationBean(); - Filter diagnosticContextFilter = new DiagnosticContextFilter(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); + DiagnosticContextFilter diagnosticContextFilter = new DiagnosticContextFilter(); this.beanFactory.autowireBean(diagnosticContextFilter); registration.setFilter(diagnosticContextFilter); registration.addUrlPatterns(ServiceConstants.URL_PATH_SERVICES + "/*"); @@ -66,9 +64,9 @@ public FilterRegistrationBean diagnosticContextFilter() { * @return the {@link FilterRegistrationBean} to register the {@link CharacterEncodingFilter} to set the encoding. */ @Bean - public FilterRegistrationBean setCharacterEncodingFilter() { + public FilterRegistrationBean setCharacterEncodingFilter() { - FilterRegistrationBean registration = new FilterRegistrationBean(); + FilterRegistrationBean registration = new FilterRegistrationBean<>(); CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(false); diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebSecurityBeansConfig.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebSecurityBeansConfig.java index 17cfcdde..0b00b52a 100644 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebSecurityBeansConfig.java +++ b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/config/WebSecurityBeansConfig.java @@ -20,6 +20,18 @@ @Configuration public class WebSecurityBeansConfig { + + /** + * This method provides a new instance of {@code CsrfTokenRepository} + * + * @return the newly created {@code CsrfTokenRepository} + */ + @Bean + public CsrfTokenRepository csrfTokenRepository() { + + return new HttpSessionCsrfTokenRepository(); + } + /** * This method provides a new instance of {@code AccessControlProvider} * @@ -42,16 +54,6 @@ public AccessControlSchemaProvider accessControlSchemaProvider() { return new AccessControlSchemaProviderImpl(); } - /** - * This method provides a new instance of {@code CsrfTokenRepository} - * - * @return the newly created {@code CsrfTokenRepository} - */ - @Bean - public CsrfTokenRepository csrfTokenRepository() { - - return new HttpSessionCsrfTokenRepository(); - } /** * This method provides a new instance of {@code DefaultRolesPrefixPostProcessor} diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImpl.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImpl.java deleted file mode 100644 index e8a12487..00000000 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.devonfw.application.jtqj.general.service.impl.rest; - -import javax.annotation.security.PermitAll; -import javax.inject.Inject; -import javax.inject.Named; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.transaction.Transactional; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.web.csrf.CsrfToken; -import org.springframework.security.web.csrf.CsrfTokenRepository; - -import com.devonfw.application.jtqj.general.common.api.exception.NoActiveUserException; -import com.devonfw.application.jtqj.general.common.api.to.UserProfileTo; -import com.devonfw.application.jtqj.general.service.api.rest.SecurityRestService; - -/** - * Implementation of {@link SecurityRestService}. - */ -@Named -@Transactional -public class SecurityRestServiceImpl implements SecurityRestService { - - /** Logger instance. */ - private static final Logger LOG = LoggerFactory.getLogger(SecurityRestServiceImpl.class); - - /** - * Use {@link CsrfTokenRepository} for CSRF protection. - */ - private CsrfTokenRepository csrfTokenRepository; - - @Override - @PermitAll - public CsrfToken getCsrfToken(HttpServletRequest request, HttpServletResponse response) { - - CsrfToken token = this.csrfTokenRepository.loadToken(request); - if (token == null) { - LOG.error("No CsrfToken could be found - instantiating a new Token"); - token = this.csrfTokenRepository.generateToken(request); - this.csrfTokenRepository.saveToken(token, request, response); - } - return token; - } - - @Override - @PermitAll - public UserProfileTo getCurrentUser() { - - SecurityContext context = SecurityContextHolder.getContext(); - Authentication authentication = null; - if (context != null) { - authentication = context.getAuthentication(); - } - if (authentication == null) { - throw new NoActiveUserException(); - } - UserDetails user = (UserDetails) authentication.getPrincipal(); - UserProfileTo profile = new UserProfileTo(); - profile.setLogin(user.getUsername()); - return profile; - } - - /** - * @param csrfTokenRepository the csrfTokenRepository to set - */ - @Inject - public void setCsrfTokenRepository(CsrfTokenRepository csrfTokenRepository) { - - this.csrfTokenRepository = csrfTokenRepository; - } -} diff --git a/java/jtqj/core/src/main/resources/application.properties b/java/jtqj/core/src/main/resources/application.properties index 7c876cb3..46c02fda 100644 --- a/java/jtqj/core/src/main/resources/application.properties +++ b/java/jtqj/core/src/main/resources/application.properties @@ -30,3 +30,10 @@ spring.batch.job.enabled=false # Flyway for Database Setup and Migrations spring.flyway.locations=classpath:db/migration,classpath:db/type/h2 + +#CORS support +security.cors.spring.allowCredentials=true +security.cors.spring.allowedOriginPatterns=* +security.cors.spring.allowedHeaders=* +security.cors.spring.allowedMethods=OPTIONS,HEAD,GET,PUT,POST,DELETE,PATCH +security.cors.pathPattern=/** \ No newline at end of file diff --git a/java/jtqj/core/src/main/resources/config/application.properties b/java/jtqj/core/src/main/resources/config/application.properties index fe4ea90c..9a172822 100644 --- a/java/jtqj/core/src/main/resources/config/application.properties +++ b/java/jtqj/core/src/main/resources/config/application.properties @@ -21,3 +21,10 @@ spring.jackson.serialization.INDENT_OUTPUT=true # Flyway for Database Setup and Migrations spring.flyway.enabled=true spring.flyway.clean-on-validation-error=true + +#CORS support +security.cors.spring.allowCredentials=true +security.cors.spring.allowedOriginPatterns=* +security.cors.spring.allowedHeaders=* +security.cors.spring.allowedMethods=OPTIONS,HEAD,GET,PUT,POST,DELETE,PATCH +security.cors.pathPattern=/** \ No newline at end of file diff --git a/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImplTest.java b/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImplTest.java deleted file mode 100644 index 64508e08..00000000 --- a/java/jtqj/core/src/test/java/com/devonfw/application/jtqj/general/service/impl/rest/SecurityRestServiceImplTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.devonfw.application.jtqj.general.service.impl.rest; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.web.csrf.CsrfToken; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.client.RestTemplate; - -import com.devonfw.application.jtqj.general.common.api.to.UserProfileTo; -import com.devonfw.application.jtqj.general.service.api.rest.SecurityRestService; -import com.devonfw.application.jtqj.general.service.base.test.RestServiceTest; -import com.devonfw.module.service.common.api.client.config.ServiceClientConfigBuilder; - -/** - * This class tests the login functionality of {@link SecurityRestServiceImpl}. - */ -@RunWith(SpringRunner.class) -public class SecurityRestServiceImplTest extends RestServiceTest { - - /** Logger instance. */ - private static final Logger LOG = LoggerFactory.getLogger(SecurityRestServiceImplTest.class); - - /** - * Test the login functionality as it will be used from a JavaScript client. - */ - @Test - @Ignore // Temporarily this test is failing so ignored - public void testLogin() { - - String login = "waiter"; - String password = "waiter"; - - ResponseEntity postResponse = login(login, password); - LOG.debug("Body: " + postResponse.getBody()); - assertThat(postResponse.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(postResponse.getHeaders().containsKey(HttpHeaders.SET_COOKIE)).isTrue(); - } - - /** - * Test of {@code SecurityRestService.getCsrfToken()}. - */ - @Test - public void testGetCsrfToken() { - - String login = "waiter"; - String password = "waiter"; - SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, - new ServiceClientConfigBuilder().host("localhost").authBasic().userLogin(login).userPassword(password) - .buildMap()); - CsrfToken csrfToken = securityService.getCsrfToken(null, null); - assertThat(csrfToken.getHeaderName()).isEqualTo("X-CSRF-TOKEN"); - assertThat(csrfToken.getParameterName()).isEqualTo("_csrf"); - assertThat(csrfToken.getToken()).isNotNull(); - LOG.debug("Csrf Token: {}", csrfToken.getToken()); - } - - /** - * Test of {@link SecurityRestService#getCurrentUser()}. - */ - @Test - public void testGetCurrentUser() { - - String login = "waiter"; - String password = "waiter"; - SecurityRestService securityService = getServiceClientFactory().create(SecurityRestService.class, - new ServiceClientConfigBuilder().host("localhost").authBasic().userLogin(login).userPassword(password) - .buildMap()); - UserProfileTo userProfile = securityService.getCurrentUser(); - assertThat(userProfile.getLogin()).isEqualTo(login); - } - - /** - * Performs the login as required by a JavaScript client. - * - * @param userName the username of the user - * @param tmpPassword the password of the user - * @return @ {@link ResponseEntity} containing containing a cookie in its header. - */ - private ResponseEntity login(String userName, String tmpPassword) { - - String tmpUrl = "http://localhost:" + String.valueOf(this.port) + "/services/rest/login"; - - HttpEntity postRequest = new HttpEntity<>( - "{\"j_username\": \"" + userName + "\", \"j_password\": \"" + tmpPassword + "\"}", new HttpHeaders()); - - ResponseEntity postResponse = new RestTemplate().exchange(tmpUrl, HttpMethod.POST, postRequest, - String.class); - return postResponse; - } - -} diff --git a/java/jtqj/server/bin/pom.xml b/java/jtqj/server/bin/pom.xml deleted file mode 100644 index 1dab7321..00000000 --- a/java/jtqj/server/bin/pom.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - 4.0.0 - - com.devonfw.java.jtqj - jtqj - v4 - - jtqj-server - war - ${project.artifactId} - Server for the jtqj application - a simple example using the Open Application Standard Platform for Java (devon4j). - - - 1.8 - - - - - ${project.groupId} - jtqj-core - ${project.version} - - - - - - jsclient - - - false - - - - - org.codehaus.mojo - exec-maven-plugin - - - npm-install - generate-sources - - exec - - - npm - - install - - ${js.client.dir} - - - - gulp-clean - generate-sources - - exec - - - gulp - - clean - - ${js.client.dir} - - - - gulp-build - generate-sources - - exec - - - gulp - - build:dist - - ${js.client.dir} - - - - gulp-test - test - - exec - - - gulp - - test - - ${js.client.dir} - - - - - - org.apache.maven.plugins - maven-war-plugin - - WEB-INF/classes/config/application.properties - ${project.artifactId} - false - - - - - - - - - - - ${project.basedir}/src/main/resources - - - ${js.client.dir}/dist - static - - - - - org.springframework.boot - spring-boot-maven-plugin - - com.devonfw.application.jtqj.SpringBootApp - bootified - ${project.artifactId} - - - - - repackage - - - - - - - - - diff --git a/java/jtqj/server/bin/src/main/resources/logback.xml b/java/jtqj/server/bin/src/main/resources/logback.xml deleted file mode 100644 index cb0e3a5b..00000000 --- a/java/jtqj/server/bin/src/main/resources/logback.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - false - correlationId - - timestamp - [ignore] - [ignore] - -      {"appname":"jtqj"} - UTC - - - - - - - - - - - - - - - - - - \ No newline at end of file From e49339e3b657d8542975a61fb4b6e3dc10ccb8b8 Mon Sep 17 00:00:00 2001 From: sujith-mn Date: Tue, 3 Aug 2021 12:57:58 +0530 Subject: [PATCH 9/9] removed unwanted files, batch etc. --- java/jtqj/api/bin/pom.xml | 39 ---- .../impl/security/CsrfRequestMatcher.java | 56 ----- .../application/jtqj/SpringBootBatchApp.java | 31 --- .../batch/impl/config/BeansBatchConfig.java | 193 ------------------ .../migration/h2/V0002__Add_batch_tables.sql | 81 -------- .../base/test/SpringBatchIntegrationTest.java | 53 ----- .../general/common/base/test/TestUtil.java | 29 --- 7 files changed, 482 deletions(-) delete mode 100644 java/jtqj/api/bin/pom.xml delete mode 100644 java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java delete mode 100644 java/jtqj/src/main/java/com/devonfw/application/jtqj/SpringBootBatchApp.java delete mode 100644 java/jtqj/src/main/java/com/devonfw/application/jtqj/general/batch/impl/config/BeansBatchConfig.java delete mode 100644 java/jtqj/src/main/resources/db/migration/h2/V0002__Add_batch_tables.sql delete mode 100644 java/jtqj/src/test/java/com/devonfw/application/jtqj/general/batch/base/test/SpringBatchIntegrationTest.java delete mode 100644 java/jtqj/src/test/java/com/devonfw/application/jtqj/general/common/base/test/TestUtil.java diff --git a/java/jtqj/api/bin/pom.xml b/java/jtqj/api/bin/pom.xml deleted file mode 100644 index fe04a793..00000000 --- a/java/jtqj/api/bin/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - com.devonfw.java.jtqj - jtqj - v4 - - jtqj-api - jar - ${project.artifactId} - API of the server for the jtqj application (containing datatypes, transfer-objects, and service interfaces). - - - - org.springframework.data - spring-data-commons - - - com.devonfw.java.modules - devon4j-rest - - - com.devonfw.java.modules - devon4j-logging - - - com.devonfw.java.modules - devon4j-security - - - - javax.servlet - javax.servlet-api - provided - - - diff --git a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java b/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java deleted file mode 100644 index b42b1c2a..00000000 --- a/java/jtqj/core/src/main/java/com/devonfw/application/jtqj/general/common/impl/security/CsrfRequestMatcher.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.devonfw.application.jtqj.general.common.impl.security; - -import java.util.regex.Pattern; - -import javax.inject.Named; -import javax.servlet.http.HttpServletRequest; - -import org.springframework.security.web.util.matcher.RequestMatcher; - -/** - * This is the implementation of {@link RequestMatcher}, which decides which {@link HttpServletRequest Requests} require - * a correct CSRF token. - * - * @see Cross-site request forgery - */ -@Named("CsrfRequestMatcher") -public class CsrfRequestMatcher implements RequestMatcher { - - private static final Pattern HTTP_METHOD_PATTERN = Pattern.compile("^GET$"); - - private static final String[] PATH_PREFIXES_WITHOUT_CSRF_PROTECTION = { "/login", "/logout", "/services/rest/login", - "/websocket" }; - - @Override - public boolean matches(HttpServletRequest request) { - - // GET requests are read-only and therefore do not need CSRF protection - if (HTTP_METHOD_PATTERN.matcher(request.getMethod()).matches()) { - - return false; - } - - // There are specific URLs which can not be protected from CSRF. For example, in case of the the login page, - // the CSRF token can only be accessed after a successful authentication ("login"). - String requestPath = getRequestPath(request); - for (String path : PATH_PREFIXES_WITHOUT_CSRF_PROTECTION) { - if (requestPath.startsWith(path)) { - return false; - } - } - - return true; - } - - private String getRequestPath(HttpServletRequest request) { - - String url = request.getServletPath(); - String pathInfo = request.getPathInfo(); - - if (pathInfo != null) { - url += pathInfo; - } - - return url; - } -} diff --git a/java/jtqj/src/main/java/com/devonfw/application/jtqj/SpringBootBatchApp.java b/java/jtqj/src/main/java/com/devonfw/application/jtqj/SpringBootBatchApp.java deleted file mode 100644 index 20215de7..00000000 --- a/java/jtqj/src/main/java/com/devonfw/application/jtqj/SpringBootBatchApp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.devonfw.application.jtqj; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; - -import com.devonfw.module.jpa.dataaccess.api.AdvancedRevisionEntity; - -/** - * {@link SpringBootApplication} for running this batch. - */ -@SpringBootApplication(exclude = { EndpointAutoConfiguration.class, SecurityAutoConfiguration.class, -SecurityFilterAutoConfiguration.class, }) -@EntityScan(basePackages = { "com.devonfw.application.jtqj" }, basePackageClasses = { AdvancedRevisionEntity.class }) -@EnableGlobalMethodSecurity(jsr250Enabled = false) -public class SpringBootBatchApp { - - /** - * Entry point for spring-boot based app - * - * @param args - arguments - */ - public static void main(String[] args) { - - SpringApplication.run(SpringBootBatchApp.class, args); - } -} diff --git a/java/jtqj/src/main/java/com/devonfw/application/jtqj/general/batch/impl/config/BeansBatchConfig.java b/java/jtqj/src/main/java/com/devonfw/application/jtqj/general/batch/impl/config/BeansBatchConfig.java deleted file mode 100644 index 273e8f85..00000000 --- a/java/jtqj/src/main/java/com/devonfw/application/jtqj/general/batch/impl/config/BeansBatchConfig.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.devonfw.application.jtqj.general.batch.impl.config; - -import javax.inject.Inject; -import javax.sql.DataSource; - -import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor; -import org.springframework.batch.core.configuration.support.MapJobRegistry; -import org.springframework.batch.core.explore.support.JobExplorerFactoryBean; -import org.springframework.batch.core.launch.support.RunIdIncrementer; -import org.springframework.batch.core.launch.support.SimpleJobOperator; -import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.DependsOn; -import org.springframework.transaction.PlatformTransactionManager; - -/** - * This class contains the configuration like jobLauncher,Jobrepository etc. - */ -import com.devonfw.module.batch.common.impl.JobLauncherWithAdditionalRestartCapabilities; - -/** - * This class contains configuration of batch beans. - */ -@Configuration -public class BeansBatchConfig { - - private JobRepositoryFactoryBean jobRepository; - - private MapJobRegistry jobRegistry; - - private JobLauncherWithAdditionalRestartCapabilities jobLauncher; - - private JobExplorerFactoryBean jobExplorer; - - private DataSource dataSource; - - private PlatformTransactionManager transactionManager; - - @Value("ISOLATION_DEFAULT") - private String isolationLevelForCreate; - - /** - * This method is creating joboperator bean - * - * @return SimpleJobOperator - */ - @Bean - @DependsOn({ "jobRepository", "jobExplorer", "jobRegistry", "jobLauncher" }) - public SimpleJobOperator jobOperator() { - - SimpleJobOperator jobOperator = new SimpleJobOperator(); - try { - jobOperator.setJobExplorer(this.jobExplorer.getObject()); - } catch (Exception e) { - throw new BeanCreationException("Could not create BatchJobOperator", e); - } - - jobOperator.setJobLauncher(this.jobLauncher); - jobOperator.setJobRegistry(this.jobRegistry); - - try { - jobOperator.setJobRepository(this.jobRepository.getObject()); - } catch (Exception e) { - throw new BeanCreationException("Could not create BatchJobOperator", e); - } - - return jobOperator; - } - - /** - * This method is creating jobrepository - * - * @return JobRepositoryFactoryBean - */ - @Bean(name = "jobRepository") - public JobRepositoryFactoryBean jobRepository() { - - this.jobRepository = new JobRepositoryFactoryBean(); - this.jobRepository.setDataSource(this.dataSource); - this.jobRepository.setTransactionManager(this.transactionManager); - this.jobRepository.setIsolationLevelForCreate(this.isolationLevelForCreate); - return this.jobRepository; - } - - /** - * This method is creating jobLauncher bean - * - * @return SimpleJobLauncher - */ - @Bean - @DependsOn("jobRepository") - public JobLauncherWithAdditionalRestartCapabilities jobLauncher() { - - this.jobLauncher = new JobLauncherWithAdditionalRestartCapabilities(); - - try { - this.jobLauncher.setJobRepository(this.jobRepository.getObject()); - } catch (Exception e) { - throw new BeanCreationException("Could not create BatchJobOperator", e); - } - - return this.jobLauncher; - } - - /** - * This method is creating jobExplorer bean - * - * @return JobExplorerFactoryBean - */ - @Bean - @DependsOn("dataSource") - public JobExplorerFactoryBean jobExplorer() { - - this.jobExplorer = new JobExplorerFactoryBean(); - this.jobExplorer.setDataSource(this.dataSource); - return this.jobExplorer; - } - - /** - * This method is creating jobRegistry bean - * - * @return MapJobRegistry - */ - @Bean - public MapJobRegistry jobRegistry() { - - this.jobRegistry = new MapJobRegistry(); - return this.jobRegistry; - } - - /** - * This method is creating JobRegistryBeanPostProcessor - * - * @return JobRegistryBeanPostProcessor - */ - @Bean - @DependsOn("jobRegistry") - public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor() { - - JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor(); - postProcessor.setJobRegistry(this.jobRegistry); - return postProcessor; - } - - /** - * This method is creating incrementer - * - * @return RunIdIncrementer - */ - @Bean - public RunIdIncrementer incrementer() { - - return new RunIdIncrementer(); - } - - /** - * @return datasource - */ - public DataSource getDataSource() { - - return this.dataSource; - } - - /** - * @param datasource the datasource to set - */ - @Inject - public void setDataSource(DataSource datasource) { - - this.dataSource = datasource; - } - - /** - * @return transactionManager - */ - public PlatformTransactionManager getTransactionManager() { - - return this.transactionManager; - } - - /** - * @param transactionManager the transactionManager to set - */ - @Inject - public void setTransactionManager(PlatformTransactionManager transactionManager) { - - this.transactionManager = transactionManager; - } - -} diff --git a/java/jtqj/src/main/resources/db/migration/h2/V0002__Add_batch_tables.sql b/java/jtqj/src/main/resources/db/migration/h2/V0002__Add_batch_tables.sql deleted file mode 100644 index 980d37d4..00000000 --- a/java/jtqj/src/main/resources/db/migration/h2/V0002__Add_batch_tables.sql +++ /dev/null @@ -1,81 +0,0 @@ --- Autogenerated: do not edit this file - -CREATE TABLE BATCH_JOB_INSTANCE ( - JOB_INSTANCE_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_NAME VARCHAR(100) NOT NULL, - JOB_KEY VARCHAR(32) NOT NULL, - constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION ( - JOB_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_INSTANCE_ID BIGINT NOT NULL, - CREATE_TIME TIMESTAMP NOT NULL, - START_TIME TIMESTAMP DEFAULT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, - constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID) - references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION_PARAMS ( - JOB_EXECUTION_ID BIGINT NOT NULL , - TYPE_CD VARCHAR(6) NOT NULL , - KEY_NAME VARCHAR(100) NOT NULL , - STRING_VAL VARCHAR(250) , - DATE_VAL TIMESTAMP DEFAULT NULL , - LONG_VAL BIGINT , - DOUBLE_VAL DOUBLE PRECISION , - IDENTIFYING CHAR(1) NOT NULL , - constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_STEP_EXECUTION ( - STEP_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT NOT NULL, - STEP_NAME VARCHAR(100) NOT NULL, - JOB_EXECUTION_ID BIGINT NOT NULL, - START_TIME TIMESTAMP NOT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - COMMIT_COUNT BIGINT , - READ_COUNT BIGINT , - FILTER_COUNT BIGINT , - WRITE_COUNT BIGINT , - READ_SKIP_COUNT BIGINT , - WRITE_SKIP_COUNT BIGINT , - PROCESS_SKIP_COUNT BIGINT , - ROLLBACK_COUNT BIGINT , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( - STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID) - references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT ( - JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_SEQ; diff --git a/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/batch/base/test/SpringBatchIntegrationTest.java b/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/batch/base/test/SpringBatchIntegrationTest.java deleted file mode 100644 index 36ed053d..00000000 --- a/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/batch/base/test/SpringBatchIntegrationTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.devonfw.application.jtqj.general.batch.base.test; - -import javax.inject.Inject; - -import org.flywaydb.core.Flyway; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.test.JobLauncherTestUtils; - -import com.devonfw.application.jtqj.general.common.base.test.TestUtil; -import com.devonfw.module.test.common.base.ComponentTest; - -/** - * Base class for all spring batch integration tests. It helps to do End-to-End job tests. - */ -public abstract class SpringBatchIntegrationTest extends ComponentTest { - - @Inject - private JobLauncher jobLauncher; - - @Inject - private Flyway flyway; - - @Override - protected void doSetUp() { - - super.doSetUp(); - this.flyway.clean(); - this.flyway.migrate(); - } - - @Override - protected void doTearDown() { - - super.doTearDown(); - TestUtil.logout(); - } - - /** - * @param job job to configure - * @return jobLauncherTestUtils - */ - public JobLauncherTestUtils getJobLauncherTestUtils(Job job) { - - JobLauncherTestUtils jobLauncherTestUtils = new JobLauncherTestUtils(); - jobLauncherTestUtils.setJob(job); - jobLauncherTestUtils.setJobLauncher(this.jobLauncher); - - return jobLauncherTestUtils; - } -} diff --git a/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/common/base/test/TestUtil.java b/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/common/base/test/TestUtil.java deleted file mode 100644 index 3c91ea6f..00000000 --- a/java/jtqj/src/test/java/com/devonfw/application/jtqj/general/common/base/test/TestUtil.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.devonfw.application.jtqj.general.common.base.test; - -import org.springframework.security.authentication.TestingAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; - -/** - * This is a utility for testing. It allows to simulate authentication for component testing. - */ -public class TestUtil { - - /** - * @param login the id of the user to run the test as. - * @param permissions the permissions for the test. - */ - public static void login(String login, String... permissions) { - - Authentication authentication = new TestingAuthenticationToken(login, login, permissions); - SecurityContextHolder.getContext().setAuthentication(authentication); - } - - /** - * Logs off any previously logged on user. - */ - public static void logout() { - - SecurityContextHolder.getContext().setAuthentication(null); - } -}